-
-
Notifications
You must be signed in to change notification settings - Fork 586
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1061 from IonBazan/twig-2.7
use Twig 2.7 namespaces
- Loading branch information
Showing
4 changed files
with
24 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,14 @@ | |
|
||
namespace JMS\Serializer\Twig; | ||
|
||
use Twig\Extension\AbstractExtension; | ||
use Twig\TwigFilter; | ||
use Twig\TwigFunction; | ||
|
||
/** | ||
* @author Asmir Mustafic <[email protected]> | ||
*/ | ||
final class SerializerRuntimeExtension extends \Twig_Extension | ||
final class SerializerRuntimeExtension extends AbstractExtension | ||
{ | ||
/** | ||
* @return string | ||
|
@@ -20,26 +24,26 @@ public function getName() | |
} | ||
|
||
/** | ||
* @return \Twig_Filter[] | ||
* @return TwigFilter[] | ||
* | ||
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint | ||
*/ | ||
public function getFilters() | ||
{ | ||
return [ | ||
new \Twig_SimpleFilter('serialize', [SerializerRuntimeHelper::class, 'serialize']), | ||
new TwigFilter('serialize', [SerializerRuntimeHelper::class, 'serialize']), | ||
]; | ||
} | ||
|
||
/** | ||
* @return \Twig_Function[] | ||
* @return TwigFunction[] | ||
* | ||
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint | ||
*/ | ||
public function getFunctions() | ||
{ | ||
return [ | ||
new \Twig_SimpleFunction('serialization_context', '\JMS\Serializer\SerializationContext::create'), | ||
new TwigFunction('serialization_context', '\JMS\Serializer\SerializationContext::create'), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters