diff --git a/rector.php b/rector.php index 83826068..6d92b1a9 100644 --- a/rector.php +++ b/rector.php @@ -13,21 +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, - DoctrineSetList::DOCTRINE_CODE_QUALITY, - DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, - PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, - PHPUnitLevelSetList::UP_TO_PHPUNIT_90, - 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([ diff --git a/src/Bundle/JoseFramework/DependencyInjection/Source/KeyManagement/JWKSource/JWKSet.php b/src/Bundle/JoseFramework/DependencyInjection/Source/KeyManagement/JWKSource/JWKSet.php index c5abbc16..97142000 100644 --- a/src/Bundle/JoseFramework/DependencyInjection/Source/KeyManagement/JWKSource/JWKSet.php +++ b/src/Bundle/JoseFramework/DependencyInjection/Source/KeyManagement/JWKSource/JWKSet.php @@ -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; @@ -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()