| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 6 |
| Ratio | 28.57 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 40 | public function load($path) |
||
| 41 | { |
||
| 42 | if (!is_readable($path)) { |
||
| 43 | throw new \InvalidArgumentException('Invalid laravel routes path found: ' . $path); |
||
| 44 | } |
||
| 45 | |||
| 46 | // localising the object so the $path file can reference $router; |
||
| 47 | $router = $this->router; |
||
| 48 | |||
| 49 | // The included file must return the laravel router |
||
| 50 | include $path; |
||
| 51 | |||
| 52 | View Code Duplication | if (!($router instanceof LaravelRouter)) { |
|
| 53 | throw new \Exception('Invalid return value from ' |
||
| 54 | . pathinfo($path, PATHINFO_FILENAME) |
||
| 55 | . ' expected instance of LaravelRouter' |
||
| 56 | ); |
||
| 57 | } |
||
| 58 | |||
| 59 | return $router; |
||
| 60 | } |
||
| 61 | } |
||
| 62 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.jsonfile (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.jsonto be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
requireorrequire-devsection?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceofchecks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.