File tree Expand file tree Collapse file tree 3 files changed +64
-0
lines changed
tests/PHPStan/Rules/Methods Expand file tree Collapse file tree 3 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -820,4 +820,11 @@ public function testFixOverride(): void
820820 $ this ->fix (__DIR__ . '/data/fix-override-attribute.php ' , __DIR__ . '/data/fix-override-attribute.php.fixed ' );
821821 }
822822
823+ #[RequiresPhp('>= 8.3 ' )]
824+ public function testFixWithTabs (): void
825+ {
826+ $ this ->phpVersionId = PHP_VERSION_ID ;
827+ $ this ->checkMissingOverrideMethodAttribute = true ;
828+ $ this ->fix (__DIR__ . '/data/fix-with-tabs.php ' , __DIR__ . '/data/fix-with-tabs.php.fixed ' );
829+ }
823830}
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace FixWithTabs ;
4+
5+ interface FooInterface {
6+ /** @return Collection<BarI> */
7+ public function foo (): Collection ;
8+ }
9+
10+ interface BarI
11+ {
12+
13+ }
14+ class Bar implements BarI {}
15+
16+ /** @template-coveriant TValue */
17+ class Collection {}
18+
19+
20+ class Baz implements FooInterface
21+ {
22+ /** @return Collection<Bar> */
23+ public function foo (): Collection
24+ {
25+ /** @var Collection<Bar> */
26+ return new Collection ();
27+ }
28+ }
Original file line number Diff line number Diff line change 1+ <?php declare(strict_types = 1);
2+
3+ namespace FixWithTabs;
4+
5+ interface FooInterface {
6+ /** @return Collection<BarI> */
7+ public function foo(): Collection;
8+ }
9+
10+ interface BarI
11+ {
12+
13+ }
14+ class Bar implements BarI {}
15+
16+ /** @template-coveriant TValue */
17+ class Collection {}
18+
19+
20+ class Baz implements FooInterface
21+ {
22+ /** @return Collection<Bar> */
23+ #[\Override]
24+ public function foo(): Collection
25+ {
26+ /** @var Collection<Bar> */
27+ return new Collection();
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments