Skip to content

Update Application to support PHP 8.4 #218

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 8 commits into from
Jan 23, 2025
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 7 additions & 13 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,31 @@
public function shutdown(int $exitCode): void
{
if ($this->dispatcher !== null) {
$this->dispatcher->dispatch(new ApplicationShutdown($exitCode));

Check warning on line 48 in src/Application.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ public function shutdown(int $exitCode) : void { if ($this->dispatcher !== null) { - $this->dispatcher->dispatch(new ApplicationShutdown($exitCode)); + } } public function renderThrowable(Throwable $e, OutputInterface $output) : void
}
}

public function renderThrowable(Throwable $e, OutputInterface $output): void
{
$output->writeln('', OutputInterface::VERBOSITY_QUIET);

Check warning on line 54 in src/Application.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ } public function renderThrowable(Throwable $e, OutputInterface $output) : void { - $output->writeln('', OutputInterface::VERBOSITY_QUIET); + $this->doRenderThrowable($e, $output); } protected function doRenderThrowable(Throwable $e, OutputInterface $output) : void

$this->doRenderThrowable($e, $output);
}

protected function doRenderThrowable(Throwable $e, OutputInterface $output): void
{
parent::doRenderThrowable($e, $output);

Check warning on line 61 in src/Application.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ } protected function doRenderThrowable(Throwable $e, OutputInterface $output) : void { - parent::doRenderThrowable($e, $output); + // Friendly Exception support if ($e instanceof FriendlyExceptionInterface) { if ($output instanceof StyleInterface) {

// Friendly Exception support
if ($e instanceof FriendlyExceptionInterface) {
if ($output instanceof StyleInterface) {
$output->title($e->getName());

Check warning on line 66 in src/Application.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ // Friendly Exception support if ($e instanceof FriendlyExceptionInterface) { if ($output instanceof StyleInterface) { - $output->title($e->getName()); + if (($solution = $e->getSolution()) !== null) { $output->note($solution); }
if (($solution = $e->getSolution()) !== null) {
$output->note($solution);
}
$output->newLine();

Check warning on line 70 in src/Application.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ if (($solution = $e->getSolution()) !== null) { $output->note($solution); } - $output->newLine(); + } else { $output->writeln('<fg=red>' . $e->getName() . '</>'); if (($solution = $e->getSolution()) !== null) {
} else {
$output->writeln('<fg=red>' . $e->getName() . '</>');

Check warning on line 72 in src/Application.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ } $output->newLine(); } else { - $output->writeln('<fg=red>' . $e->getName() . '</>'); + $output->writeln($e->getName() . '<fg=red>' . '</>'); if (($solution = $e->getSolution()) !== null) { $output->writeln('<fg=yellow>' . $solution . '</>'); }

Check warning on line 72 in src/Application.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ } $output->newLine(); } else { - $output->writeln('<fg=red>' . $e->getName() . '</>'); + $output->writeln($e->getName() . '</>'); if (($solution = $e->getSolution()) !== null) { $output->writeln('<fg=yellow>' . $solution . '</>'); }

Check warning on line 72 in src/Application.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ } $output->newLine(); } else { - $output->writeln('<fg=red>' . $e->getName() . '</>'); + $output->writeln('<fg=red>' . '</>'); if (($solution = $e->getSolution()) !== null) { $output->writeln('<fg=yellow>' . $solution . '</>'); }

Check warning on line 72 in src/Application.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ } $output->newLine(); } else { - $output->writeln('<fg=red>' . $e->getName() . '</>'); + $output->writeln('<fg=red>' . '</>' . $e->getName()); if (($solution = $e->getSolution()) !== null) { $output->writeln('<fg=yellow>' . $solution . '</>'); }

Check warning on line 72 in src/Application.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ } $output->newLine(); } else { - $output->writeln('<fg=red>' . $e->getName() . '</>'); + $output->writeln('<fg=red>' . $e->getName()); if (($solution = $e->getSolution()) !== null) { $output->writeln('<fg=yellow>' . $solution . '</>'); }
if (($solution = $e->getSolution()) !== null) {
$output->writeln('<fg=yellow>' . $solution . '</>');
}
Expand All @@ -87,7 +87,7 @@
->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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/SymfonyEventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading