From 26d1267c28ae724189e93ad856237b281678ec4a Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Wed, 18 Dec 2024 11:53:29 +0100 Subject: [PATCH] chore: phpdoc_to_property_type --- tests/Console/Command/DescribeCommandTest.php | 2 +- tests/Console/Command/SelfUpdateCommandTest.php | 5 +---- .../Report/FixReport/AbstractReporterTestCase.php | 5 +---- .../Report/FixReport/CheckstyleReporterTest.php | 4 +--- tests/Console/Report/FixReport/JunitReporterTest.php | 4 +--- tests/Console/Report/FixReport/XmlReporterTest.php | 5 +---- .../ListSetsReport/AbstractReporterTestCase.php | 5 +---- tests/DocBlock/AnnotationTest.php | 12 +++++------- tests/DocBlock/DocBlockTest.php | 4 +--- tests/DocBlock/LineTest.php | 10 ++++------ tests/FileRemovalTest.php | 4 +--- .../FunctionDeclarationFixerTest.php | 4 ++-- tests/Smoke/CiIntegrationTest.php | 5 +---- tests/Smoke/PharTest.php | 10 ++-------- tests/Test/AbstractFixerTestCase.php | 7 ++----- .../Test/AbstractFixerWithAliasedOptionsTestCase.php | 2 +- tests/Test/AbstractIntegrationTestCase.php | 10 ++-------- tests/Test/AbstractTransformerTestCase.php | 5 +---- tests/Test/TokensWithObservedTransformers.php | 7 ++----- tests/UtilsTest.php | 2 +- 20 files changed, 32 insertions(+), 80 deletions(-) diff --git a/tests/Console/Command/DescribeCommandTest.php b/tests/Console/Command/DescribeCommandTest.php index 26ed49ccf38..9c8bd41ef35 100644 --- a/tests/Console/Command/DescribeCommandTest.php +++ b/tests/Console/Command/DescribeCommandTest.php @@ -469,7 +469,7 @@ private static function createFixerWithSamplesDouble(array $samples): FixerInter /** * @var list */ - private $samples; + private array $samples; /** * @param list $samples diff --git a/tests/Console/Command/SelfUpdateCommandTest.php b/tests/Console/Command/SelfUpdateCommandTest.php index 437fa119191..179417ffc7c 100644 --- a/tests/Console/Command/SelfUpdateCommandTest.php +++ b/tests/Console/Command/SelfUpdateCommandTest.php @@ -36,10 +36,7 @@ */ final class SelfUpdateCommandTest extends TestCase { - /** - * @var null|vfsStreamDirectory - */ - private $root; + private ?vfsStreamDirectory $root = null; protected function setUp(): void { diff --git a/tests/Console/Report/FixReport/AbstractReporterTestCase.php b/tests/Console/Report/FixReport/AbstractReporterTestCase.php index f388f1fa891..b7572458d8d 100644 --- a/tests/Console/Report/FixReport/AbstractReporterTestCase.php +++ b/tests/Console/Report/FixReport/AbstractReporterTestCase.php @@ -25,10 +25,7 @@ */ abstract class AbstractReporterTestCase extends TestCase { - /** - * @var null|ReporterInterface - */ - protected $reporter; + protected ?ReporterInterface $reporter = null; protected function setUp(): void { diff --git a/tests/Console/Report/FixReport/CheckstyleReporterTest.php b/tests/Console/Report/FixReport/CheckstyleReporterTest.php index 961a494d01b..8137808b476 100644 --- a/tests/Console/Report/FixReport/CheckstyleReporterTest.php +++ b/tests/Console/Report/FixReport/CheckstyleReporterTest.php @@ -31,10 +31,8 @@ final class CheckstyleReporterTest extends AbstractReporterTestCase { /** * "checkstyle" XML schema. - * - * @var null|string */ - private static $xsd; + private static ?string $xsd = null; public static function setUpBeforeClass(): void { diff --git a/tests/Console/Report/FixReport/JunitReporterTest.php b/tests/Console/Report/FixReport/JunitReporterTest.php index a5a92acd09f..594b8e23533 100644 --- a/tests/Console/Report/FixReport/JunitReporterTest.php +++ b/tests/Console/Report/FixReport/JunitReporterTest.php @@ -33,11 +33,9 @@ final class JunitReporterTest extends AbstractReporterTestCase /** * JUnit XML schema from Jenkins. * - * @var null|string - * * @see https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd */ - private static $xsd; + private static ?string $xsd = null; public static function setUpBeforeClass(): void { diff --git a/tests/Console/Report/FixReport/XmlReporterTest.php b/tests/Console/Report/FixReport/XmlReporterTest.php index 810eab6ee99..f6c42879bf9 100644 --- a/tests/Console/Report/FixReport/XmlReporterTest.php +++ b/tests/Console/Report/FixReport/XmlReporterTest.php @@ -30,10 +30,7 @@ */ final class XmlReporterTest extends AbstractReporterTestCase { - /** - * @var null|string - */ - private static $xsd; + private static ?string $xsd = null; public static function setUpBeforeClass(): void { diff --git a/tests/Console/Report/ListSetsReport/AbstractReporterTestCase.php b/tests/Console/Report/ListSetsReport/AbstractReporterTestCase.php index afd3347d33a..9a3060ac781 100644 --- a/tests/Console/Report/ListSetsReport/AbstractReporterTestCase.php +++ b/tests/Console/Report/ListSetsReport/AbstractReporterTestCase.php @@ -27,10 +27,7 @@ */ abstract class AbstractReporterTestCase extends TestCase { - /** - * @var null|ReporterInterface - */ - protected $reporter; + protected ?ReporterInterface $reporter = null; protected function setUp(): void { diff --git a/tests/DocBlock/AnnotationTest.php b/tests/DocBlock/AnnotationTest.php index ed85dffabe3..63c2336fe67 100644 --- a/tests/DocBlock/AnnotationTest.php +++ b/tests/DocBlock/AnnotationTest.php @@ -33,10 +33,8 @@ final class AnnotationTest extends TestCase { /** * This represents the content an entire docblock. - * - * @var string */ - private static $sample = '/** + private static string $sample = '/** * Test docblock. * * @param string $hello @@ -58,7 +56,7 @@ final class AnnotationTest extends TestCase * * @var list */ - private static $content = [ + private static array $content = [ " * @param string \$hello\n", " * @param bool \$test Description\n * extends over many lines\n", " * @param adkjbadjasbdand \$asdnjkasd\n", @@ -71,21 +69,21 @@ final class AnnotationTest extends TestCase * * @var list */ - private static $start = [3, 4, 7, 9, 14]; + private static array $start = [3, 4, 7, 9, 14]; /** * This represents the start indexes of each annotation. * * @var list */ - private static $end = [3, 5, 7, 12, 14]; + private static array $end = [3, 5, 7, 12, 14]; /** * This represents the tag type of each annotation. * * @var list */ - private static $tags = ['param', 'param', 'param', 'throws', 'return']; + private static array $tags = ['param', 'param', 'param', 'throws', 'return']; /** * @dataProvider provideGetContentCases diff --git a/tests/DocBlock/DocBlockTest.php b/tests/DocBlock/DocBlockTest.php index 8dc1fbae0d4..d455196e920 100644 --- a/tests/DocBlock/DocBlockTest.php +++ b/tests/DocBlock/DocBlockTest.php @@ -28,10 +28,8 @@ final class DocBlockTest extends TestCase { /** * This represents the content an entire docblock. - * - * @var string */ - private static $sample = '/** + private static string $sample = '/** * Test docblock. * * @param string $hello diff --git a/tests/DocBlock/LineTest.php b/tests/DocBlock/LineTest.php index 28a13381909..b6904c2a042 100644 --- a/tests/DocBlock/LineTest.php +++ b/tests/DocBlock/LineTest.php @@ -29,10 +29,8 @@ final class LineTest extends TestCase { /** * This represents the content an entire docblock. - * - * @var string */ - private static $sample = '/** + private static string $sample = '/** * Test docblock. * * @param string $hello @@ -53,7 +51,7 @@ final class LineTest extends TestCase * * @var list */ - private static $content = [ + private static array $content = [ "/**\n", " * Test docblock.\n", " *\n", @@ -76,7 +74,7 @@ final class LineTest extends TestCase * * @var list */ - private static $useful = [ + private static array $useful = [ false, true, false, @@ -99,7 +97,7 @@ final class LineTest extends TestCase * * @var list */ - private static $tag = [ + private static array $tag = [ false, false, false, diff --git a/tests/FileRemovalTest.php b/tests/FileRemovalTest.php index 60f9cb4c050..d74f151939f 100644 --- a/tests/FileRemovalTest.php +++ b/tests/FileRemovalTest.php @@ -33,10 +33,8 @@ final class FileRemovalTest extends TestCase * This is necessary for testShutdownRemovesObserved files, as the setup * runs in a separate process to trigger the shutdown function, and * tearDownAfterClass is called for every separate process - * - * @var bool */ - private static $removeFilesOnTearDown = true; + private static bool $removeFilesOnTearDown = true; public static function tearDownAfterClass(): void { diff --git a/tests/Fixer/FunctionNotation/FunctionDeclarationFixerTest.php b/tests/Fixer/FunctionNotation/FunctionDeclarationFixerTest.php index 38a02aa094c..80e59f68168 100644 --- a/tests/Fixer/FunctionNotation/FunctionDeclarationFixerTest.php +++ b/tests/Fixer/FunctionNotation/FunctionDeclarationFixerTest.php @@ -35,12 +35,12 @@ final class FunctionDeclarationFixerTest extends AbstractFixerTestCase /** * @var array */ - private static $configurationClosureSpacingNone = ['closure_function_spacing' => FunctionDeclarationFixer::SPACING_NONE]; + private static array $configurationClosureSpacingNone = ['closure_function_spacing' => FunctionDeclarationFixer::SPACING_NONE]; /** * @var array */ - private static $configurationArrowSpacingNone = ['closure_fn_spacing' => FunctionDeclarationFixer::SPACING_NONE]; + private static array $configurationArrowSpacingNone = ['closure_fn_spacing' => FunctionDeclarationFixer::SPACING_NONE]; public function testInvalidConfigurationClosureFunctionSpacing(): void { diff --git a/tests/Smoke/CiIntegrationTest.php b/tests/Smoke/CiIntegrationTest.php index cb156f121b2..cabf43c1310 100644 --- a/tests/Smoke/CiIntegrationTest.php +++ b/tests/Smoke/CiIntegrationTest.php @@ -34,10 +34,7 @@ */ final class CiIntegrationTest extends AbstractSmokeTestCase { - /** - * @var string - */ - public static $fixtureDir; + public static string $fixtureDir; public static function setUpBeforeClass(): void { diff --git a/tests/Smoke/PharTest.php b/tests/Smoke/PharTest.php index 793ca36f076..b77c0333271 100644 --- a/tests/Smoke/PharTest.php +++ b/tests/Smoke/PharTest.php @@ -34,15 +34,9 @@ */ final class PharTest extends AbstractSmokeTestCase { - /** - * @var string - */ - private static $pharCwd; + private static string $pharCwd; - /** - * @var string - */ - private static $pharName; + private static string $pharName; public static function setUpBeforeClass(): void { diff --git a/tests/Test/AbstractFixerTestCase.php b/tests/Test/AbstractFixerTestCase.php index 8e5fb6304a3..51d84b075d7 100644 --- a/tests/Test/AbstractFixerTestCase.php +++ b/tests/Test/AbstractFixerTestCase.php @@ -108,15 +108,12 @@ abstract class AbstractFixerTestCase extends TestCase { use AssertTokensTrait; - /** - * @var null|LinterInterface - */ - protected $linter; + protected ?LinterInterface $linter = null; /** * @var null|TFixer */ - protected $fixer; + protected ?AbstractFixer $fixer = null; /** * do not modify this structure without prior discussion. diff --git a/tests/Test/AbstractFixerWithAliasedOptionsTestCase.php b/tests/Test/AbstractFixerWithAliasedOptionsTestCase.php index ef0a380e4b1..99429c652a3 100644 --- a/tests/Test/AbstractFixerWithAliasedOptionsTestCase.php +++ b/tests/Test/AbstractFixerWithAliasedOptionsTestCase.php @@ -32,7 +32,7 @@ abstract class AbstractFixerWithAliasedOptionsTestCase extends AbstractFixerTest /** * @var null|TFixer */ - private $fixerWithAliasedConfig; + private ?AbstractFixer $fixerWithAliasedConfig = null; protected function tearDown(): void { diff --git a/tests/Test/AbstractIntegrationTestCase.php b/tests/Test/AbstractIntegrationTestCase.php index 475faac7120..c8921d3d482 100644 --- a/tests/Test/AbstractIntegrationTestCase.php +++ b/tests/Test/AbstractIntegrationTestCase.php @@ -78,15 +78,9 @@ */ abstract class AbstractIntegrationTestCase extends TestCase { - /** - * @var null|LinterInterface - */ - protected $linter; + protected ?LinterInterface $linter = null; - /** - * @var null|FileRemoval - */ - private static $fileRemoval; + private static ?FileRemoval $fileRemoval = null; public static function setUpBeforeClass(): void { diff --git a/tests/Test/AbstractTransformerTestCase.php b/tests/Test/AbstractTransformerTestCase.php index f0ef11cb583..ac77f31cd5b 100644 --- a/tests/Test/AbstractTransformerTestCase.php +++ b/tests/Test/AbstractTransformerTestCase.php @@ -30,10 +30,7 @@ */ abstract class AbstractTransformerTestCase extends TestCase { - /** - * @var null|TransformerInterface - */ - protected $transformer; + protected ?TransformerInterface $transformer = null; protected function setUp(): void { diff --git a/tests/Test/TokensWithObservedTransformers.php b/tests/Test/TokensWithObservedTransformers.php index d4d12d0c7b4..ee0080da358 100644 --- a/tests/Test/TokensWithObservedTransformers.php +++ b/tests/Test/TokensWithObservedTransformers.php @@ -21,15 +21,12 @@ class TokensWithObservedTransformers extends Tokens { - /** - * @var null|string - */ - public $currentTransformer; + public ?string $currentTransformer = null; /** * @var array> */ - public $observedModificationsPerTransformer = []; + public array $observedModificationsPerTransformer = []; public function offsetSet($index, $newval): void { diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index 36d010b1dfd..beaf06dd3de 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -34,7 +34,7 @@ final class UtilsTest extends TestCase /** * @var null|false|string */ - private $originalValueOfFutureMode; + private null|bool|string $originalValueOfFutureMode; protected function setUp(): void {