ray-di /
Ray.Aop
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Ray\Aop; |
||
| 6 | |||
| 7 | use ReflectionClass; |
||
|
0 ignored issues
–
show
|
|||
| 8 | use ReflectionMethod; |
||
|
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
Ray\Aop\ReflectionMethod.
Let’s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let’s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
|
|||
| 9 | |||
| 10 | abstract class AbstractMatcher |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var mixed[] |
||
| 14 | */ |
||
| 15 | protected $arguments = []; |
||
| 16 | |||
| 17 | public function __construct() |
||
| 18 | 59 | { |
|
| 19 | $this->arguments = func_get_args(); |
||
| 20 | 59 | } |
|
| 21 | 59 | ||
| 22 | /** |
||
| 23 | * Match class condition |
||
| 24 | * |
||
| 25 | * @param ReflectionClass<object> $class |
||
|
0 ignored issues
–
show
The doc-type
ReflectionClass<object> could not be parsed: Expected "|" or "end of type", but got "<" at position 15. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 26 | * @param mixed[] $arguments |
||
| 27 | * |
||
| 28 | * @return bool |
||
| 29 | */ |
||
| 30 | abstract public function matchesClass(ReflectionClass $class, array $arguments); |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Match method condition |
||
| 34 | * |
||
| 35 | * @param mixed[] $arguments |
||
| 36 | * |
||
| 37 | * @return bool |
||
| 38 | */ |
||
| 39 | abstract public function matchesMethod(ReflectionMethod $method, array $arguments); |
||
| 40 | |||
| 41 | /** |
||
| 42 | 44 | * Return matching condition arguments |
|
| 43 | * |
||
| 44 | 44 | * @return mixed[] |
|
| 45 | */ |
||
| 46 | public function getArguments() |
||
| 47 | { |
||
| 48 | return $this->arguments; |
||
| 49 | } |
||
| 50 | } |
||
| 51 |
Let’s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let’s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: