mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 14:38:47 +02:00
migration symfony 5 4 (#300)
* symfony 5.4 (diff dev) * symfony 5.4 (working) * symfony 5.4 (update autoload) * symfony 5.4 (remove swiftmailer mailer implementation) * symfony 5.4 (php doc and split Global accessor class) ### Impacted packages: composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
@@ -23,7 +23,7 @@ use Twig\TwigFunction;
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class RoutingExtension extends AbstractExtension
|
||||
final class RoutingExtension extends AbstractExtension
|
||||
{
|
||||
private $generator;
|
||||
|
||||
@@ -35,7 +35,7 @@ class RoutingExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFunctions()
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
new TwigFunction('url', [$this, 'getUrl'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]),
|
||||
@@ -43,26 +43,12 @@ class RoutingExtension extends AbstractExtension
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $parameters
|
||||
* @param bool $relative
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPath($name, $parameters = [], $relative = false)
|
||||
public function getPath(string $name, array $parameters = [], bool $relative = false): string
|
||||
{
|
||||
return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $parameters
|
||||
* @param bool $schemeRelative
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl($name, $parameters = [], $schemeRelative = false)
|
||||
public function getUrl(string $name, array $parameters = [], bool $schemeRelative = false): string
|
||||
{
|
||||
return $this->generator->generate($name, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
}
|
||||
@@ -88,10 +74,8 @@ class RoutingExtension extends AbstractExtension
|
||||
* @param Node $argsNode The arguments of the path/url function
|
||||
*
|
||||
* @return array An array with the contexts the URL is safe
|
||||
*
|
||||
* @final since version 3.4, type-hint to be changed to "\Twig\Node\Node" in 4.0
|
||||
*/
|
||||
public function isUrlGenerationSafe(\Twig_Node $argsNode)
|
||||
public function isUrlGenerationSafe(Node $argsNode): array
|
||||
{
|
||||
// support named arguments
|
||||
$paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : (
|
||||
@@ -106,12 +90,4 @@ class RoutingExtension extends AbstractExtension
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'routing';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user