Repository: FriendsOfPHP/PHP-CS-Fixer (php)

Issue:
class_definition not being fixed 
## Bug report

   * PHP version: `PHP 7.4.20 (cli) (built: Jun  9 2021 08:41:57) ( NTS )`
   * PHP CS Fixer version: `PHP CS Fixer 2.19.0 Testament by Fabien Potencier and Dariusz Ruminski`
   * the command used to run PHP CS Fixer: `php74 vendor/bin/php-cs-fixer fix --using-cache=no -vvv a.php` 
   * the configuration (file) you used:
   ```php
<?php

$finder = PhpCsFixer\Finder::create()
	->in(getcwd())
;

return (new PhpCsFixer\Config)
	->setRules([
		'class_definition' => true
	])
	->setRiskyAllowed(true)
	->setIndent("\t")
	->setLineEnding("\n")
	->setFinder($finder)
;
```

### Code snippet that reproduces the problem

  ```php
<?php


final class a
{
	private function init(): void
	{
		new class('test',) {
		};
	}
}
```

### Expected result

The fixes are only applied once.

### Actual result

The same exact fixes are re-applied each time, as shown by the identical output of the fixer:
```
PHP CS Fixer 2.19.0 Testament by Fabien Potencier and Dariusz Ruminski
Runtime: PHP 7.4.20
Loaded config default from "/home/daniil/repro/.php-cs-fixer.dist.php".
Paths from configuration file have been overridden by paths provided as command arguments.
F
Legend: ?-unknown, I-invalid file syntax (file ignored), S-skipped (cached or empty file), .-no changes, F-fixed, E-error
   1) repro/a.php (class_definition)
```


Pull request:
ClassDefinition - fix for anonymous class with trailing comma
Fixes #5780 

The problem was that for the code `<?php new class(1, 2, 3,) {};` space after trailing comma was added and then removed in next run and so on.

Patch:
diff --git a/README.md b/README.md
index ea45c0c49..373adfd8e 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,7 @@ If you need to apply code styles that are not supported by the tool, you can
 Dedicated plugins exist for:
 
 * [Atom](https://github.com/Glavin001/atom-beautify)
-* [NetBeans](https://plugins.netbeans.apache.org/catalogue/?id=36)
+* [NetBeans](http://plugins.netbeans.org/plugin/49042/php-cs-fixer)
 * [PhpStorm](https://medium.com/@valeryan/how-to-configure-phpstorm-to-use-php-cs-fixer-1844991e521f)
 * [Sublime Text](https://github.com/benmatselby/sublime-phpcs)
 * [Vim](https://github.com/stephpy/vim-php-cs-fixer)
diff --git a/dev-tools/composer.json b/dev-tools/composer.json
index ddc4ee878..0786b63da 100644
--- a/dev-tools/composer.json
+++ b/dev-tools/composer.json
@@ -9,8 +9,8 @@
         "maglnet/composer-require-checker": "2.0.0",
         "mi-schi/phpmd-extension": "^4.3",
         "phpmd/phpmd": "^2.10",
-        "phpstan/phpstan": "^0.12.90",
-        "phpstan/phpstan-phpunit": "^0.12.20"
+        "phpstan/phpstan": "0.12.25",
+        "phpstan/phpstan-phpunit": "0.12.11"
     },
     "config": {
         "optimize-autoloader": true,
diff --git a/doc/rules/class_notation/no_null_property_initialization.rst b/doc/rules/class_notation/no_null_property_initialization.rst
index d4c23e5b2..f29f91468 100644
--- a/doc/rules/class_notation/no_null_property_initialization.rst
+++ b/doc/rules/class_notation/no_null_property_initialization.rst
@@ -21,19 +21,6 @@ Example #1
    +    public $foo;
     }
 
-Example #2
-~~~~~~~~~~
-
-.. code-block:: diff
-
-   --- Original
-   +++ New
-    <?php
-    class Foo {
-   -    public static $foo = null;
-   +    public static $foo;
-    }
-
 Rule sets
 ---------
 
diff --git a/phpstan.neon b/phpstan.neon
index 3379ed172..ad9b782f1 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -8,15 +8,19 @@ parameters:
     paths:
         - src
         - tests
-    excludePaths:
-        - src/Event/Event.php # @TODO remove in PHP CS Fixer 3.0
-        - tests/Event/EventTest.php # @TODO remove in PHP CS Fixer 3.0
+    excludes_analyse:
         - tests/Fixtures
     ignoreErrors:
         - '/^Return typehint of method PhpCsFixer\\Tests\\Test\\.+::createIsIdenticalStringConstraint\(\) has invalid type PHPUnit_Framework_Constraint_IsIdentical\.$/'
+        - '/^Class (Symfony\\Contracts\\EventDispatcher\\Event|Symfony\\Component\\EventDispatcher\\Event) not found.$/'
+        - '/^Constant T_NAME_(RELATIVE|FULLY_QUALIFIED|QUALIFIED) not found\.$/'
+        - '/assertInstanceOf\(\) expects class-string.*, string given/'
         -
             message: '/^Unsafe usage of new static\(\)\.$/'
             path: src/Config.php
+        -
+            message: '/^Else branch is unreachable because previous condition is always true\.$/'
+            path: src/Event/Event.php
         -
             message: '/^Result of && is always false\.$/'
             path: src/Config.php
@@ -25,9 +29,13 @@ parameters:
             path: src/Config.php
         -
             message: '/^Else branch is unreachable because ternary operator condition is always true\.$/'
-            path: src/Config.php
+            paths:
+                - src/Config.php
+        -
+            message: '/^Parameter #1 \$function of function register_shutdown_function expects callable\(\): void, array\(\$this\(PhpCsFixer\\FileRemoval\), ''clean''\) given\.$/'
+            path: src/FileRemoval.php
         -
-            message: '/^Dead catch - LogicException is never thrown in the try block\.$/'
-            path: src/Test/AccessibleObject.php
+            message: '/^Constant T_ATTRIBUTE not found\.$/'
+            path: src/Tokenizer/Transformer/AttributeTransformer.php
 
     tipsOfTheDay: false
diff --git a/src/Fixer/ClassNotation/ClassDefinitionFixer.php b/src/Fixer/ClassNotation/ClassDefinitionFixer.php
index 772d423c8..d0c484cbe 100644
--- a/src/Fixer/ClassNotation/ClassDefinitionFixer.php
+++ b/src/Fixer/ClassNotation/ClassDefinitionFixer.php
@@ -372,7 +372,7 @@ private function makeClassyDefinitionSingleLine(Tokens $tokens, $startIndex, $en
                     continue;
                 }
 
-                if ($tokens[$i + 1]->equalsAny([',', '(', ')']) || $tokens[$i - 1]->equals('(')) {
+                if (!$tokens[$i - 1]->equals(',') && $tokens[$i + 1]->equalsAny([',', '(', ')']) || $tokens[$i - 1]->equals('(')) {
                     $tokens->clearAt($i);
 
                     continue;
diff --git a/src/Fixer/ClassNotation/NoNullPropertyInitializationFixer.php b/src/Fixer/ClassNotation/NoNullPropertyInitializationFixer.php
index 8971a169c..2d665c489 100644
--- a/src/Fixer/ClassNotation/NoNullPropertyInitializationFixer.php
+++ b/src/Fixer/ClassNotation/NoNullPropertyInitializationFixer.php
@@ -35,13 +35,6 @@ public function getDefinition()
 class Foo {
     public $foo = null;
 }
-'
-                ),
-                new CodeSample(
-                    '<?php
-class Foo {
-    public static $foo = null;
-}
 '
                 ),
             ]
@@ -53,7 +46,7 @@ class Foo {
      */
     public function isCandidate(Tokens $tokens)
     {
-        return $tokens->isAnyTokenKindsFound([T_CLASS, T_TRAIT]) && $tokens->isAnyTokenKindsFound([T_PUBLIC, T_PROTECTED, T_PRIVATE, T_VAR, T_STATIC]);
+        return $tokens->isAnyTokenKindsFound([T_CLASS, T_TRAIT]) && $tokens->isAnyTokenKindsFound([T_PUBLIC, T_PROTECTED, T_PRIVATE, T_VAR]);
     }
 
     /**
@@ -61,56 +54,14 @@ public function isCandidate(Tokens $tokens)
      */
     protected function applyFix(\SplFileInfo $file, Tokens $tokens)
     {
-        $inClass = [];
-        $classLevel = 0;
-
         for ($index = 0, $count = $tokens->count(); $index < $count; ++$index) {
-            if ($tokens[$index]->isClassy()) {
-                ++$classLevel;
-                $inClass[$classLevel] = 1;
-
-                $index = $tokens->getNextTokenOfKind($index, ['{']);
-
-                continue;
-            }
-
-            if (0 === $classLevel) {
-                continue;
-            }
-
-            if ($tokens[$index]->equals('{')) {
-                ++$inClass[$classLevel];
-
-                continue;
-            }
-
-            if ($tokens[$index]->equals('}')) {
-                --$inClass[$classLevel];
-
-                if (0 === $inClass[$classLevel]) {
-                    unset($inClass[$classLevel]);
-                    --$classLevel;
-                }
-
-                continue;
-            }
-
-            // Ensure we are in a class but not in a method in case there are static variables defined
-            if (1 !== $inClass[$classLevel]) {
-                continue;
-            }
-
-            if (!$tokens[$index]->isGivenKind([T_PUBLIC, T_PROTECTED, T_PRIVATE, T_VAR, T_STATIC])) {
+            if (!$tokens[$index]->isGivenKind([T_PUBLIC, T_PROTECTED, T_PRIVATE, T_VAR])) {
                 continue;
             }
 
             while (true) {
                 $varTokenIndex = $index = $tokens->getNextMeaningfulToken($index);
 
-                if ($tokens[$index]->isGivenKind(T_STATIC)) {
-                    $varTokenIndex = $index = $tokens->getNextMeaningfulToken($index);
-                }
-
                 if (!$tokens[$index]->isGivenKind(T_VARIABLE)) {
                     break;
                 }
diff --git a/src/Fixer/FunctionNotation/PhpdocToPropertyTypeFixer.php b/src/Fixer/FunctionNotation/PhpdocToPropertyTypeFixer.php
index bd539f5c4..5e7fb17f9 100644
--- a/src/Fixer/FunctionNotation/PhpdocToPropertyTypeFixer.php
+++ b/src/Fixer/FunctionNotation/PhpdocToPropertyTypeFixer.php
@@ -79,12 +79,12 @@ public function isCandidate(Tokens $tokens)
     /**
      * {@inheritdoc}
      *
-     * Must run before NoSuperfluousPhpdocTagsFixer, PhpdocAlignFixer.
+     * Must run before PhpdocAlignFixer.
      * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
      */
     public function getPriority()
     {
-        return 7;
+        return parent::getPriority();
     }
 
     protected function isSkippedType($type)
diff --git a/src/Fixer/FunctionNotation/SingleLineThrowFixer.php b/src/Fixer/FunctionNotation/SingleLineThrowFixer.php
index 31136d867..439a4a4ec 100644
--- a/src/Fixer/FunctionNotation/SingleLineThrowFixer.php
+++ b/src/Fixer/FunctionNotation/SingleLineThrowFixer.php
@@ -39,6 +39,11 @@ final class SingleLineThrowFixer extends AbstractFixer
      */
     const REMOVE_WHITESPACE_BEFORE_TOKENS = [')',  ']', ',', ';'];
 
+    /**
+     * @internal
+     */
+    const THROW_END_TOKENS = [';', '(', '{', '}'];
+
     /**
      * {@inheritdoc}
      */
@@ -67,6 +72,7 @@ public function isCandidate(Tokens $tokens)
      */
     public function getPriority()
     {
+        // must be fun before ConcatSpaceFixer
         return 36;
     }
 
@@ -80,17 +86,12 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens)
                 continue;
             }
 
-            $endCandidateIndex = $tokens->getNextMeaningfulToken($index);
+            /** @var int $endCandidateIndex */
+            $endCandidateIndex = $tokens->getNextTokenOfKind($index, self::THROW_END_TOKENS);
 
-            while (!$tokens[$endCandidateIndex]->equalsAny([')',  ']', ',', ';'])) {
-                $blockType = Tokens::detectBlockType($tokens[$endCandidateIndex]);
-                if (null !== $blockType) {
-                    if (Tokens::BLOCK_TYPE_CURLY_BRACE === $blockType['type']) {
-                        break;
-                    }
-                    $endCandidateIndex = $tokens->findBlockEnd($blockType['type'], $endCandidateIndex);
-                }
-                $endCandidateIndex = $tokens->getNextMeaningfulToken($endCandidateIndex);
+            while ($tokens[$endCandidateIndex]->equals('(')) {
+                $closingBraceIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $endCandidateIndex);
+                $endCandidateIndex = $tokens->getNextTokenOfKind($closingBraceIndex, self::THROW_END_TOKENS);
             }
 
             $this->trimNewLines($tokens, $index, $tokens->getPrevMeaningfulToken($endCandidateIndex));
diff --git a/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php b/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php
index 05246199c..65aa9ebc6 100644
--- a/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php
+++ b/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php
@@ -93,7 +93,7 @@ public function doFoo(Bar $bar, $baz /*, $qux = null */) {}
      * {@inheritdoc}
      *
      * Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, VoidReturnFixer.
-     * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, FullyQualifiedStrictTypesFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocToParamTypeFixer, PhpdocToPropertyTypeFixer, PhpdocToReturnTypeFixer, PhpdocTypesFixer.
+     * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, FullyQualifiedStrictTypesFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocToParamTypeFixer, PhpdocToReturnTypeFixer, PhpdocTypesFixer.
      */
     public function getPriority()
     {
diff --git a/src/Fixer/Whitespace/ArrayIndentationFixer.php b/src/Fixer/Whitespace/ArrayIndentationFixer.php
index 075119aa5..c0278d8d6 100644
--- a/src/Fixer/Whitespace/ArrayIndentationFixer.php
+++ b/src/Fixer/Whitespace/ArrayIndentationFixer.php
@@ -238,6 +238,10 @@ private function getPreviousNewlineTokenIndex(Tokens $tokens, $startIndex)
             if ($this->isNewLineToken($tokens, $index)) {
                 return $this->returnWithUpdateCache($startIndex, $index);
             }
+
+            if ($this->isNewLineToken($tokens, $index)) {
+                return $this->returnWithUpdateCache($startIndex, $index);
+            }
         }
 
         return $this->returnWithUpdateCache($startIndex, null);
diff --git a/src/Tokenizer/Analyzer/FunctionsAnalyzer.php b/src/Tokenizer/Analyzer/FunctionsAnalyzer.php
index 87867383a..b4c951b06 100644
--- a/src/Tokenizer/Analyzer/FunctionsAnalyzer.php
+++ b/src/Tokenizer/Analyzer/FunctionsAnalyzer.php
@@ -197,16 +197,15 @@ public function isTheSameClassCall(Tokens $tokens, $index)
         if (!$tokens->offsetExists($operatorIndex)) {
             return false;
         }
-        if (!$tokens[$operatorIndex]->isObjectOperator() && !$tokens[$operatorIndex]->isGivenKind(T_DOUBLE_COLON)) {
-            return false;
-        }
 
         $referenceIndex = $tokens->getPrevMeaningfulToken($operatorIndex);
         if (!$tokens->offsetExists($referenceIndex)) {
             return false;
         }
 
-        return $tokens[$referenceIndex]->equalsAny([[T_VARIABLE, '$this'], [T_STRING, 'self'], [T_STATIC, 'static']], false);
+        return $tokens[$operatorIndex]->isObjectOperator() && $tokens[$referenceIndex]->equals([T_VARIABLE, '$this'], false)
+            || $tokens[$operatorIndex]->isGivenKind(T_DOUBLE_COLON) && $tokens[$referenceIndex]->equals([T_STRING, 'self'], false)
+            || $tokens[$operatorIndex]->isGivenKind(T_DOUBLE_COLON) && $tokens[$referenceIndex]->equals([T_STATIC, 'static'], false);
     }
 
     private function buildFunctionsAnalysis(Tokens $tokens)
diff --git a/src/Tokenizer/TokensAnalyzer.php b/src/Tokenizer/TokensAnalyzer.php
index 1a892ed84..b07250006 100644
--- a/src/Tokenizer/TokensAnalyzer.php
+++ b/src/Tokenizer/TokensAnalyzer.php
@@ -589,6 +589,7 @@ public function isBinaryOperator($index)
                 T_SR => true,                   // >>
                 T_SR_EQUAL => true,             // >>=
                 T_XOR_EQUAL => true,            // ^=
+                CT::T_TYPE_ALTERNATION => true, // |
             ];
 
             // @TODO: drop condition when PHP 7.0+ is required


Test patch:
diff --git a/tests/AutoReview/FixerFactoryTest.php b/tests/AutoReview/FixerFactoryTest.php
index 4964b6bdd..4a51fbb21 100644
--- a/tests/AutoReview/FixerFactoryTest.php
+++ b/tests/AutoReview/FixerFactoryTest.php
@@ -244,7 +244,6 @@ public function provideFixersPriorityCases()
             [$fixers['phpdoc_to_comment'], $fixers['no_empty_comment']],
             [$fixers['phpdoc_to_comment'], $fixers['phpdoc_no_useless_inheritdoc']],
             [$fixers['phpdoc_to_param_type'], $fixers['no_superfluous_phpdoc_tags']],
-            [$fixers['phpdoc_to_property_type'], $fixers['no_superfluous_phpdoc_tags']],
             [$fixers['phpdoc_to_return_type'], $fixers['fully_qualified_strict_types']],
             [$fixers['phpdoc_to_return_type'], $fixers['no_superfluous_phpdoc_tags']],
             [$fixers['phpdoc_to_return_type'], $fixers['return_type_declaration']],
diff --git a/tests/Fixer/ClassNotation/ClassDefinitionFixerTest.php b/tests/Fixer/ClassNotation/ClassDefinitionFixerTest.php
index 71f0861cc..09bd7abfb 100644
--- a/tests/Fixer/ClassNotation/ClassDefinitionFixerTest.php
+++ b/tests/Fixer/ClassNotation/ClassDefinitionFixerTest.php
@@ -628,17 +628,17 @@ public function provideClassyInheritanceInfo7Cases()
      * @param string      $expected
      * @param null|string $input
      *
-     * @dataProvider providePHP7Cases
+     * @dataProvider providePHP70Cases
      * @requires PHP 7.0
      */
-    public function testFixPHP7($expected, $input = null)
+    public function testFixPHP70($expected, $input = null)
     {
         $this->fixer->configure([]);
 
         $this->doTest($expected, $input);
     }
 
-    public function providePHP7Cases()
+    public function providePHP70Cases()
     {
         return [
             [
@@ -674,6 +674,37 @@ public function providePHP7Cases()
         ];
     }
 
+    /**
+     * @param string $expected
+     * @param string $input
+     *
+     * @dataProvider providePHP73Cases
+     * @requires PHP 7.3
+     */
+    public function testFixPHP73($expected, $input)
+    {
+        $this->fixer->configure([]);
+        $this->doTest($expected, $input);
+    }
+
+    public function providePHP73Cases()
+    {
+        return [
+            [
+                '<?php new class(1, 2, 3, ) {};',
+                '<?php new class(1, 2, 3,) {};',
+            ],
+            [
+                '<?php new class(1, 2, 3, ) {};',
+                '<?php new class(
+                    1,
+                    2,
+                    3,
+                ) {};',
+            ],
+        ];
+    }
+
     /**
      * @param string      $expected
      * @param null|string $input
diff --git a/tests/Fixer/ClassNotation/NoNullPropertyInitializationFixerTest.php b/tests/Fixer/ClassNotation/NoNullPropertyInitializationFixerTest.php
index fbf4741e0..0ebe24ac6 100644
--- a/tests/Fixer/ClassNotation/NoNullPropertyInitializationFixerTest.php
+++ b/tests/Fixer/ClassNotation/NoNullPropertyInitializationFixerTest.php
@@ -133,117 +133,11 @@ public function provideFixCases()
 =#12
 null;#13
 }
-',
-            ],
-            [
-                '<?php class Foo { public static $bar; }',
-                '<?php class Foo { public static $bar = null; }',
-            ],
-            [
-                '<?php class Foo { protected static $bar; }',
-                '<?php class Foo { protected static $bar = null; }',
-            ],
-            [
-                '<?php class Foo { private static $bar; }',
-                '<?php class Foo { private static $bar = null; }',
-            ],
-            [
-                '<?php class Foo { static $bar; }',
-                '<?php class Foo { static $bar = null; }',
-            ],
-            [
-                '<?php class Foo { STATIC $bar; }',
-                '<?php class Foo { STATIC $bar = null; }',
-            ],
-            [
-                '<?php class Foo { public static $bar; }',
-                '<?php class Foo { public static $bar = NULL; }',
-            ],
-            [
-                '<?php class Foo { PUblic STatic $bar; }',
-                '<?php class Foo { PUblic STatic $bar = nuLL; }',
-            ],
-            [
-                '<?php trait Foo { public static $bar; }',
-                '<?php trait Foo { public static $bar = nuLL; }',
-            ],
-            [
-                '<?php class Foo { public static $bar; }',
-                '<?php class Foo { public static $bar = \null; }',
-            ],
-            [
-                '<?php class Foo {/* */public/* */static/* A */$bar/* B *//** C */;/* D */}',
-                '<?php class Foo {/* */public/* */static/* A */$bar/* B */=/** C */null;/* D */}',
-            ],
-            [
-                '<?php class Foo { public static $bar; protected static $baz; }',
-                '<?php class Foo { public static $bar = null; protected static $baz = null; }',
-            ],
-            [
-                '<?php class Foo { public static $bar = \'null\'; }',
-            ],
-            [
-                '<?php class Foo { public static function bar() { return null; } }',
-            ],
-            [
-                '<?php class Foo { protected static $bar, $baz, $qux; }',
-                '<?php class Foo { protected static $bar = null, $baz = null, $qux = null; }',
-            ],
-            [
-                '<?php class Foo { protected static $bar, $baz = \'baz\', $qux; }',
-                '<?php class Foo { protected static $bar, $baz = \'baz\', $qux = null; }',
-            ],
-            [
-                '<?php trait Foo { public static $bar; } abstract class Bar { protected static $bar, $baz = \'baz\', $qux; }',
-                '<?php trait Foo { public static $bar = null; } abstract class Bar { protected static $bar, $baz = \'baz\', $qux = null; }',
-            ],
-            [
-                '<?php class Foo { public function foo() { return null; } public static $bar; public function baz() { return null; } }',
-                '<?php class Foo { public function foo() { return null; } public static $bar = null; public function baz() { return null; } }',
-            ],
-            [
-                '<?php class#1
-Foo#2
-{#3
-protected#4
-static#4.5
-$bar#5
-#6
-,#7
-$baz#8
-#9
-,#10
-$qux#11
-#12
-;#13
-}
-',
-                '<?php class#1
-Foo#2
-{#3
-protected#4
-static#4.5
-$bar#5
-=#6
-null,#7
-$baz#8
-=#9
-null,#10
-$qux#11
-=#12
-null;#13
-}
 ',
             ],
             [
                 '<?php class Foo { const FOO = null; }',
             ],
-            [
-                '<?php class Foo { public function foo() { static $foo = null; } }',
-            ],
-            [
-                '<?php function foo() { static $foo = null; }',
-            ],
         ];
     }
 
@@ -274,24 +168,6 @@ public function providePhp70Cases()
                 '<?php class Foo { public function foo() { return new class() { private $bar; }; } } trait Baz { public $baz; }',
                 '<?php class Foo { public function foo() { return new class() { private $bar = null; }; } } trait Baz { public $baz = null; }',
             ],
-            [
-                '<?php new class () { public static $bar; };',
-                '<?php new class () { public static $bar = null; };',
-            ],
-            [
-                '<?php class Foo { public function foo() { return new class() { private static $bar; }; } }',
-                '<?php class Foo { public function foo() { return new class() { private static $bar = null; }; } }',
-            ],
-            [
-                '<?php class Foo { public function foo() { return new class() { private static $bar; }; } } trait Baz { public static $baz; }',
-                '<?php class Foo { public function foo() { return new class() { private static $bar = null; }; } } trait Baz { public static $baz = null; }',
-            ],
-            [
-                '<?php class Foo { public function foo() { return new class() { public function foo() { static $foo = null; } }; } }',
-            ],
-            [
-                '<?php function foo() { return new class() { public function foo() { static $foo = null; } }; }',
-            ],
         ];
     }
 
@@ -339,16 +215,6 @@ public function provideFix74Cases()
         yield [
             '<?php class Foo { protected ? array $bar = null; }',
         ];
-
-        yield [
-            '<?php class Foo { protected static ?int $bar = null; }',
-        ];
-        yield [
-            '<?php class Foo { protected static ? string $bar = null; }',
-        ];
-        yield [
-            '<?php class Foo { protected static ? array $bar = null; }',
-        ];
     }
 
     /**
@@ -375,16 +241,6 @@ public function provideFixPrePHP80Cases()
             '<?php class Foo { public $bar/* oh hai! */; }',
             '<?php class Foo { public $bar = \/* oh hai! */null; }',
         ];
-
-        yield [
-            '<?php class Foo { public static $bar; }',
-            '<?php class Foo { public static $bar = \     null; }',
-        ];
-
-        yield [
-            '<?php class Foo { public static $bar/* oh hai! */; }',
-            '<?php class Foo { public static $bar = \/* oh hai! */null; }',
-        ];
     }
 
     /**
diff --git a/tests/Fixer/FunctionNotation/SingleLineThrowFixerTest.php b/tests/Fixer/FunctionNotation/SingleLineThrowFixerTest.php
index 3ef4e7894..06580d62b 100644
--- a/tests/Fixer/FunctionNotation/SingleLineThrowFixerTest.php
+++ b/tests/Fixer/FunctionNotation/SingleLineThrowFixerTest.php
@@ -293,23 +293,6 @@ function
                     default => throw new \NotOneOrTwo()
                 };
             '];
-
-            yield ['<?php
-                match ($number) {
-                    1 => $function->one(),
-                    2 => throw new Exception("Number 2 is not allowed."),
-                    1 => $function->three(),
-                    default => throw new \NotOneOrTwo()
-                };
-            '];
-
-            yield [
-                '<?php throw new Exception(match ($a) { 1 => "a", 3 => "b" });',
-                '<?php throw new Exception(match ($a) {
-                    1 => "a",
-                    3 => "b"
-                });',
-            ];
         }
     }
 }
diff --git a/tests/Fixer/Operator/BinaryOperatorSpacesFixerTest.php b/tests/Fixer/Operator/BinaryOperatorSpacesFixerTest.php
index 4337988f5..3a71b4342 100644
--- a/tests/Fixer/Operator/BinaryOperatorSpacesFixerTest.php
+++ b/tests/Fixer/Operator/BinaryOperatorSpacesFixerTest.php
@@ -2118,11 +2118,12 @@ function A(){}[$a] = $a[$c];
                 ['operators' => ['=>' => BinaryOperatorSpacesFixer::ALIGN_SINGLE_SPACE_MINIMAL]],
             ],
             'multiple exceptions catch, default config' => [
+                '<?php try {} catch (A | B $e) {}',
                 '<?php try {} catch (A   |     B $e) {}',
             ],
             'multiple exceptions catch, no space config' => [
+                '<?php try {} catch (A|B $e) {}',
                 '<?php try {} catch (A   |     B $e) {}',
-                null,
                 ['operators' => ['|' => BinaryOperatorSpacesFixer::NO_SPACE]],
             ],
         ];
@@ -2166,21 +2167,4 @@ public function provideFixPhp74Cases()
             ],
         ];
     }
-
-    /**
-     * @requires PHP 8.0
-     */
-    public function testUnionTypesAreNotChanged()
-    {
-        $this->doTest(
-            '<?php
-            class Foo
-            {
-                private bool|int | string $prop;
-                public function bar(TypeA | TypeB|TypeC $x): TypeA|TypeB | TypeC|TypeD
-                {
-                }
-            }'
-        );
-    }
 }
diff --git a/tests/Fixer/PhpUnit/PhpUnitTestCaseStaticMethodCallsFixerTest.php b/tests/Fixer/PhpUnit/PhpUnitTestCaseStaticMethodCallsFixerTest.php
index 1996ece88..2a6ce2548 100644
--- a/tests/Fixer/PhpUnit/PhpUnitTestCaseStaticMethodCallsFixerTest.php
+++ b/tests/Fixer/PhpUnit/PhpUnitTestCaseStaticMethodCallsFixerTest.php
@@ -480,24 +480,6 @@ abstract public static function dataProvider();
                     'call_type' => PhpUnitTestCaseStaticMethodCallsFixer::CALL_TYPE_THIS,
                 ],
             ],
-            'handle $this with double colon following' => [
-                '<?php
-                class FooTest extends TestCase
-                {
-                    public function testFoo()
-                    {
-                        static::assertTrue(true);
-                    }
-                }',
-                '<?php
-                class FooTest extends TestCase
-                {
-                    public function testFoo()
-                    {
-                        $this::assertTrue(true);
-                    }
-                }',
-            ],
         ];
     }
 
diff --git a/tests/Fixtures/Integration/misc/PHP8_0.test b/tests/Fixtures/Integration/misc/PHP8_0.test
index f5b21fd42..7acc7fb43 100644
--- a/tests/Fixtures/Integration/misc/PHP8_0.test
+++ b/tests/Fixtures/Integration/misc/PHP8_0.test
@@ -57,14 +57,14 @@ $object = new #[ExampleAttribute] class()
 // https://wiki.php.net/rfc/union_types_v2
 class Number
 {
-    private int|float|null $number;
+    private int | float | null $number;
 
     public function setNumber(int | float $number): void
     {
         $this->number = $number;
     }
 
-    public function getNumber(): int|float | null
+    public function getNumber(): int | float | null
     {
         return $this->number;
     }
@@ -234,12 +234,12 @@ class Number
 {
     private int|float|null $number;
 
-    public function setNumber(int | float $number): void
+    public function setNumber(int|float $number): void
     {
         $this->number = $number;
     }
 
-    public function getNumber(): int|float | null
+    public function getNumber(): int|float|null
     {
         return $this->number;
     }
diff --git a/tests/Fixtures/Integration/priority/phpdoc_to_property_type,no_superfluous_phpdoc_tags.test b/tests/Fixtures/Integration/priority/phpdoc_to_property_type,no_superfluous_phpdoc_tags.test
deleted file mode 100644
index bb8ce3108..000000000
--- a/tests/Fixtures/Integration/priority/phpdoc_to_property_type,no_superfluous_phpdoc_tags.test
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Integration of fixers: phpdoc_to_property_type,no_superfluous_phpdoc_tags.
---RULESET--
-{"phpdoc_to_property_type": true, "no_superfluous_phpdoc_tags": true}
---REQUIREMENTS--
-{"php": 70400}
---EXPECT--
-<?php
-
-class Test {
-    /**
-     */
-    private int $foo;
-}
-
---INPUT--
-<?php
-
-class Test {
-    /**
-     * @var int
-     */
-    private $foo;
-}
diff --git a/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php b/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php
index f8b4d03c9..b60179592 100644
--- a/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php
+++ b/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php
@@ -786,12 +786,6 @@ public function methodOne() {
                 24,
             ];
         }
-
-        yield [
-            true,
-            sprintf($template, '$this::'),
-            24,
-        ];
     }
 
     /**
diff --git a/tests/Tokenizer/TokensAnalyzerTest.php b/tests/Tokenizer/TokensAnalyzerTest.php
index cf053dd51..be319c6a3 100644
--- a/tests/Tokenizer/TokensAnalyzerTest.php
+++ b/tests/Tokenizer/TokensAnalyzerTest.php
@@ -1525,7 +1525,7 @@ public function provideIsBinaryOperator71Cases()
         return [
             [
                 '<?php try {} catch (A | B $e) {}',
-                [11 => false],
+                [11 => true],
             ],
         ];
     }