1 | <?php |
||
8 | class CanonicalLinkExtension extends \Twig_Extension |
||
9 | { |
||
10 | /** @var CanonicalUrlGenerator */ |
||
11 | protected $canonicalUrlGenerator; |
||
12 | /** @var RequestStack */ |
||
13 | protected $requestStack; |
||
14 | |||
15 | /** |
||
16 | * CanonicalLinkExtension constructor. |
||
17 | * @param CanonicalUrlGenerator $canonicalUrlGenerator |
||
18 | * @param RequestStack $requestStack |
||
19 | */ |
||
20 | 3 | public function __construct(CanonicalUrlGenerator $canonicalUrlGenerator, RequestStack $requestStack) |
|
25 | |||
26 | /** |
||
27 | * @return \Twig_Function[] |
||
28 | */ |
||
29 | 1 | public function getFunctions() |
|
39 | |||
40 | /** |
||
41 | * @param \Twig_Environment $environment |
||
42 | * @param string $href |
||
43 | * |
||
44 | * @return string |
||
45 | */ |
||
46 | 1 | public function renderLinkTag(\Twig_Environment $environment, $href = null) |
|
54 | |||
55 | /** |
||
56 | * @param string $route |
||
57 | * @param string|array $parameters |
||
58 | * |
||
59 | * @see CanonicalUrlGenerator::generate() For parameter descriptions. |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | 2 | public function generateUrl($route = null, $parameters = null) |
|
72 | } |
||
73 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.