diff --git a/rector.php b/rector.php index 601130d7..309cfc89 100644 --- a/rector.php +++ b/rector.php @@ -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; @@ -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([ @@ -40,7 +38,4 @@ $config->phpVersion(PhpVersion::PHP_81); $config->importNames(); $config->importShortClasses(); - - $services = $config->services(); - $services->set(TypedPropertyRector::class); }; 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()