Skip to content

Commit 0b60b27

Browse files
committed
Added regression test
1 parent c0f2e9e commit 0b60b27

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

tests/PHPStan/Rules/Methods/OverridingMethodRuleTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
}

0 commit comments

Comments
 (0)