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

Issue:
Support phpDoc in `fully_qualified_strict_types`
First of all i know it's not a bug or really an issue, but i would like to have it as a feature request. 
Reason for that, is currently using this fixer, leaves code base in inconsistent state. 

If i use fully_qualified_strict_types to transforms imported FQCN parameters and return types in function arguments to short version, i would also expect that if it can also transforms for the types that are mentioned within Phpdoc.

When reporting an issue (bug) please provide the following information:

#### The PHP version you are using (`$ php -v`):
=> 7.1.16
#### PHP CS Fixer version you are using (`$ php-cs-fixer -V`):
=> 2.10.0

#### If applicable, please provide minimum samples of PHP code (as plain text, not screenshots):
 * before running PHP CS Fixer (no changes):
```php
/** @param \This\Is\Param\Namespace\User $x **/
public function beforePhpCsFixer(\This\Is\Param\Namespace\User $x, string $y): void
{
    // function body
}
```

 * with unexpected changes applied when running PHP CS Fixer:
```php
/** @param \This\Is\Param\Namespace\User $x **/
public function beforePhpCsFixer(User $x, string $y): void
{
    // function body
}
```

 * with the changes you expected instead:
```php
/** @param User $x **/
public function beforePhpCsFixer(User $x, string $y): void
{
    // function body
}
```

Thank you!

Pull request:
feat: add phpDoc support for `fully_qualified_strict_types` fixer
Fixes #3958.

I added support to `fully_qualified_strict_types` fixer to be able to work with PHPDoc, as discussed it https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/3958. This is my first PR to PHP-CS-Fixer, I tried to adhere to the contributing rules, hopefully I didn't miss anything important.

There is one small issue probably with integration of some other fixer, I hope we can resolve it.



Patch:
diff --git a/doc/rules/import/fully_qualified_strict_types.rst b/doc/rules/import/fully_qualified_strict_types.rst
index 12ab3d80e..56d2f80b6 100644
--- a/doc/rules/import/fully_qualified_strict_types.rst
+++ b/doc/rules/import/fully_qualified_strict_types.rst
@@ -35,16 +35,32 @@ Example #1
     use Foo\Bar;
     use Foo\Bar\Baz;
 
+    /**
+   - * @see \Foo\Bar\Baz
+   + * @see Baz
+     */
     class SomeClass
     {
-   -    public function doX(\Foo\Bar $foo): \Foo\Bar\Baz
-   +    public function doX(Bar $foo): Baz
-        {
+        /**
+   -     * @var \Foo\Bar\Baz
+   +     * @var Baz
+         */
+        public $baz;
+
+        /**
+   -     * @param \Foo\Bar\Baz $baz
+   +     * @param Baz $baz
+         */
+        public function __construct($baz) {
+            $this->baz = $baz;
         }
 
-   -    public function doY(Foo\NotImported $u, \Foo\NotImported $v)
-   +    public function doY(Foo\NotImported $u, Foo\NotImported $v)
-        {
+        /**
+   -     * @return \Foo\Bar\Baz
+   +     * @return Baz
+         */
+        public function getBaz() {
+            return $this->baz;
         }
     }
 
diff --git a/phpstan.dist.neon b/phpstan.dist.neon
index bc0d05541..15cd9324d 100644
--- a/phpstan.dist.neon
+++ b/phpstan.dist.neon
@@ -21,7 +21,7 @@ parameters:
         -
             message: '#^Method PhpCsFixer\\Tests\\.+::provide.+Cases\(\) return type has no value type specified in iterable type iterable\.$#'
             path: tests
-            count: 1120
+            count: 1113
 
         -
             message: '#Call to static method .+ with .+ will always evaluate to true.$#'
diff --git a/src/Fixer/Import/FullyQualifiedStrictTypesFixer.php b/src/Fixer/Import/FullyQualifiedStrictTypesFixer.php
index e9f04f3c9..5589eea1a 100644
--- a/src/Fixer/Import/FullyQualifiedStrictTypesFixer.php
+++ b/src/Fixer/Import/FullyQualifiedStrictTypesFixer.php
@@ -22,6 +22,7 @@
 use PhpCsFixer\FixerDefinition\CodeSample;
 use PhpCsFixer\FixerDefinition\FixerDefinition;
 use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
+use PhpCsFixer\Preg;
 use PhpCsFixer\Tokenizer\Analyzer\Analysis\TypeAnalysis;
 use PhpCsFixer\Tokenizer\Analyzer\FunctionsAnalyzer;
 use PhpCsFixer\Tokenizer\Analyzer\NamespaceUsesAnalyzer;
@@ -31,6 +32,8 @@
 
 /**
  * @author VeeWee <toonverwerft@gmail.com>
+ * @author Tomas Jadrny <developer@tomasjadrny.cz>
+ * @author Greg Korba <greg@codito.dev>
  */
 final class FullyQualifiedStrictTypesFixer extends AbstractFixer implements ConfigurableFixerInterface
 {
@@ -45,14 +48,28 @@ public function getDefinition(): FixerDefinitionInterface
 use Foo\Bar;
 use Foo\Bar\Baz;
 
+/**
+ * @see \Foo\Bar\Baz
+ */
 class SomeClass
 {
-    public function doX(\Foo\Bar $foo): \Foo\Bar\Baz
-    {
+    /**
+     * @var \Foo\Bar\Baz
+     */
+    public $baz;
+
+    /**
+     * @param \Foo\Bar\Baz $baz
+     */
+    public function __construct($baz) {
+        $this->baz = $baz;
     }
 
-    public function doY(Foo\NotImported $u, \Foo\NotImported $v)
-    {
+    /**
+     * @return \Foo\Bar\Baz
+     */
+    public function getBaz() {
+        return $this->baz;
     }
 }
 '
@@ -86,7 +103,7 @@ public function getPriority(): int
 
     public function isCandidate(Tokens $tokens): bool
     {
-        return $tokens->isTokenKindFound(T_FUNCTION);
+        return $tokens->isAnyTokenKindsFound([T_FUNCTION, T_DOC_COMMENT]);
     }
 
     protected function createConfigurationDefinition(): FixerConfigurationResolverInterface
@@ -119,6 +136,10 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
                 if ($tokens[$index]->isGivenKind(T_FUNCTION)) {
                     $this->fixFunction($functionsAnalyzer, $tokens, $index, $uses, $namespaceName);
                 }
+
+                if ($tokens[$index]->isGivenKind(T_DOC_COMMENT)) {
+                    $this->fixPhpDoc($tokens, $index, $uses, $namespaceName);
+                }
             }
         }
     }
@@ -145,6 +166,40 @@ private function fixFunction(FunctionsAnalyzer $functionsAnalyzer, Tokens $token
         }
     }
 
+    /**
+     * @param array<string, string> $uses
+     */
+    private function fixPhpDoc(Tokens $tokens, int $index, array $uses, string $namespaceName): void
+    {
+        $phpDoc = $tokens[$index];
+        $phpDocContent = $phpDoc->getContent();
+        Preg::matchAll('#@([^\s]+)\s+([^\s]+)#', $phpDocContent, $matches);
+
+        if ([] !== $matches) {
+            foreach ($matches[2] as $i => $typeName) {
+                if (!\in_array($matches[1][$i], ['param', 'return', 'see', 'throws', 'var'], true)) {
+                    continue;
+                }
+
+                $shortTokens = $this->determineShortType($typeName, $uses, $namespaceName);
+
+                if (null !== $shortTokens) {
+                    // Replace tag+type in order to avoid replacing type multiple times (when same type is used in multiple places)
+                    $phpDocContent = str_replace(
+                        $matches[0][$i],
+                        '@'.$matches[1][$i].' '.implode('', array_map(
+                            static fn (Token $token) => $token->getContent(),
+                            $shortTokens
+                        )),
+                        $phpDocContent
+                    );
+                }
+            }
+
+            $tokens[$index] = new Token([T_DOC_COMMENT, $phpDocContent]);
+        }
+    }
+
     /**
      * @param array<string, string> $uses
      */
@@ -156,7 +211,6 @@ private function replaceByShortType(Tokens $tokens, TypeAnalysis $type, array $u
             $typeStartIndex = $tokens->getNextMeaningfulToken($typeStartIndex);
         }
 
-        $namespaceNameLength = \strlen($namespaceName);
         $types = $this->getTypes($tokens, $typeStartIndex, $type->getEndIndex());
 
         foreach ($types as $typeName => [$startIndex, $endIndex]) {
@@ -164,60 +218,76 @@ private function replaceByShortType(Tokens $tokens, TypeAnalysis $type, array $u
                 return;
             }
 
-            $withLeadingBackslash = str_starts_with($typeName, '\\');
-            if ($withLeadingBackslash) {
-                $typeName = substr($typeName, 1);
+            $shortType = $this->determineShortType($typeName, $uses, $namespaceName);
+
+            if (null !== $shortType) {
+                $tokens->overrideRange($startIndex, $endIndex, $shortType);
             }
-            $typeNameLower = strtolower($typeName);
+        }
+    }
 
-            if (isset($uses[$typeNameLower]) && ($withLeadingBackslash || '' === $namespaceName)) {
-                // if the type without leading "\" equals any of the full "uses" long names, it can be replaced with the short one
-                $tokens->overrideRange($startIndex, $endIndex, $this->namespacedStringToTokens($uses[$typeNameLower]));
+    /**
+     * Determines short type based on FQCN, current namespace and imports (`use` declarations).
+     *
+     * @param array<string, string> $uses
+     *
+     * @return null|Token[]
+     */
+    private function determineShortType(string $typeName, array $uses, string $namespaceName): ?array
+    {
+        $withLeadingBackslash = str_starts_with($typeName, '\\');
+        if ($withLeadingBackslash) {
+            $typeName = substr($typeName, 1);
+        }
+        $typeNameLower = strtolower($typeName);
+        $namespaceNameLength = \strlen($namespaceName);
 
-                continue;
-            }
+        if (isset($uses[$typeNameLower]) && ($withLeadingBackslash || '' === $namespaceName)) {
+            // if the type without leading "\" equals any of the full "uses" long names, it can be replaced with the short one
+            return $this->namespacedStringToTokens($uses[$typeNameLower]);
+        }
 
-            if ('' === $namespaceName) {
-                foreach ($uses as $useShortName) {
-                    if (strtolower($useShortName) === $typeNameLower) {
-                        continue 2;
-                    }
+        if ('' === $namespaceName) {
+            // if we are in the global namespace and the type is not imported the leading '\' can be removed (TODO nice config candidate)
+            foreach ($uses as $useShortName) {
+                if (strtolower($useShortName) === $typeNameLower) {
+                    return null;
                 }
+            }
 
-                // if we are in the global namespace and the type is not imported,
-                // we enforce/remove leading backslash (depending on the configuration)
-                if (true === $this->configuration['leading_backslash_in_global_namespace']) {
-                    if (!$withLeadingBackslash && !isset($uses[$typeNameLower])) {
-                        $tokens->overrideRange(
-                            $startIndex,
-                            $endIndex,
-                            $this->namespacedStringToTokens($typeName, true)
-                        );
-                    }
-                } else {
-                    $tokens->overrideRange($startIndex, $endIndex, $this->namespacedStringToTokens($typeName));
+            // if we are in the global namespace and the type is not imported,
+            // we enforce/remove leading backslash (depending on the configuration)
+            if (true === $this->configuration['leading_backslash_in_global_namespace']) {
+                if (!$withLeadingBackslash && !isset($uses[$typeNameLower])) {
+                    return $this->namespacedStringToTokens($typeName, true);
                 }
-            } elseif (!str_contains($typeName, '\\')) {
-                // If we're NOT in the global namespace, there's no related import,
-                // AND used type is from global namespace, then it can't be shortened.
-                continue;
-            } elseif ($typeNameLower !== $namespaceName && str_starts_with($typeNameLower, $namespaceName.'\\')) {
-                // if the type starts with namespace and the type is not the same as the namespace it can be shortened
-                $typeNameShort = substr($typeName, $namespaceNameLength + 1);
-
-                // if short names are the same, but long one are different then it cannot be shortened
-                foreach ($uses as $useLongName => $useShortName) {
-                    if (
-                        strtolower($typeNameShort) === strtolower($useShortName)
-                        && strtolower($typeName) !== strtolower($useLongName)
-                    ) {
-                        continue 2;
-                    }
+            } else {
+                return $this->namespacedStringToTokens($typeName);
+            }
+        }
+        if (!str_contains($typeName, '\\')) {
+            // If we're NOT in the global namespace, there's no related import,
+            // AND used type is from global namespace, then it can't be shortened.
+            return null;
+        }
+        if ($typeNameLower !== $namespaceName && str_starts_with($typeNameLower, $namespaceName.'\\')) {
+            // if the type starts with namespace and the type is not the same as the namespace it can be shortened
+            $typeNameShort = substr($typeName, $namespaceNameLength + 1);
+
+            // if short names are the same, but long one are different then it cannot be shortened
+            foreach ($uses as $useLongName => $useShortName) {
+                if (
+                    strtolower($typeNameShort) === strtolower($useShortName)
+                    && strtolower($typeName) !== strtolower($useLongName)
+                ) {
+                    return null;
                 }
-
-                $tokens->overrideRange($startIndex, $endIndex, $this->namespacedStringToTokens($typeNameShort));
             }
+
+            return $this->namespacedStringToTokens($typeNameShort);
         }
+
+        return null;
     }
 
     /**


Test patch:
diff --git a/tests/Fixer/Import/FullyQualifiedStrictTypesFixerTest.php b/tests/Fixer/Import/FullyQualifiedStrictTypesFixerTest.php
index 82d497c6d..33dbcc00b 100644
--- a/tests/Fixer/Import/FullyQualifiedStrictTypesFixerTest.php
+++ b/tests/Fixer/Import/FullyQualifiedStrictTypesFixerTest.php
@@ -36,6 +36,9 @@ public function testNewLogic(string $expected, ?string $input = null, array $con
         $this->doTest($expected, $input);
     }
 
+    /**
+     * @return iterable<array{0: string, 1?: null|string, 2?: array<string, mixed>}>
+     */
     public static function provideNewLogicCases(): iterable
     {
         yield 'namespace === type name' => [
@@ -164,6 +167,9 @@ public function testCodeWithReturnTypes(string $expected, ?string $input = null)
         $this->doTest($expected, $input);
     }
 
+    /**
+     * @return iterable<array{0: string, 1?: null|string}>
+     */
     public static function provideCodeWithReturnTypesCases(): iterable
     {
         yield 'Import common strict types' => [
@@ -376,6 +382,9 @@ public function testCodeWithoutReturnTypes(string $expected, ?string $input = nu
         $this->doTest($expected, $input);
     }
 
+    /**
+     * @return iterable<array{0: string, 1?: null|string}>
+     */
     public static function provideCodeWithoutReturnTypesCases(): iterable
     {
         yield 'import from namespace and global' => [
@@ -635,6 +644,9 @@ public function __construct(
         ];
     }
 
+    /**
+     * @return iterable<array{0: string, 1?: null|string}>
+     */
     public static function provideCodeWithReturnTypesCasesWithNullableCases(): iterable
     {
         yield 'Test namespace fixes with nullable types' => [
@@ -687,6 +699,359 @@ public function three(Three\Four $four): ?Two\Three
         ];
     }
 
+    /**
+     * @param array<string, mixed> $config
+     *
+     * @dataProvider provideCodeWithPhpDocCases
+     */
+    public function testCodeWithPhpDoc(string $expected, ?string $input = null, array $config = []): void
+    {
+        $this->fixer->configure($config);
+        $this->doTest($expected, $input);
+    }
+
+    /**
+     * @return iterable<string, array{0: string, 1?: string, 2?: array<string, mixed>}>
+     */
+    public static function provideCodeWithPhpDocCases(): iterable
+    {
+        yield 'Test class PHPDoc fixes' => [
+            '<?php
+
+namespace Foo\Bar;
+
+use Foo\Bar\Baz;
+use Foo\Bar\Bam;
+
+/**
+ * @see Baz
+ * @see Bam
+ */
+class SomeClass
+{
+    /**
+     * @var Baz
+     */
+    public $baz;
+
+    /** @var Bam */
+    public $bam;
+}',
+            '<?php
+
+namespace Foo\Bar;
+
+use Foo\Bar\Baz;
+use Foo\Bar\Bam;
+
+/**
+ * @see \Foo\Bar\Baz
+ * @see \Foo\Bar\Bam
+ */
+class SomeClass
+{
+    /**
+     * @var \Foo\Bar\Baz
+     */
+    public $baz;
+
+    /** @var \Foo\Bar\Bam */
+    public $bam;
+}',
+        ];
+
+        yield 'Test PHPDoc nullable fixes' => [
+            '<?php
+
+namespace Foo\Bar;
+
+use Foo\Bar\Baz;
+use Foo\Bar\Bam;
+
+/**
+ * @see Baz|null
+ * @see Bam|null
+ */
+class SomeClass {}',
+            '<?php
+
+namespace Foo\Bar;
+
+use Foo\Bar\Baz;
+use Foo\Bar\Bam;
+
+/**
+ * @see \Foo\Bar\Baz|null
+ * @see \Foo\Bar\Bam|null
+ */
+class SomeClass {}',
+        ];
+
+        yield 'Test PHPDoc in interface' => [
+            '<?php
+
+namespace Foo\Bar;
+
+use Foo\Bar\Baz;
+
+interface SomeClass
+{
+   /**
+    * @param SomeClass $foo
+    * @param Buz $buz
+    * @param Zoof\Buz $barbuz
+    *
+    * @return Baz
+    */
+    public function doSomething(SomeClass $foo, Buz $buz, Zoof\Buz $barbuz): Baz;
+}',
+            '<?php
+
+namespace Foo\Bar;
+
+use Foo\Bar\Baz;
+
+interface SomeClass
+{
+   /**
+    * @param \Foo\Bar\SomeClass $foo
+    * @param \Foo\Bar\Buz $buz
+    * @param \Foo\Bar\Zoof\Buz $barbuz
+    *
+    * @return \Foo\Bar\Baz
+    */
+    public function doSomething(\Foo\Bar\SomeClass $foo, \Foo\Bar\Buz $buz, \Foo\Bar\Zoof\Buz $barbuz): \Foo\Bar\Baz;
+}',
+        ];
+
+        yield 'Test PHPDoc in interface with no imports' => [
+            '<?php
+
+namespace Foo\Bar;
+
+interface SomeClass
+{
+   /**
+    * @param SomeClass $foo
+    * @param Buz $buz
+    * @param Zoof\Buz $barbuz
+    *
+    * @return Baz
+    */
+    public function doSomething(SomeClass $foo, Buz $buz, Zoof\Buz $barbuz): Baz;
+}',
+            '<?php
+
+namespace Foo\Bar;
+
+interface SomeClass
+{
+   /**
+    * @param \Foo\Bar\SomeClass $foo
+    * @param \Foo\Bar\Buz $buz
+    * @param \Foo\Bar\Zoof\Buz $barbuz
+    *
+    * @return \Foo\Bar\Baz
+    */
+    public function doSomething(\Foo\Bar\SomeClass $foo, \Foo\Bar\Buz $buz, \Foo\Bar\Zoof\Buz $barbuz): \Foo\Bar\Baz;
+}',
+        ];
+
+        yield 'Test not imported PHPDoc fixes' => [
+            '<?php
+
+namespace Foo\Bar;
+
+/**
+ * @see Baz
+ * @see Bam
+ */
+final class SomeClass {}',
+            '<?php
+
+namespace Foo\Bar;
+
+/**
+ * @see \Foo\Bar\Baz
+ * @see \Foo\Bar\Bam
+ */
+final class SomeClass {}',
+        ];
+
+        yield 'Test multiple PHPDoc blocks' => [
+            '<?php
+
+namespace Foo\Bar;
+
+use Foo\Bar\Buz;
+use Foo\Bar\Baz;
+use Foo\Bar\SomeClass;
+
+/**
+ * @see Baz
+ * @see Bam
+ */
+interface SomeClass
+{
+    /**
+    * @param SomeClass $foo
+    * @param Buz $buz
+    *
+    * @return Baz
+    */
+    public function doSomething(SomeClass $foo, Buz $buz): Baz;
+}',
+            '<?php
+
+namespace Foo\Bar;
+
+use Foo\Bar\Buz;
+use Foo\Bar\Baz;
+use Foo\Bar\SomeClass;
+
+/**
+ * @see \Foo\Bar\Baz
+ * @see \Foo\Bar\Bam
+ */
+interface SomeClass
+{
+    /**
+    * @param \Foo\Bar\SomeClass $foo
+    * @param \Foo\Bar\Buz $buz
+    *
+    * @return \Foo\Bar\Baz
+    */
+    public function doSomething(\Foo\Bar\SomeClass $foo, \Foo\Bar\Buz $buz): \Foo\Bar\Baz;
+}',
+        ];
+
+        yield 'Skip @covers in tests (they require FQCN)' => [
+            '<?php
+
+namespace Tests\Foo\Bar;
+
+use Foo\Bar\SomeClass;
+
+/**
+ * @covers \Foo\Bar\SomeClass
+ */
+class SomeClassTest {}',
+        ];
+
+        yield 'Imports with aliases' => [
+            '<?php
+
+namespace Foo\Bar;
+
+use Foo\Bar\Baz as Buzz;
+use Foo\Bar\Bam as Boom;
+
+/**
+ * @see Buzz
+ * @see Boom
+ */
+class SomeClass
+{
+    /**
+     * @var Buzz
+     */
+    public $baz;
+
+    /** @var Boom */
+    public $bam;
+
+    /**
+     * @param Buzz $baz
+     * @param Boom $bam
+     */
+    public function __construct($baz, $bam) {
+        $this->baz = $baz;
+        $this->bam = $bam;
+    }
+
+    /**
+     * @return Buzz
+     */
+    public function getBaz() {
+        return $this->baz;
+    }
+
+    /**
+     * @return Boom
+     */
+    public function getBam() {
+        return $this->bam;
+    }
+}',
+            '<?php
+
+namespace Foo\Bar;
+
+use Foo\Bar\Baz as Buzz;
+use Foo\Bar\Bam as Boom;
+
+/**
+ * @see \Foo\Bar\Baz
+ * @see \Foo\Bar\Bam
+ */
+class SomeClass
+{
+    /**
+     * @var \Foo\Bar\Baz
+     */
+    public $baz;
+
+    /** @var \Foo\Bar\Bam */
+    public $bam;
+
+    /**
+     * @param \Foo\Bar\Baz $baz
+     * @param \Foo\Bar\Bam $bam
+     */
+    public function __construct($baz, $bam) {
+        $this->baz = $baz;
+        $this->bam = $bam;
+    }
+
+    /**
+     * @return \Foo\Bar\Baz
+     */
+    public function getBaz() {
+        return $this->baz;
+    }
+
+    /**
+     * @return \Foo\Bar\Bam
+     */
+    public function getBam() {
+        return $this->bam;
+    }
+}',
+        ];
+
+        yield 'Leading backslash in global namespace' => [
+            '<?php
+
+/**
+ * @param \DateTimeInterface $dateTime
+ * @return \DateTimeInterface
+ * @see \DateTimeImmutable
+ * @throws \Exception
+ */
+function foo($dateTime) {}',
+            '<?php
+
+/**
+ * @param DateTimeInterface $dateTime
+ * @return DateTimeInterface
+ * @see DateTimeImmutable
+ * @throws Exception
+ */
+function foo($dateTime) {}',
+            ['leading_backslash_in_global_namespace' => true],
+        ];
+    }
+
     /**
      * @requires PHP 8.0
      *
@@ -697,6 +1062,9 @@ public function testFix80(string $expected, ?string $input = null): void
         $this->doTest($expected, $input);
     }
 
+    /**
+     * @return iterable<array{0: string, 1?: null|string}>
+     */
     public static function provideFix80Cases(): iterable
     {
         yield [
@@ -741,6 +1109,9 @@ public function testFix81(string $expected, ?string $input = null, array $config
         $this->doTest($expected, $input);
     }
 
+    /**
+     * @return iterable<array{0: string, 1?: null|string, 2?: array<string, mixed>}>
+     */
     public static function provideFix81Cases(): iterable
     {
         yield [
@@ -795,6 +1166,9 @@ public function testFix82(string $expected, ?string $input = null, array $config
         $this->doTest($expected, $input);
     }
 
+    /**
+     * @return iterable<array{0: string, 1?: null|string, 2?: array<string, mixed>}>
+     */
     public static function provideFix82Cases(): iterable
     {
         yield 'simple param in global namespace without use' => [
diff --git a/tests/Fixtures/Integration/priority/phpdoc_to_return_type,fully_qualified_strict_types.test b/tests/Fixtures/Integration/priority/phpdoc_to_return_type,fully_qualified_strict_types.test
index 854b9f67f..8f82fb732 100644
--- a/tests/Fixtures/Integration/priority/phpdoc_to_return_type,fully_qualified_strict_types.test
+++ b/tests/Fixtures/Integration/priority/phpdoc_to_return_type,fully_qualified_strict_types.test
@@ -5,7 +5,7 @@ Integration of fixers: phpdoc_to_return_type,fully_qualified_strict_types.
 --EXPECT--
 <?php
 use \Foo\Bar\Baz;
-/** @return \Foo\Bar\Baz */
+/** @return Baz */
 function my_foo(): Baz
 {}