Skip to content

Commit

Permalink
use constructor property promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed May 29, 2024
1 parent dae95ce commit 05c56ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 33 deletions.
8 changes: 3 additions & 5 deletions Event/PreAssetsCompileEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
*/
class PreAssetsCompileEvent extends Event
{
private OutputInterface $output;

public function __construct(OutputInterface $output)
{
$this->output = $output;
public function __construct(
private OutputInterface $output,
) {
}

public function getOutput(): OutputInterface
Expand Down
35 changes: 7 additions & 28 deletions MappedAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,11 @@ final class MappedAsset

public readonly string $digest;
public readonly bool $isPredigested;
public readonly bool $isVendor;

/**
* Assets whose content affects the content of this asset.
*
* @var MappedAsset[]
*/
private array $dependencies = [];

/**
* @var string[]
*/
private array $fileDependencies = [];

/**
* @var JavaScriptImport[]
*/
private array $javaScriptImports = [];

/**
* @param MappedAsset[] $dependencies assets that the content of this asset depends on
* @param string[] $fileDependencies files that the content of this asset depends on
* @param MappedAsset[] $dependencies assets that the content of this asset depends on
* @param string[] $fileDependencies files that the content of this asset depends on
* @param JavaScriptImport[] $javaScriptImports
*/
public function __construct(
public readonly string $logicalPath,
Expand All @@ -65,10 +48,10 @@ public function __construct(
?string $content = null,
?string $digest = null,
?bool $isPredigested = null,
bool $isVendor = false,
array $dependencies = [],
array $fileDependencies = [],
array $javaScriptImports = [],
public readonly bool $isVendor = false,
private array $dependencies = [],
private array $fileDependencies = [],
private array $javaScriptImports = [],
) {
if (null !== $sourcePath) {
$this->sourcePath = $sourcePath;
Expand All @@ -87,10 +70,6 @@ public function __construct(
if (null !== $isPredigested) {
$this->isPredigested = $isPredigested;
}
$this->isVendor = $isVendor;
$this->dependencies = $dependencies;
$this->fileDependencies = $fileDependencies;
$this->javaScriptImports = $javaScriptImports;
}

/**
Expand Down

0 comments on commit 05c56ff

Please sign in to comment.