for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PiedWeb\CMSBundle\Service;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\Router;
class PageCanonicalService
{
protected $request;
protected $router;
protected $defaultLocaleWithoutPrefix;
protected $defaultLocale;
protected $locale;
protected $params;
public function __construct(
RequestStack $request,
Router $router,
bool $defaultLocaleWithoutPrefix = false,
?string $defaultLocale = null
) {
$this->request = $request;
$this->router = $router;
$this->defaultLocaleWithoutPrefix = $defaultLocaleWithoutPrefix;
$this->defaultLocale = $defaultLocale;
}
public function generatePathForHomepage(?string $expectedLocale = null)
$expectedLocale
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function generatePathForHomepage(/** @scrutinizer ignore-unused */ ?string $expectedLocale = null)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return $this->router->generate('piedweb_cms_homepage');
/**
* @var string Permit to generate a link for another language than the current request
*/
public function generatePathForPage(string $slug, ?string $expectedLocale = null)
if ('' == $slug) {
return $this->generatePathForHomepage($expectedLocale);
return $this->router->generate('piedweb_cms_page', ['slug' => $slug]);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.