-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle inferring methods with same names properly
- Loading branch information
Showing
11 changed files
with
161 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
tests/Fixture/Object/InterfaceWithDifferentNamespaces/A/ClassThatInheritsInterfaceA.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\A; | ||
|
||
use CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\InterfaceA; | ||
|
||
final class ClassThatInheritsInterfaceA implements InterfaceA | ||
{ | ||
public string $value; | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/Fixture/Object/InterfaceWithDifferentNamespaces/A/OtherClassThatInheritsInterfaceA.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\A; | ||
|
||
use CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\InterfaceA; | ||
|
||
final class OtherClassThatInheritsInterfaceA implements InterfaceA | ||
{ | ||
public string $value; | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/Fixture/Object/InterfaceWithDifferentNamespaces/B/ClassThatInheritsInterfaceB.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\B; | ||
|
||
use CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\InterfaceB; | ||
|
||
final class ClassThatInheritsInterfaceB implements InterfaceB | ||
{ | ||
public string $value; | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/Fixture/Object/InterfaceWithDifferentNamespaces/B/OtherClassThatInheritsInterfaceB.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\B; | ||
|
||
use CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\InterfaceB; | ||
|
||
final class OtherClassThatInheritsInterfaceB implements InterfaceB | ||
{ | ||
public string $value; | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/Fixture/Object/InterfaceWithDifferentNamespaces/ClassWithBothInterfaces.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces; | ||
|
||
final class ClassWithBothInterfaces | ||
{ | ||
public InterfaceA $a; | ||
|
||
public InterfaceB $b; | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/Fixture/Object/InterfaceWithDifferentNamespaces/InterfaceA.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces; | ||
|
||
interface InterfaceA | ||
{ | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/Fixture/Object/InterfaceWithDifferentNamespaces/InterfaceAInferer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces; | ||
|
||
use CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\A\ClassThatInheritsInterfaceA; | ||
use CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\A\OtherClassThatInheritsInterfaceA; | ||
|
||
final class InterfaceAInferer | ||
{ | ||
/** | ||
* @return class-string<ClassThatInheritsInterfaceA|OtherClassThatInheritsInterfaceA> | ||
*/ | ||
public static function infer(bool $classic): string | ||
{ | ||
return $classic | ||
? ClassThatInheritsInterfaceA::class | ||
: OtherClassThatInheritsInterfaceA::class; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/Fixture/Object/InterfaceWithDifferentNamespaces/InterfaceB.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces; | ||
|
||
interface InterfaceB | ||
{ | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/Fixture/Object/InterfaceWithDifferentNamespaces/InterfaceBInferer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces; | ||
|
||
use CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\B\ClassThatInheritsInterfaceB; | ||
use CuyZ\Valinor\Tests\Fixture\Object\InterfaceWithDifferentNamespaces\B\OtherClassThatInheritsInterfaceB; | ||
|
||
final class InterfaceBInferer | ||
{ | ||
/** | ||
* @return class-string<ClassThatInheritsInterfaceB|OtherClassThatInheritsInterfaceB> | ||
*/ | ||
public static function infer(bool $classic): string | ||
{ | ||
return $classic | ||
? ClassThatInheritsInterfaceB::class | ||
: OtherClassThatInheritsInterfaceB::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters