| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 24 | class SuicoCorePreload extends \XoopsPreloadItem |
||
| 25 | { |
||
| 26 | // to add PSR-4 autoloader |
||
| 27 | /** |
||
| 28 | * @param $args |
||
| 29 | */ |
||
| 30 | public static function eventCoreIncludeCommonEnd($args): void |
||
| 31 | { |
||
| 32 | require __DIR__ . '/autoloader.php'; |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param $args |
||
| 37 | */ |
||
| 38 | public static function eventCoreEdituserStart($args): void |
||
| 39 | { |
||
| 40 | header('location: ./modules/suico/edituser.php' . (Request::getString('QUERY_STRING', '', 'SERVER'))); |
||
| 41 | exit(); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param $args |
||
| 46 | */ |
||
| 47 | public static function eventCoreRegisterStart($args): void |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param $args |
||
| 55 | */ |
||
| 56 | public static function eventCoreUserinfoStart($args): void |
||
| 62 |
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: