diff --git a/CHANGELOG.md b/CHANGELOG.md index 359a4b93..083ec1d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Enh #207: Add `--open` option for `serve` command (@xepozz) - Enh #207: Print possible options for `serve` command (@xepozz) +- Enh #218: Update Application to support PHP 8.4 (@alexander-schranz) ## 2.2.0 February 17, 2024 diff --git a/rector.php b/rector.php index 63713ce9..9e503cde 100644 --- a/rector.php +++ b/rector.php @@ -4,19 +4,13 @@ use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; -return static function (RectorConfig $rectorConfig): void { - $rectorConfig->paths([ +return RectorConfig::configure() + ->withPaths([ __DIR__ . '/src', __DIR__ . '/tests', - ]); - - // register a single rule - $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); - - // define sets of rules - $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_80, - ]); -}; + ]) + ->withRules([ + InlineConstructorDefaultToPropertyRector::class, + ]) + ->withPhpSets(php80: true); diff --git a/src/Application.php b/src/Application.php index 8ba622e1..8f4341f4 100644 --- a/src/Application.php +++ b/src/Application.php @@ -87,7 +87,7 @@ public function addOptions(InputOption $options): void ->addOption($options); } - public function extractNamespace(string $name, int $limit = null): string + public function extractNamespace(string $name, ?int $limit = null): string { return parent::extractNamespace(str_replace('/', ':', $name), $limit); } diff --git a/src/SymfonyEventDispatcher.php b/src/SymfonyEventDispatcher.php index 54062cfe..781712aa 100644 --- a/src/SymfonyEventDispatcher.php +++ b/src/SymfonyEventDispatcher.php @@ -22,7 +22,7 @@ public function __construct(private PsrEventDispatcherInterface $dispatcher) * * @psalm-return T */ - public function dispatch(object $event, string $eventName = null): object + public function dispatch(object $event, ?string $eventName = null): object { /** @psalm-var T */ return $this->dispatcher->dispatch($event);