Skip to content
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

Update to use PHP 8.1 syntax #160

Open
wants to merge 2 commits into
base: 3.16.x
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions src/App/src/Handler/HomePageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
class HomePageHandler implements RequestHandlerInterface
{
public function __construct(
private string $containerName,
private RouterInterface $router,
private ?TemplateRendererInterface $template = null
private readonly string $containerName,
private readonly RouterInterface $router,
private readonly ?TemplateRendererInterface $template = null
) {
}

Expand Down
9 changes: 6 additions & 3 deletions src/MezzioInstaller/OptionalPackages.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class OptionalPackages
];

/** @var string Path to this file. */
private string $installerSource;
private readonly string $installerSource;

/** @var self::INSTALL_* Installation type selected. */
private string $installType = self::INSTALL_FLAT;
Expand Down Expand Up @@ -214,8 +214,11 @@ public static function install(Event $event): void
$installer->finalizePackage();
}

public function __construct(private IOInterface $io, private Composer $composer, ?string $projectRoot = null)
{
public function __construct(
private readonly IOInterface $io,
private readonly Composer $composer,
?string $projectRoot = null
) {
// Get composer.json location
$composerFile = Factory::getComposerFile();

Expand Down
16 changes: 8 additions & 8 deletions test/MezzioInstallerTest/OptionalPackagesTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public static function assertPackage(
OptionalPackages $installer,
?string $message = null
): void {
$message = $message ?? sprintf('Failed asserting that package "%s" is present in the installer', $package);
$found = false;
$message ??= sprintf('Failed asserting that package "%s" is present in the installer', $package);
$found = false;

foreach (['composerRequires', 'composerDevRequires'] as $property) {
$r = new ReflectionProperty($installer, $property);
Expand All @@ -78,8 +78,8 @@ public static function assertNotPackage(
OptionalPackages $installer,
?string $message = null
): void {
$message = $message ?? sprintf('Failed asserting that package "%s" is absent from the installer', $package);
$found = false;
$message ??= sprintf('Failed asserting that package "%s" is absent from the installer', $package);
$found = false;

foreach (['composerRequires', 'composerDevRequires'] as $property) {
$r = new ReflectionProperty($installer, $property);
Expand Down Expand Up @@ -134,8 +134,8 @@ public static function assertWhitelisted(
OptionalPackages $installer,
?string $message = null
): void {
$message = $message ?? sprintf('Failed asserting that package "%s" is whitelisted in composer.json', $package);
$found = false;
$message ??= sprintf('Failed asserting that package "%s" is whitelisted in composer.json', $package);
$found = false;

$r = new ReflectionProperty($installer, 'composerDefinition');

Expand Down Expand Up @@ -167,8 +167,8 @@ protected function tearDown(): void
*/
protected function createOptionalPackages(?string $projectRoot = null): OptionalPackages
{
$projectRoot = $projectRoot ?? $this->packageRoot;
$this->io = $this->createMock(IOInterface::class);
$projectRoot ??= $this->packageRoot;
$this->io = $this->createMock(IOInterface::class);
return new OptionalPackages(
$this->io,
$this->createComposer(),
Expand Down
Loading