Check for classes that have been defined more than once in the same file.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Silk\Support; |
||
4 | |||
5 | /** |
||
6 | * The Tightenco namespaced Collection class has only been available since 5.5.33 |
||
7 | * with aliases for the previous Illuminate\Support class for backwards compat. |
||
8 | * |
||
9 | * For PHP 5.6, v5.4 of the library will be installed, thus the namespaced version |
||
10 | * won't be available. |
||
11 | */ |
||
12 | |||
13 | // @codeCoverageIgnoreStart |
||
14 | if (class_exists('Tightenco\Collect\Support\Collection')) { |
||
15 | class Collection extends \Tightenco\Collect\Support\Collection |
||
16 | { |
||
17 | } |
||
18 | } else { |
||
19 | class Collection extends \Illuminate\Support\Collection |
||
1 ignored issue
–
show
|
|||
20 | { |
||
21 | } |
||
22 | } |
||
23 | // @codeCoverageIgnoreEnd |
||
24 |
This check looks for classes that have been defined more than once in the same file.
If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.
This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.