| Conditions | 3 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 3.0026 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 12 | public function __construct(array $routes) |
|
| 27 | { |
||
| 28 | 12 | $this->routes = array(); |
|
|
|
|||
| 29 | |||
| 30 | 12 | $this->dispatcher = FastRoute\simpleDispatcher(function (RouteCollector $collector) use ($routes) { |
|
| 31 | 12 | foreach ($routes as $route) { |
|
| 32 | 9 | $key = spl_object_hash($route); |
|
| 33 | |||
| 34 | 9 | $this->routes[$key] = $route; |
|
| 35 | |||
| 36 | 9 | if (!$route instanceof RouteInterface) { |
|
| 37 | throw new \InvalidArgumentException('Routes array must contain only RouteInterface objects'); |
||
| 38 | } |
||
| 39 | |||
| 40 | 9 | $collector->addRoute( |
|
| 41 | 9 | $route->getMethods(), |
|
| 42 | 9 | $route->getPattern(), |
|
| 43 | $key |
||
| 44 | 9 | ); |
|
| 45 | 12 | } |
|
| 46 | 12 | }); |
|
| 47 | 12 | } |
|
| 48 | |||
| 66 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..