Skip to content

Keyset as string or integer #437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 15 additions & 20 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
Expand All @@ -14,22 +13,21 @@
use Rector\Symfony\Set\SymfonySetList;

return static function (RectorConfig $config): void {
$config->sets([
SetList::DEAD_CODE,
LevelSetList::UP_TO_PHP_81,
SymfonyLevelSetList::UP_TO_SYMFONY_54,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
SymfonySetList::SYMFONY_STRICT,
DoctrineSetList::DOCTRINE_CODE_QUALITY,
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
PHPUnitLevelSetList::UP_TO_PHPUNIT_100,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_EXCEPTION,
PHPUnitSetList::REMOVE_MOCKS,
PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER,
]);
$config->import(SetList::DEAD_CODE);
$config->import(LevelSetList::UP_TO_PHP_81);
$config->import(SymfonyLevelSetList::UP_TO_SYMFONY_54);
$config->import(SymfonySetList::SYMFONY_CODE_QUALITY);
$config->import(SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION);
$config->import(SymfonySetList::SYMFONY_STRICT);
$config->import(SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES);
$config->import(DoctrineSetList::DOCTRINE_CODE_QUALITY);
$config->import(DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES);
$config->import(PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD);
$config->import(PHPUnitLevelSetList::UP_TO_PHPUNIT_90);
$config->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY);
$config->import(PHPUnitSetList::PHPUNIT_EXCEPTION);
$config->import(PHPUnitSetList::REMOVE_MOCKS);
$config->import(PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER);
$config->parallel();
$config->paths([__DIR__ . '/src', __DIR__ . '/performance', __DIR__ . '/tests']);
$config->skip([
Expand All @@ -40,7 +38,4 @@
$config->phpVersion(PhpVersion::PHP_81);
$config->importNames();
$config->importShortClasses();

$services = $config->services();
$services->set(TypedPropertyRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Jose\Bundle\JoseFramework\DependencyInjection\Source\KeyManagement\JWKSource;

use function is_int;
use function is_string;
use Jose\Bundle\JoseFramework\DependencyInjection\Source\AbstractSource;
use Jose\Component\Core\JWK;
use Jose\Component\KeyManagement\JWKFactory;
Expand Down Expand Up @@ -41,7 +43,11 @@ public function addConfiguration(NodeDefinition $node): void
->info('The key set service.')
->isRequired()
->end()
->integerNode('index')
->variableNode('index')
->validate()
->ifTrue(fn (mixed $v): bool => ! is_int($v) && ! is_string($v))
->thenInvalid('Invalid keyset index.')
->end()
->info('The index of the key in the key set.')
->isRequired()
->end()
Expand Down