diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index acac9edc..e94357d9 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -26,7 +26,7 @@ $license->save(); -$config = PhpCsFixer\Config\Factory::fromRuleSet(new PhpCsFixer\Config\RuleSet\Php73($license->header())); +$config = PhpCsFixer\Config\Factory::fromRuleSet(new PhpCsFixer\Config\RuleSet\Php74($license->header())); $config->getFinder() ->exclude([ diff --git a/src/Version.php b/src/Version.php index 3eaf832d..33d89fc9 100644 --- a/src/Version.php +++ b/src/Version.php @@ -20,10 +20,8 @@ final class Version { /** * @see https://github.com/box-project/box/blob/master/doc/configuration.md#pretty-git-tag-placeholder-git - * - * @var string */ - private static $version = '@git@'; + private static string $version = '@git@'; public static function long(): string { diff --git a/test/Integration/Command/NormalizeCommand/AbstractTestCase.php b/test/Integration/Command/NormalizeCommand/AbstractTestCase.php index 3de20954..3d2626c0 100644 --- a/test/Integration/Command/NormalizeCommand/AbstractTestCase.php +++ b/test/Integration/Command/NormalizeCommand/AbstractTestCase.php @@ -29,11 +29,7 @@ abstract class AbstractTestCase extends Framework\TestCase { use Test\Util\Helper; - - /** - * @var string - */ - private $currentWorkingDirectory; + private string $currentWorkingDirectory; final protected function setUp(): void { diff --git a/test/Integration/Command/NormalizeCommand/Normalizer/Throws/Test.php b/test/Integration/Command/NormalizeCommand/Normalizer/Throws/Test.php index 8d40952a..67dc1744 100644 --- a/test/Integration/Command/NormalizeCommand/Normalizer/Throws/Test.php +++ b/test/Integration/Command/NormalizeCommand/Normalizer/Throws/Test.php @@ -52,10 +52,7 @@ public function testFailsWhenNormalizerThrowsRuntimeExceptionDuringNormalization $application = self::createApplication(new NormalizeCommand( new Factory(), new class($exceptionMessage) implements Normalizer\NormalizerInterface { - /** - * @var string - */ - private $exceptionMessage; + private string $exceptionMessage; public function __construct(string $exceptionMessage) { diff --git a/test/Util/CommandInvocation.php b/test/Util/CommandInvocation.php index 2e073fe6..589a1109 100644 --- a/test/Util/CommandInvocation.php +++ b/test/Util/CommandInvocation.php @@ -15,10 +15,7 @@ final class CommandInvocation { - /** - * @var string - */ - private $style; + private string $style; private function __construct(string $variation) { diff --git a/test/Util/Directory.php b/test/Util/Directory.php index b134bc1d..500b8f8f 100644 --- a/test/Util/Directory.php +++ b/test/Util/Directory.php @@ -15,15 +15,8 @@ final class Directory { - /** - * @var string - */ - private $path; - - /** - * @var bool - */ - private $exists; + private string $path; + private bool $exists; private function __construct(string $path) { diff --git a/test/Util/File.php b/test/Util/File.php index 39fa5304..28f4b395 100644 --- a/test/Util/File.php +++ b/test/Util/File.php @@ -15,42 +15,45 @@ final class File { - /** - * @var string - */ - private $path; - - /** - * @var bool - */ - private $exists = false; - - /** - * @var null|string - */ - private $contents; - - private function __construct() - { + private string $path; + private bool $exists; + private ?string $contents; + + private function __construct( + string $path, + bool $exists, + ?string $contents + ) { + $this->path = $path; + $this->exists = $exists; + $this->contents = $contents; } public static function fromPath(string $path): self { - $file = new self(); - - $file->path = $path; - - if (\file_exists($path)) { - $file->exists = true; + if (!\file_exists($path)) { + return new self( + $path, + false, + null, + ); + } - $contents = \file_get_contents($path); + $contents = \file_get_contents($path); - if (\is_string($contents)) { - $file->contents = $contents; - } + if (!\is_string($contents)) { + return new self( + $path, + true, + null, + ); } - return $file; + return new self( + $path, + true, + $contents, + ); } public function path(): string diff --git a/test/Util/Scenario.php b/test/Util/Scenario.php index 667ca91b..0eaeb224 100644 --- a/test/Util/Scenario.php +++ b/test/Util/Scenario.php @@ -15,15 +15,8 @@ final class Scenario { - /** - * @var CommandInvocation - */ - private $commandInvocation; - - /** - * @var State - */ - private $initialState; + private CommandInvocation $commandInvocation; + private State $initialState; private function __construct(CommandInvocation $commandInvocation, State $initialState) { diff --git a/test/Util/State.php b/test/Util/State.php index 6adf69e1..a999fc38 100644 --- a/test/Util/State.php +++ b/test/Util/State.php @@ -15,25 +15,10 @@ final class State { - /** - * @var Directory - */ - private $directory; - - /** - * @var File - */ - private $composerJsonFile; - - /** - * @var File - */ - private $composerLockFile; - - /** - * @var Directory - */ - private $vendorDirectory; + private Directory $directory; + private File $composerJsonFile; + private File $composerLockFile; + private Directory $vendorDirectory; private function __construct(Directory $directory) {