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

Apply PHP 8.0 Syntax and constructor promotion #23

Merged
merged 1 commit into from
Jan 9, 2023
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
10 changes: 1 addition & 9 deletions src/AssetInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,11 @@ class AssetInstaller
{
use UnparseableTokensTrait;

/** @var Composer */
private $composer;

/** @var IOInterface */
private $io;

/** @var string Base path for project; default is current working dir. */
private $projectPath;

public function __construct(Composer $composer, IOInterface $io)
public function __construct(private Composer $composer, private IOInterface $io)
{
$this->composer = $composer;
$this->io = $io;
$this->projectPath = getcwd();
}

Expand Down
12 changes: 2 additions & 10 deletions src/AssetUninstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,14 @@ class AssetUninstaller
{
use UnparseableTokensTrait;

/** @var Composer */
private $composer;

/** @var string[] .gitignore rules */
private $gitignore = [];

/** @var IOInterface */
private $io;
private array $gitignore = [];

/** @var string Base path for project; default is current working dir. */
private $projectPath;

public function __construct(Composer $composer, IOInterface $io)
public function __construct(private Composer $composer, private IOInterface $io)
{
$this->composer = $composer;
$this->io = $io;
$this->projectPath = getcwd();
}

Expand Down
8 changes: 3 additions & 5 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@

class Plugin implements PluginInterface, EventSubscriberInterface
{
/** @var Composer */
private $composer;
private Composer $composer;

/**
* Array of installers to run following a dump-autoload operation.
*
* @var callable[]
*/
private $installers = [];
private array $installers = [];

/** @var IOInterface */
private $io;
private IOInterface $io;

/**
* Provide composer event listeners.
Expand Down
3 changes: 1 addition & 2 deletions test/AssetInstallerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ class AssetInstallerTest extends TestCase
/** @var IOInterface|ObjectProphecy */
private $io;

/** @var vfsStreamDirectory */
private $filesystem;
private vfsStreamDirectory $filesystem;

public function setUp(): void
{
Expand Down
3 changes: 1 addition & 2 deletions test/AssetUninstallerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ class AssetUninstallerTest extends TestCase
],
];

/** @var vfsStreamDirectory */
private $filesystem;
private vfsStreamDirectory $filesystem;

/** @var PackageInterface|ObjectProphecy */
private $package;
Expand Down
7 changes: 3 additions & 4 deletions test/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class PluginTest extends TestCase
use DeprecatedAssertionsTrait;
use ProphecyTrait;

/** @var vfsStreamDirectory */
private $filesystem;
private vfsStreamDirectory $filesystem;

/** @var Composer|ObjectProphecy */
private $composer;
Expand Down Expand Up @@ -102,10 +101,10 @@ public function testOnPostAutoloadDumpTriggersInstallers(): void
/** @psalm-var object{operations: array<array-key,string>} $obj */
$spy = (object) ['operations' => []];

$installer1 = function () use ($spy): void {
$installer1 = static function () use ($spy): void {
$spy->operations[] = 'installer1';
};
$installer2 = function () use ($spy): void {
$installer2 = static function () use ($spy): void {
$spy->operations[] = 'installer2';
};

Expand Down