1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
<?php
namespace Twig\Tests\Extension\Fixtures;
use Twig\Attribute\AsTwigFilter;
use Twig\Attribute\AsTwigFunction;
use Twig\Attribute\AsTwigTest;
use Twig\DeprecatedCallableInfo;
use Twig\Environment;
class ExtensionWithAttributes
{
#[AsTwigFilter(name: 'foo', isSafe: ['html'])]
public function fooFilter(string|int $string)
{
}
#[AsTwigFilter('with_context_filter', needsContext: true)]
public function withContextFilter(array $context, string $string)
{
}
#[AsTwigFilter('with_env_filter')]
public function withEnvFilter(Environment $env, string $string)
{
}
#[AsTwigFilter('with_env_and_context_filter', needsContext: true)]
public function withEnvAndContextFilter(Environment $env, array $context, array $data)
{
}
#[AsTwigFilter('variadic_filter')]
public function variadicFilter(string ...$strings)
{
}
#[AsTwigFilter('deprecated_filter', deprecationInfo: new DeprecatedCallableInfo('foo/bar', '1.2'))]
public function deprecatedFilter(string $string)
{
}
#[AsTwigFilter('pattern_*_filter')]
public function patternFilter(string $string)
{
}
#[AsTwigFunction(name: 'foo', isSafe: ['html'])]
public function fooFunction(string|int $string)
{
}
#[AsTwigFunction('with_context_function', needsContext: true)]
public function withContextFunction(array $context, string $string)
{
}
#[AsTwigFunction('with_env_function')]
public function withEnvFunction(Environment $env, string $string)
{
}
#[AsTwigFunction('with_env_and_context_function', needsContext: true)]
public function withEnvAndContextFunction(Environment $env, array $context, string $string)
{
}
#[AsTwigFunction('no_arg_function')]
public function noArgFunction()
{
}
#[AsTwigFunction('variadic_function')]
public function variadicFunction(string ...$strings)
{
}
#[AsTwigFunction('deprecated_function', deprecationInfo: new DeprecatedCallableInfo('foo/bar', '1.2'))]
public function deprecatedFunction(string $string)
{
}
#[AsTwigTest(name: 'foo')]
public function fooTest(string|int $value)
{
}
#[AsTwigTest('variadic_test')]
public function variadicTest(string ...$value)
{
}
#[AsTwigTest('with_context_test', needsContext: true)]
public function withContextTest(array $context, $argument)
{
}
#[AsTwigTest('with_env_test')]
public function withEnvTest(Environment $env, $argument)
{
}
#[AsTwigTest('with_env_and_context_test', needsContext: true)]
public function withEnvAndContextTest(Environment $env, array $context, $argument)
{
}
#[AsTwigTest('deprecated_test', deprecationInfo: new DeprecatedCallableInfo('foo/bar', '1.2'))]
public function deprecatedTest($value, $argument)
{
}
}
|