Skip to content

Commit aa1b606

Browse files
authored
Merge pull request #23 from samsonasik/apply-php80
Apply PHP 8.0 Syntax and constructor promotion
2 parents 4a0e201 + a6093ed commit aa1b606

File tree

6 files changed

+11
-32
lines changed

6 files changed

+11
-32
lines changed

src/AssetInstaller.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,11 @@ class AssetInstaller
3636
{
3737
use UnparseableTokensTrait;
3838

39-
/** @var Composer */
40-
private $composer;
41-
42-
/** @var IOInterface */
43-
private $io;
44-
4539
/** @var string Base path for project; default is current working dir. */
4640
private $projectPath;
4741

48-
public function __construct(Composer $composer, IOInterface $io)
42+
public function __construct(private Composer $composer, private IOInterface $io)
4943
{
50-
$this->composer = $composer;
51-
$this->io = $io;
5244
$this->projectPath = getcwd();
5345
}
5446

src/AssetUninstaller.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,14 @@ class AssetUninstaller
3232
{
3333
use UnparseableTokensTrait;
3434

35-
/** @var Composer */
36-
private $composer;
37-
3835
/** @var string[] .gitignore rules */
39-
private $gitignore = [];
40-
41-
/** @var IOInterface */
42-
private $io;
36+
private array $gitignore = [];
4337

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

47-
public function __construct(Composer $composer, IOInterface $io)
41+
public function __construct(private Composer $composer, private IOInterface $io)
4842
{
49-
$this->composer = $composer;
50-
$this->io = $io;
5143
$this->projectPath = getcwd();
5244
}
5345

src/Plugin.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,16 @@
1818

1919
class Plugin implements PluginInterface, EventSubscriberInterface
2020
{
21-
/** @var Composer */
22-
private $composer;
21+
private Composer $composer;
2322

2423
/**
2524
* Array of installers to run following a dump-autoload operation.
2625
*
2726
* @var callable[]
2827
*/
29-
private $installers = [];
28+
private array $installers = [];
3029

31-
/** @var IOInterface */
32-
private $io;
30+
private IOInterface $io;
3331

3432
/**
3533
* Provide composer event listeners.

test/AssetInstallerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ class AssetInstallerTest extends TestCase
5151
/** @var IOInterface|ObjectProphecy */
5252
private $io;
5353

54-
/** @var vfsStreamDirectory */
55-
private $filesystem;
54+
private vfsStreamDirectory $filesystem;
5655

5756
public function setUp(): void
5857
{

test/AssetUninstallerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ class AssetUninstallerTest extends TestCase
8383
],
8484
];
8585

86-
/** @var vfsStreamDirectory */
87-
private $filesystem;
86+
private vfsStreamDirectory $filesystem;
8887

8988
/** @var PackageInterface|ObjectProphecy */
9089
private $package;

test/PluginTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ class PluginTest extends TestCase
2424
use DeprecatedAssertionsTrait;
2525
use ProphecyTrait;
2626

27-
/** @var vfsStreamDirectory */
28-
private $filesystem;
27+
private vfsStreamDirectory $filesystem;
2928

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

105-
$installer1 = function () use ($spy): void {
104+
$installer1 = static function () use ($spy): void {
106105
$spy->operations[] = 'installer1';
107106
};
108-
$installer2 = function () use ($spy): void {
107+
$installer2 = static function () use ($spy): void {
109108
$spy->operations[] = 'installer2';
110109
};
111110

0 commit comments

Comments
 (0)