Skip to content

Commit ae105b3

Browse files
committed
minor #3862 Fix callable phpdoc for twig elements (VincentLanglet)
This PR was merged into the 3.x branch. Discussion ---------- Fix callable phpdoc for twig elements Hi `@fabpot` I made a stupid mistake in #3856 The correct phpdoc is `array{class-string, string}` and not `array<class-string, string>`. Code is used this way ``` $compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1])); ``` which means the key 0 is a class string, and the key 1 is a string. `array{class-string, string}` is same as `array{0: class-string, 1: string}` `array<class-string, string>` is saying all the keys are class-string, and values are string. Commits ------- 1b58589 Fix callable phpdoc
2 parents 9a9580f + 1b58589 commit ae105b3

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/TwigFilter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class TwigFilter
2929
private $arguments = [];
3030

3131
/**
32-
* @param callable|array<class-string, string>|null $callable A callable implementing the filter. If null, you need to overwrite the "node_class" option to customize compilation.
32+
* @param callable|array{class-string, string}|null $callable A callable implementing the filter. If null, you need to overwrite the "node_class" option to customize compilation.
3333
*/
3434
public function __construct(string $name, $callable = null, array $options = [])
3535
{
@@ -57,7 +57,7 @@ public function getName(): string
5757
/**
5858
* Returns the callable to execute for this filter.
5959
*
60-
* @return callable|array<class-string, string>|null
60+
* @return callable|array{class-string, string}|null
6161
*/
6262
public function getCallable()
6363
{

src/TwigFunction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class TwigFunction
2929
private $arguments = [];
3030

3131
/**
32-
* @param callable|array<class-string, string>|null $callable A callable implementing the function. If null, you need to overwrite the "node_class" option to customize compilation.
32+
* @param callable|array{class-string, string}|null $callable A callable implementing the function. If null, you need to overwrite the "node_class" option to customize compilation.
3333
*/
3434
public function __construct(string $name, $callable = null, array $options = [])
3535
{
@@ -55,7 +55,7 @@ public function getName(): string
5555
/**
5656
* Returns the callable to execute for this function.
5757
*
58-
* @return callable|array<class-string, string>|null
58+
* @return callable|array{class-string, string}|null
5959
*/
6060
public function getCallable()
6161
{

src/TwigTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class TwigTest
2828
private $arguments = [];
2929

3030
/**
31-
* @param callable|array<class-string, string>|null $callable A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation.
31+
* @param callable|array{class-string, string}|null $callable A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation.
3232
*/
3333
public function __construct(string $name, $callable = null, array $options = [])
3434
{
@@ -51,7 +51,7 @@ public function getName(): string
5151
/**
5252
* Returns the callable to execute for this test.
5353
*
54-
* @return callable|array<class-string, string>|null
54+
* @return callable|array{class-string, string}|null
5555
*/
5656
public function getCallable()
5757
{

0 commit comments

Comments
 (0)