Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Adapting namespace sensitivity from pr (#1695) to issue (#1649) * Make InternalInterfacesSniff namespace sensitive * Make NewInterfaceSniff namespace sensitive * Add test cases for imports from internal namespace
- Loading branch information
1 parent
782436f
commit 96072c3
Showing
8 changed files
with
276 additions
and
4 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
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
2 changes: 1 addition & 1 deletion
2
PHPCompatibility/Tests/Interfaces/InternalInterfacesUnitTest.inc
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
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
PHPCompatibility/Tests/Interfaces/InternalInterfacesUsesUnitTest.inc
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 | ||
use Something\TRaVeRsaBlE; | ||
use Something\datetimeinterface; | ||
use Something\THROWABLE; | ||
use Something\UnitEnum; | ||
use Something\BackedEnum; | ||
|
||
class MyTraversable implements TRaVeRsaBlE {} | ||
class MyDateTimeClass implements datetimeinterface {} | ||
class MyThrowable implements THROWABLE {} | ||
class MyUnitEnum implements UnitEnum {} | ||
class MyBackedEnum implements BackedEnum {} |
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
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
61 changes: 61 additions & 0 deletions
61
PHPCompatibility/Tests/Interfaces/NewInterfacesUsesUnitTest.inc
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,61 @@ | ||
<?php | ||
|
||
use NothingHere\Traversable; | ||
use NothingHere\Reflector; | ||
use NothingHere\Countable; | ||
use NothingHere\OUTERiterator; | ||
use NothingHere\RecursiveIterator; | ||
use NothingHere\SeekableIterator; | ||
use NothingHere\Serializable; | ||
use NothingHere\SplObserver; | ||
use NothingHere\SplSubject; | ||
use NothingHere\JsonSerializable; | ||
use NothingHere\SessionHandlerInterface; | ||
use NothingHere\DateTimeInterface; | ||
use NothingHere\SessionIdInterface; | ||
use NothingHere\Throwable; | ||
use NothingHere\SessionUpdateTimestampHandlerInterface; | ||
use NothingHere\Stringable; | ||
use NothingHere\DOMChildNode; | ||
use NothingHere\DOMParentNode; | ||
use NothingHere\UnitEnum; | ||
use NothingHere\BackedEnum; | ||
use NothingHere\Random\ {Engine, CryptoSafeEngine}; | ||
|
||
|
||
class MyTraversable implements Traversable{} | ||
class MyReflector implements Reflector, Countable{} | ||
class MyOuterIterator implements OUTERiterator{} | ||
class MySerializable implements Serializable{} | ||
class MySplObserver implements SplObserver{} | ||
class MySplSubject implements SplSubject{} | ||
class MyJsonSerializable implements JsonSerializable{} | ||
class MySessionHandlerInterface implements SessionHandlerInterface{} | ||
class MyDateTimeInterface implements DateTimeInterface{} | ||
class MySessionIdInterface implements SessionIdInterface{} | ||
class MyThrowable implements Throwable{} | ||
class MySessionUpdateTimestampHandlerInterface implements SessionUpdateTimestampHandlerInterface{} | ||
class MyStringable implements Stringable{} | ||
class MyDOMChildNode implements DOMChildNode{} | ||
class MyDOMParentNode implements DOMParentNode{} | ||
class MyUnitEnum implements UnitEnum{} | ||
class MyRandomEngine implements Engine{} | ||
class MyRandomCryptoSafeEngine implements CryptoSafeEngine{} | ||
|
||
// Test anonymous class support. | ||
$a = new class implements BackedEnum { | ||
}; | ||
|
||
class MyClass | ||
{ | ||
private JsonSerializable $asd; | ||
|
||
// Interfaces as typehints. | ||
function CountableTypeHint(RecursiveIterator $a): RecursiveIterator{} | ||
// Interfaces as typehints. | ||
function CountableTypeHint(SeekableIterator $a): ?SeekableIterator{} | ||
} | ||
|
||
try { | ||
} catch (Throwable $e) { | ||
} |