for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace SelamiApp\Factories;
use Zend\ServiceManager\Factory\FactoryInterface;
use Interop\Container\ContainerInterface;
use Psr\Http\Message\ServerRequestInterface;
use Selami\Router;
class RouterFactory implements FactoryInterface
{
/**
* @var array
*/
private $routes;
* @var Router
private $router;
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
* @var array $config
$config = $container->get('config');
$this->routes = $container->get('routes');
$container->get('routes')
*
array
$routes
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..
$request = $container->get(ServerRequestInterface::class);
$this->router = new Router(
$config['app']['default_return_type'] ?? Router::HTML,
$request->getMethod(),
$request->getUri()->getPath(),
'',
$config['app']['cache_file']
);
return $this->getRouter();
}
private function getRouter()
$this->addRoutes();
return $this->router;
private function addRoutes()
foreach ($this->routes as $route) {
$this->router->add($route[0], $route[1], $route[2], $route[3], $route[4] ?? '');
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..