Skip to content

Commit

Permalink
minor #4485 Update phpdoc for operators (VincentLanglet)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.x branch.

Discussion
----------

Update phpdoc for operators

Commits
-------

fab565c Update phpdoc for operators
  • Loading branch information
fabpot committed Nov 29, 2024
2 parents d1d8e3c + fab565c commit 3eed037
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ public function mergeGlobals(array $context): array
/**
* @internal
*
* @return array<string, array{precedence: int, class: class-string<AbstractUnary>}>
* @return array<string, array{precedence: int, precedence_change?: OperatorPrecedenceChange, class: class-string<AbstractUnary>}>
*/
public function getUnaryOperators(): array
{
Expand All @@ -873,7 +873,7 @@ public function getUnaryOperators(): array
/**
* @internal
*
* @return array<string, array{precedence: int, class: class-string<AbstractBinary>, associativity: ExpressionParser::OPERATOR_*}>
* @return array<string, array{precedence: int, precedence_change?: OperatorPrecedenceChange, class: class-string<AbstractBinary>, associativity: ExpressionParser::OPERATOR_*}>
*/
public function getBinaryOperators(): array
{
Expand Down
7 changes: 4 additions & 3 deletions src/Extension/ExtensionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
namespace Twig\Extension;

use Twig\ExpressionParser;
use Twig\Node\Expression\AbstractExpression;
use Twig\Node\Expression\Binary\AbstractBinary;
use Twig\Node\Expression\Unary\AbstractUnary;
use Twig\NodeVisitor\NodeVisitorInterface;
use Twig\OperatorPrecedenceChange;
use Twig\TokenParser\TokenParserInterface;
Expand Down Expand Up @@ -68,8 +69,8 @@ public function getFunctions();
* @return array<array> First array of unary operators, second array of binary operators
*
* @psalm-return array{
* array<string, array{precedence: int, precedence_change?: OperatorPrecedenceChange, class: class-string<AbstractExpression>}>,
* array<string, array{precedence: int, precedence_change?: OperatorPrecedenceChange, class?: class-string<AbstractExpression>, associativity: ExpressionParser::OPERATOR_*}>
* array<string, array{precedence: int, precedence_change?: OperatorPrecedenceChange, class: class-string<AbstractUnary>}>,
* array<string, array{precedence: int, precedence_change?: OperatorPrecedenceChange, class?: class-string<AbstractBinary>, associativity: ExpressionParser::OPERATOR_*}>
* }
*/
public function getOperators();
Expand Down
11 changes: 6 additions & 5 deletions src/ExtensionSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
use Twig\Extension\ExtensionInterface;
use Twig\Extension\GlobalsInterface;
use Twig\Extension\StagingExtension;
use Twig\Node\Expression\AbstractExpression;
use Twig\Node\Expression\Binary\AbstractBinary;
use Twig\Node\Expression\Unary\AbstractUnary;
use Twig\NodeVisitor\NodeVisitorInterface;
use Twig\TokenParser\TokenParserInterface;

Expand Down Expand Up @@ -44,9 +45,9 @@ final class ExtensionSet
private $functions;
/** @var array<string, TwigFunction> */
private $dynamicFunctions;
/** @var array<string, array{precedence: int, class: class-string<AbstractExpression>}> */
/** @var array<string, array{precedence: int, precedence_change?: OperatorPrecedenceChange, class: class-string<AbstractUnary>}> */
private $unaryOperators;
/** @var array<string, array{precedence: int, class?: class-string<AbstractExpression>, associativity: ExpressionParser::OPERATOR_*}> */
/** @var array<string, array{precedence: int, precedence_change?: OperatorPrecedenceChange, class?: class-string<AbstractBinary>, associativity: ExpressionParser::OPERATOR_*}> */
private $binaryOperators;
/** @var array<string, mixed>|null */
private $globals;
Expand Down Expand Up @@ -385,7 +386,7 @@ public function getTest(string $name): ?TwigTest
}

/**
* @return array<string, array{precedence: int, class: class-string<AbstractExpression>}>
* @return array<string, array{precedence: int, precedence_change?: OperatorPrecedenceChange, class: class-string<AbstractUnary>}>
*/
public function getUnaryOperators(): array
{
Expand All @@ -397,7 +398,7 @@ public function getUnaryOperators(): array
}

/**
* @return array<string, array{precedence: int, class?: class-string<AbstractExpression>, associativity: ExpressionParser::OPERATOR_*}>
* @return array<string, array{precedence: int, precedence_change?: OperatorPrecedenceChange, class?: class-string<AbstractBinary>, associativity: ExpressionParser::OPERATOR_*}>
*/
public function getBinaryOperators(): array
{
Expand Down

0 comments on commit 3eed037

Please sign in to comment.