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

Issue:
class_attributes_separation doesn't consider trait usages
## Bug report

The rule `class_attributes_separation` doesn't consider trait `use` statements for blank line seperation.

   * PHP version: `7.4.12`
   * PHP CS Fixer version: `PHP CS Fixer 2.18.2 Remote Void by Fabien Potencier and Dariusz Ruminski`

<!--
  Before reporting a bug, make sure PHP CS Fixer is up-to-date.

  Please describe the problem and provide technical details such as:
   * PHP version: php -v
   * PHP CS Fixer version: php-cs-fixer -V
   * the command used to run PHP CS Fixer (run with `-vvv`)
   * the configuration (file) you used
-->

### Code snippet that reproduces the problem

```php
class MyClass {
    use MyTrait;
    public const MY_VAR = 1;
    public functionmyFunction() { return true; }
}
```

### Expected

```php
class MyClass
{
    use MyTrait;

    public const MY_VAR = 1;

    public function myFunction()
    {
        return true;
    }
}
```

### Actual

```php
class MyClass
{
    use MyTrait;
    public const MY_VAR = 1;

    public function myFunction()
    {
        return true;
    }
}
```

Note that PHP CS Fixer won't remove the blank line if it's added manually.

<!--
  Provide a minimal code snippet before running PHP CS Fixer. If relevant,
  also provide the expected output, the actual output and/or the error that
  occurred, if any.

  Please use markdown syntax for each code snippet, e.g.:

  ```php
  <?php

class
  ```
-->


Pull request:
ClassAttributesSeparationFixer - Add `trait_import` support
closes #5490

Patch:
diff --git a/doc/rules/class_notation/class_attributes_separation.rst b/doc/rules/class_notation/class_attributes_separation.rst
index baa1c5c14..fe7087dd0 100644
--- a/doc/rules/class_notation/class_attributes_separation.rst
+++ b/doc/rules/class_notation/class_attributes_separation.rst
@@ -11,11 +11,11 @@ Configuration
 ``elements``
 ~~~~~~~~~~~~
 
-Dictionary of ``const|method|property`` => ``none|one`` values.
+Dictionary of ``const|method|property|trait_import`` => ``none|one`` values.
 
 Allowed types: ``array``
 
-Default value: ``['const' => 'one', 'method' => 'one', 'property' => 'one']``
+Default value: ``['const' => 'one', 'method' => 'one', 'property' => 'one', 'trait_import' => 'one']``
 
 Examples
 --------
diff --git a/src/Fixer/ClassNotation/ClassAttributesSeparationFixer.php b/src/Fixer/ClassNotation/ClassAttributesSeparationFixer.php
index 6f6806c0d..6e31f13b7 100644
--- a/src/Fixer/ClassNotation/ClassAttributesSeparationFixer.php
+++ b/src/Fixer/ClassNotation/ClassAttributesSeparationFixer.php
@@ -55,7 +55,7 @@ final class ClassAttributesSeparationFixer extends AbstractFixer implements Conf
     /**
      * @internal
      */
-    const SUPPORTED_TYPES = ['const', 'method', 'property'];
+    const SUPPORTED_TYPES = ['const', 'method', 'property', 'trait_import'];
 
     /**
      * @var array<string, string>
@@ -70,6 +70,7 @@ public function configure(array $configuration = null)
         parent::configure($configuration);
 
         $this->classElementTypes = []; // reset previous configuration
+
         foreach ($this->configuration['elements'] as $elementType => $spacing) {
             $this->classElementTypes[$elementType] = $spacing;
         }
@@ -150,7 +151,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens)
         $tokensAnalyzer = new TokensAnalyzer($tokens);
         $class = $classStart = $classEnd = false;
 
-        foreach (array_reverse($tokensAnalyzer->getClassyElements(), true) as $index => $element) {
+        foreach (array_reverse($tokensAnalyzer->getClassyElements(true), true) as $index => $element) {
             if (!isset($this->classElementTypes[$element['type']])) {
                 continue; // not configured to be fixed
             }
@@ -190,7 +191,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens)
     protected function createConfigurationDefinition()
     {
         return new FixerConfigurationResolver([
-            (new FixerOptionBuilder('elements', 'Dictionary of `const|method|property` => `none|one` values.'))
+            (new FixerOptionBuilder('elements', 'Dictionary of `const|method|property|trait_import` => `none|one` values.'))
                 ->setNormalizer(static function (Options $options, $values) {
                     $deprecated = array_intersect($values, self::SUPPORTED_TYPES);
                     if (\count($deprecated) > 0) {
@@ -239,6 +240,7 @@ protected function createConfigurationDefinition()
                     'const' => self::SPACING_ONE,
                     'method' => self::SPACING_ONE,
                     'property' => self::SPACING_ONE,
+                    'trait_import' => self::SPACING_ONE,
                 ])
                 ->getOption(),
         ]);
@@ -316,7 +318,7 @@ private function fixSpaceAboveClassElement(Tokens $tokens, $classStartIndex, $el
         $firstElementAttributeIndex = $elementIndex;
 
         for ($i = $elementIndex; $i > $classStartIndex; --$i) {
-            $nonWhiteAbove = $tokens->getNonWhitespaceSibling($i, -1);
+            $nonWhiteAbove = $tokens->getPrevNonWhitespace($i);
 
             if (null !== $nonWhiteAbove && $tokens[$nonWhiteAbove]->isGivenKind($methodAttr)) {
                 $firstElementAttributeIndex = $nonWhiteAbove;
@@ -325,7 +327,7 @@ private function fixSpaceAboveClassElement(Tokens $tokens, $classStartIndex, $el
             }
         }
 
-        // deal with comments above a element
+        // deal with comments above an element
         if ($tokens[$nonWhiteAbove]->isGivenKind(T_COMMENT)) {
             if (1 === $firstElementAttributeIndex - $nonWhiteAbove) {
                 // no white space found between comment and element start
@@ -349,7 +351,7 @@ private function fixSpaceAboveClassElement(Tokens $tokens, $classStartIndex, $el
                 $this->correctLineBreaks($tokens, $nonWhiteAbove, $firstElementAttributeIndex, 1);
                 //    ... and make sure there is blank line above the comment (with the exception when it is directly after a class opening)
                 $nonWhiteAbove = $this->findCommentBlockStart($tokens, $nonWhiteAbove);
-                $nonWhiteAboveComment = $tokens->getNonWhitespaceSibling($nonWhiteAbove, -1);
+                $nonWhiteAboveComment = $tokens->getPrevNonWhitespace($nonWhiteAbove);
 
                 $this->correctLineBreaks($tokens, $nonWhiteAboveComment, $nonWhiteAbove, $nonWhiteAboveComment === $classStartIndex ? 1 : 2);
             } else {
@@ -367,7 +369,7 @@ private function fixSpaceAboveClassElement(Tokens $tokens, $classStartIndex, $el
             $this->correctLineBreaks($tokens, $nonWhiteAbove, $firstElementAttributeIndex, 1);
 
             // there should be one blank line between the PHPDoc and whatever is above (with the exception when it is directly after a class opening)
-            $nonWhiteAbovePHPDoc = $tokens->getNonWhitespaceSibling($nonWhiteAbove, -1);
+            $nonWhiteAbovePHPDoc = $tokens->getPrevNonWhitespace($nonWhiteAbove);
             $this->correctLineBreaks($tokens, $nonWhiteAbovePHPDoc, $nonWhiteAbove, $nonWhiteAbovePHPDoc === $classStartIndex ? 1 : 2);
 
             return;
@@ -380,7 +382,7 @@ private function fixSpaceAboveClassElement(Tokens $tokens, $classStartIndex, $el
 
             // make sure there is blank line above the comment (with the exception when it is directly after a class opening)
             $nonWhiteAbove = $this->findAttributeBlockStart($tokens, $nonWhiteAbove);
-            $nonWhiteAboveComment = $tokens->getNonWhitespaceSibling($nonWhiteAbove, -1);
+            $nonWhiteAboveComment = $tokens->getPrevNonWhitespace($nonWhiteAbove);
 
             $this->correctLineBreaks($tokens, $nonWhiteAboveComment, $nonWhiteAbove, $nonWhiteAboveComment === $classStartIndex ? 1 : 2);
 
diff --git a/src/Fixer/ControlStructure/YodaStyleFixer.php b/src/Fixer/ControlStructure/YodaStyleFixer.php
index aecad87e8..486e8ba79 100644
--- a/src/Fixer/ControlStructure/YodaStyleFixer.php
+++ b/src/Fixer/ControlStructure/YodaStyleFixer.php
@@ -372,7 +372,7 @@ private function getCompareFixableInfo(Tokens $tokens, $index, $yoda)
         $left = $this->getLeftSideCompareFixableInfo($tokens, $index);
         $right = $this->getRightSideCompareFixableInfo($tokens, $index);
 
-        if (!$yoda && $this->isOfLowerPrecedenceAssignment($tokens[$tokens->getNextMeaningfulToken($right['end'])])) {
+        if (!$yoda && $tokens[$tokens->getNextMeaningfulToken($right['end'])]->equals('=')) {
             return null;
         }
 
@@ -457,27 +457,44 @@ private function isOfLowerPrecedence(Token $token)
 
         if (null === $tokens) {
             $tokens = [
+                T_AND_EQUAL,    // &=
                 T_BOOLEAN_AND,  // &&
                 T_BOOLEAN_OR,   // ||
                 T_CASE,         // case
+                T_CONCAT_EQUAL, // .=
+                T_DIV_EQUAL,    // /=
                 T_DOUBLE_ARROW, // =>
                 T_ECHO,         // echo
                 T_GOTO,         // goto
                 T_LOGICAL_AND,  // and
                 T_LOGICAL_OR,   // or
                 T_LOGICAL_XOR,  // xor
+                T_MINUS_EQUAL,  // -=
+                T_MOD_EQUAL,    // %=
+                T_MUL_EQUAL,    // *=
                 T_OPEN_TAG,     // <?php
                 T_OPEN_TAG_WITH_ECHO,
+                T_OR_EQUAL,     // |=
+                T_PLUS_EQUAL,   // +=
+                T_POW_EQUAL,    // **=
                 T_PRINT,        // print
                 T_RETURN,       // return
+                T_SL_EQUAL,     // <<=
+                T_SR_EQUAL,     // >>=
                 T_THROW,        // throw
-                T_YIELD,        // yield
+                T_XOR_EQUAL,    // ^=
+                T_YIELD,
             ];
 
             // @TODO: drop condition when PHP 7.0+ is required
             if (\defined('T_COALESCE')) {
                 $tokens[] = T_COALESCE; // ??
             }
+
+            // @TODO: drop condition when PHP 7.4+ is required
+            if (\defined('T_COALESCE_EQUAL')) {
+                $tokens[] = T_COALESCE_EQUAL; // ??=
+            }
         }
 
         static $otherTokens = [
@@ -485,44 +502,13 @@ private function isOfLowerPrecedence(Token $token)
             '&', '|', '^',
             // ternary operators
             '?', ':',
+            // assignment
+            '=',
             // end of PHP statement
             ',', ';',
         ];
 
-        return $this->isOfLowerPrecedenceAssignment($token) || $token->isGivenKind($tokens) || $token->equalsAny($otherTokens);
-    }
-
-    /**
-     * Checks whether the given assignment token has a lower precedence than `T_IS_EQUAL`
-     * or `T_IS_IDENTICAL`.
-     */
-    private function isOfLowerPrecedenceAssignment(Token $token)
-    {
-        static $tokens;
-
-        if (null === $tokens) {
-            $tokens = [
-                T_AND_EQUAL,    // &=
-                T_CONCAT_EQUAL, // .=
-                T_DIV_EQUAL,    // /=
-                T_MINUS_EQUAL,  // -=
-                T_MOD_EQUAL,    // %=
-                T_MUL_EQUAL,    // *=
-                T_OR_EQUAL,     // |=
-                T_PLUS_EQUAL,   // +=
-                T_POW_EQUAL,    // **=
-                T_SL_EQUAL,     // <<=
-                T_SR_EQUAL,     // >>=
-                T_XOR_EQUAL,    // ^=
-            ];
-
-            // @TODO: drop condition when PHP 7.4+ is required
-            if (\defined('T_COALESCE_EQUAL')) {
-                $tokens[] = T_COALESCE_EQUAL; // ??=
-            }
-        }
-
-        return $token->equals('=') || $token->isGivenKind($tokens);
+        return $token->isGivenKind($tokens) || $token->equalsAny($otherTokens);
     }
 
     /**
diff --git a/src/Fixer/NamespaceNotation/SingleBlankLineBeforeNamespaceFixer.php b/src/Fixer/NamespaceNotation/SingleBlankLineBeforeNamespaceFixer.php
index b9180f7a0..4b0a9a7a5 100644
--- a/src/Fixer/NamespaceNotation/SingleBlankLineBeforeNamespaceFixer.php
+++ b/src/Fixer/NamespaceNotation/SingleBlankLineBeforeNamespaceFixer.php
@@ -46,6 +46,8 @@ public function isCandidate(Tokens $tokens)
 
     /**
      * {@inheritdoc}
+     *
+     * Must run after NoBlankLinesAfterPhpdocFixer.
      */
     public function getPriority()
     {
diff --git a/src/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixer.php b/src/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixer.php
index ddb146ff6..4bb68efb5 100644
--- a/src/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixer.php
+++ b/src/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixer.php
@@ -57,7 +57,7 @@ class Bar {}
     /**
      * {@inheritdoc}
      *
-     * Must run before HeaderCommentFixer, PhpdocAlignFixer.
+     * Must run before HeaderCommentFixer, PhpdocAlignFixer, SingleBlankLineBeforeNamespaceFixer.
      * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
      */
     public function getPriority()
@@ -71,17 +71,16 @@ public function getPriority()
     protected function applyFix(\SplFileInfo $file, Tokens $tokens)
     {
         static $forbiddenSuccessors = [
-            T_BREAK,
-            T_COMMENT,
-            T_CONTINUE,
-            T_DECLARE,
             T_DOC_COMMENT,
-            T_GOTO,
-            T_NAMESPACE,
+            T_COMMENT,
+            T_WHITESPACE,
             T_RETURN,
             T_THROW,
+            T_GOTO,
+            T_CONTINUE,
+            T_BREAK,
+            T_DECLARE,
             T_USE,
-            T_WHITESPACE,
         ];
 
         foreach ($tokens as $index => $token) {
diff --git a/src/Tokenizer/Transformer/TypeAlternationTransformer.php b/src/Tokenizer/Transformer/TypeAlternationTransformer.php
index 9e256580d..747d6389c 100644
--- a/src/Tokenizer/Transformer/TypeAlternationTransformer.php
+++ b/src/Tokenizer/Transformer/TypeAlternationTransformer.php
@@ -53,53 +53,70 @@ public function process(Tokens $tokens, Token $token, $index)
             return;
         }
 
-        $prevIndex = $tokens->getTokenNotOfKindsSibling($index, -1, [T_NS_SEPARATOR, T_STRING, CT::T_ARRAY_TYPEHINT, T_WHITESPACE, T_COMMENT, T_DOC_COMMENT]);
+        $prevIndex = $tokens->getPrevMeaningfulToken($index);
+
+        if (!$tokens[$prevIndex]->isGivenKind([T_STRING, CT::T_ARRAY_TYPEHINT])) {
+            return;
+        }
+
+        do {
+            $prevIndex = $tokens->getPrevMeaningfulToken($prevIndex);
+
+            if (null === $prevIndex) {
+                return;
+            }
+
+            if (!$tokens[$prevIndex]->isGivenKind([T_NS_SEPARATOR, T_STRING])) {
+                break;
+            }
+        } while (true);
 
         /** @var Token $prevToken */
         $prevToken = $tokens[$prevIndex];
 
         if ($prevToken->isGivenKind([
-            CT::T_TYPE_COLON, // `:` is part of a function return type `foo(): X|Y`
-            CT::T_TYPE_ALTERNATION, // `|` is part of a union (chain) `X|Y`
-            T_STATIC, T_VAR, T_PUBLIC, T_PROTECTED, T_PRIVATE, // `var X|Y $a;`, `private X|Y $a` or `public static X|Y $a`
+            CT::T_TYPE_COLON, // `:` is part of a function return type `foo(): A`
+            CT::T_TYPE_ALTERNATION, // `|` is part of a union (chain) `X | Y`
+            T_STATIC, T_VAR, T_PUBLIC, T_PROTECTED, T_PRIVATE, // `var $a;`, `private $a` or `public static $a`
         ])) {
             $this->replaceToken($tokens, $index);
 
             return;
         }
 
-        if (!$prevToken->equalsAny(['(', ','])) {
+        if (!$prevToken->equals('(')) {
             return;
         }
 
         $prevPrevTokenIndex = $tokens->getPrevMeaningfulToken($prevIndex);
 
-        if ($tokens[$prevPrevTokenIndex]->isGivenKind([T_CATCH])) {
+        /** @var Token $prePrevToken */
+        $prePrevToken = $tokens[$prevPrevTokenIndex];
+
+        if ($prePrevToken->isGivenKind([
+            T_CATCH, // `|` is part of catch `catch(X |`
+            T_FUNCTION, // `|` is part of an anonymous function variable `static function (X|Y`
+        ])) {
             $this->replaceToken($tokens, $index);
 
             return;
         }
 
-        $functionKinds = [[T_FUNCTION]];
-
-        if (\defined('T_FN')) {
-            $functionKinds[] = [T_FN];
-        }
-
-        $functionIndex = $tokens->getPrevTokenOfKind($prevIndex, $functionKinds);
+        if (\PHP_VERSION_ID >= 70400 && $prePrevToken->isGivenKind(T_FN)) {
+            $this->replaceToken($tokens, $index); // `|` is part of an array function variable `fn(int|null`
 
-        if (null === $functionIndex) {
             return;
         }
 
-        $braceOpenIndex = $tokens->getNextTokenOfKind($functionIndex, ['(']);
-        $braceCloseIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $braceOpenIndex);
+        if (
+            $prePrevToken->isGivenKind(T_STRING)
+            && $tokens[$tokens->getPrevMeaningfulToken($prevPrevTokenIndex)]->isGivenKind(T_FUNCTION)
+        ) {
+            // `|` is part of function variable `function Foo (X|Y`
+            $this->replaceToken($tokens, $index);
 
-        if ($braceCloseIndex < $index) {
             return;
         }
-
-        $this->replaceToken($tokens, $index);
     }
 
     /**


Test patch:
diff --git a/tests/AutoReview/FixerFactoryTest.php b/tests/AutoReview/FixerFactoryTest.php
index ceb4c383a..af24a830a 100644
--- a/tests/AutoReview/FixerFactoryTest.php
+++ b/tests/AutoReview/FixerFactoryTest.php
@@ -141,6 +141,7 @@ public function provideFixersPriorityCases()
             [$fixers['no_alternative_syntax'], $fixers['no_useless_else']],
             [$fixers['no_alternative_syntax'], $fixers['switch_continue_to_break']],
             [$fixers['no_blank_lines_after_phpdoc'], $fixers['header_comment']],
+            [$fixers['no_blank_lines_after_phpdoc'], $fixers['single_blank_line_before_namespace']],
             [$fixers['no_empty_comment'], $fixers['no_extra_blank_lines']],
             [$fixers['no_empty_comment'], $fixers['no_trailing_whitespace']],
             [$fixers['no_empty_comment'], $fixers['no_whitespace_in_blank_line']],
diff --git a/tests/Fixer/ClassNotation/ClassAttributesSeparationFixerTest.php b/tests/Fixer/ClassNotation/ClassAttributesSeparationFixerTest.php
index 156604381..dd443a56b 100644
--- a/tests/Fixer/ClassNotation/ClassAttributesSeparationFixerTest.php
+++ b/tests/Fixer/ClassNotation/ClassAttributesSeparationFixerTest.php
@@ -1530,4 +1530,39 @@ class Foo {
             }',
         ];
     }
+
+    /**
+     * @param string      $expected
+     * @param null|string $input
+     *
+     * @dataProvider provideFixClassesWithTraitsCases
+     */
+    public function testFixClassesWithTraits($expected, $input)
+    {
+        $this->doTest($expected, $input);
+    }
+
+    public function provideFixClassesWithTraitsCases()
+    {
+        yield [
+            '<?php
+class Foo
+{
+    use SomeTrait1;
+
+    use SomeTrait2;
+
+    public function Bar(){}
+}
+',
+            '<?php
+class Foo
+{
+    use SomeTrait1;
+    use SomeTrait2;
+    public function Bar(){}
+}
+',
+        ];
+    }
 }
diff --git a/tests/Fixer/ControlStructure/YodaStyleFixerTest.php b/tests/Fixer/ControlStructure/YodaStyleFixerTest.php
index 7829be856..33c1157c0 100644
--- a/tests/Fixer/ControlStructure/YodaStyleFixerTest.php
+++ b/tests/Fixer/ControlStructure/YodaStyleFixerTest.php
@@ -657,26 +657,14 @@ function foo() {
             ];
         }
 
-        $assignmentOperators = ['=', '**=', '*=', '|=', '+=', '-=', '^=',  '<<=', '>>=', '&=', '.=', '/=', '%='];
-        if (\PHP_VERSION_ID >= 70400) {
-            $assignmentOperators[] = '??=';
-        }
-
-        $logicalOperators = ['xor', 'or', 'and',  '||', '&&'];
-        if (\PHP_VERSION_ID >= 70400) {
-            $logicalOperators[] = '??';
-        }
-
-        foreach (array_merge($assignmentOperators, $logicalOperators) as $operator) {
-            yield [
-                sprintf('<?php $a %s 4 === $b ? 2 : 3;', $operator),
-                sprintf('<?php $a %s $b === 4 ? 2 : 3;', $operator),
-            ];
-        }
+        $templateExpected = '<?php $a %s 4 === $b ? 2 : 3;';
+        $templateInput = '<?php $a %s $b === 4 ? 2 : 3;';
+        $operators = ['**=', '*=', '|=', '+=', '-=', '^=', 'xor', 'or', 'and', '<<=', '>>=', '&=', '.=', '/=', '-=', '||', '&&'];
 
-        foreach ($assignmentOperators as $operator) {
+        foreach ($operators as $operator) {
             yield [
-                sprintf('<?php 1 === $x %s 2;', $operator),
+                sprintf($templateExpected, $operator),
+                sprintf($templateInput, $operator),
             ];
         }
     }
diff --git a/tests/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixerTest.php b/tests/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixerTest.php
index 2a52c26f5..c73c63c5b 100644
--- a/tests/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixerTest.php
+++ b/tests/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixerTest.php
@@ -287,22 +287,6 @@ public function testFixesOthers()
         $this->doTest($expected, $input);
     }
 
-    public function testWhitespaceInDocBlockAboveNamespaceIsNotTouched()
-    {
-        $expected = <<<'EOF'
-<?php
-
-/**
- * This is a file-level docblock.
- */
-
-namespace Foo\Bar\Baz;
-
-EOF;
-
-        $this->doTest($expected);
-    }
-
     public function testFixesWindowsStyle()
     {
         $expected = "<?php\r\n    /**     * Constant!     */\n    \$foo = 123;";
diff --git a/tests/Fixtures/Integration/misc/no_blank_lines_after_phpdoc,single_blank_line_before_namespace.test b/tests/Fixtures/Integration/priority/no_blank_lines_after_phpdoc,single_blank_line_before_namespace.test
similarity index 100%
rename from tests/Fixtures/Integration/misc/no_blank_lines_after_phpdoc,single_blank_line_before_namespace.test
rename to tests/Fixtures/Integration/priority/no_blank_lines_after_phpdoc,single_blank_line_before_namespace.test
diff --git a/tests/Tokenizer/Transformer/TypeAlternationTransformerTest.php b/tests/Tokenizer/Transformer/TypeAlternationTransformerTest.php
index 74a03e948..d6dcc4cc1 100644
--- a/tests/Tokenizer/Transformer/TypeAlternationTransformerTest.php
+++ b/tests/Tokenizer/Transformer/TypeAlternationTransformerTest.php
@@ -77,13 +77,7 @@ public function provideProcessCases()
                     echo "aaa" | "bbb";
                     echo F_OK | F_ERR;
                     echo foo(F_OK | F_ERR);
-                    foo($A||$b);
-                    foo($A|$b);
                     // try {} catch (ExceptionType1 | ExceptionType2) {}
-                    $a = function(){};
-                    $x = ($y|$z);
-                    function foo(){}
-                    $a = $b|$c;
                 ',
             ],
         ];
@@ -256,33 +250,5 @@ class Foo {
                 8 => CT::T_TYPE_ALTERNATION,
             ],
         ];
-
-        yield 'multiple function parameters' => [
-            '<?php function foo(A|B $x, C|D $y, E|F $z) {};',
-            [
-                6 => CT::T_TYPE_ALTERNATION,
-                13 => CT::T_TYPE_ALTERNATION,
-                20 => CT::T_TYPE_ALTERNATION,
-            ],
-        ];
-
-        yield 'function calls and function definitions' => [
-            '<?php
-                f1(CONST_A|CONST_B);
-                function f2(A|B $x, C|D $y, E|F $z) {};
-                f3(CONST_A|CONST_B);
-                function f4(A|B $x, C|D $y, E|F $z) {};
-                f5(CONST_A|CONST_B);
-                $x = ($y|$z);
-            ',
-            [
-                15 => CT::T_TYPE_ALTERNATION,
-                22 => CT::T_TYPE_ALTERNATION,
-                29 => CT::T_TYPE_ALTERNATION,
-                52 => CT::T_TYPE_ALTERNATION,
-                59 => CT::T_TYPE_ALTERNATION,
-                66 => CT::T_TYPE_ALTERNATION,
-            ],
-        ];
     }
 }