minor #21536 [TwigBridge] Add docblocks for Twig url and path function to improve ide completion (Haehnchen)

This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBridge] Add docblocks for Twig url and path function to improve ide completion

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

`RoutingExtension` missed docblock for Twig extension so `path` and `url` are not fully recognized by PhpStorm.

https://github.com/Haehnchen/idea-php-symfony2-plugin/issues/864 will add more smarter completion
`{{ p<caret> }} -> {{ path('<caret>') }}`, but string parameter is not detected. This will add the minimal docs

Commits
-------

93ab0179f0 add docblocks for Twig url and path function to improve ide completion
This commit is contained in:
Fabien Potencier 2017-02-16 03:30:17 -08:00
commit 85ae59a15b

View File

@ -40,11 +40,25 @@ class RoutingExtension extends \Twig_Extension
);
}
/**
* @param string $name
* @param array $parameters
* @param bool $relative
*
* @return string
*/
public function getPath($name, $parameters = array(), $relative = false)
{
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 = array(), $schemeRelative = false)
{
return $this->generator->generate($name, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);