Merge branch '3.x' into 4.x

* 3.x:
  Fix CS
This commit is contained in:
Fabien Potencier
2024-11-30 09:43:08 +01:00
8 changed files with 15 additions and 17 deletions
+1
View File
@@ -82,6 +82,7 @@ final class StringExtension extends AbstractExtension
if (!class_exists(SpanishInflector::class)) {
throw new RuntimeError('SpanishInflector is not available.');
}
return $this->spanishInflector ?? $this->spanishInflector = new SpanishInflector();
case 'fr':
return $this->frenchInflector ?? $this->frenchInflector = new FrenchInflector();
+3 -6
View File
@@ -814,10 +814,8 @@ class ExpressionParser
$token = $stream->next();
if (
Token::NAME_TYPE == $token->getType()
||
Token::NUMBER_TYPE == $token->getType()
||
(Token::OPERATOR_TYPE == $token->getType() && preg_match(Lexer::REGEX_NAME, $token->getValue()))
|| Token::NUMBER_TYPE == $token->getType()
|| (Token::OPERATOR_TYPE == $token->getType() && preg_match(Lexer::REGEX_NAME, $token->getValue()))
) {
$attribute = new ConstantExpression($token->getValue(), $token->getLine());
} else {
@@ -835,8 +833,7 @@ class ExpressionParser
&&
(
null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))
||
'_self' === $node->getAttribute('name') && $attribute instanceof ConstantExpression
|| '_self' === $node->getAttribute('name') && $attribute instanceof ConstantExpression
)
) {
return new MacroReferenceExpression(new TemplateVariable($node->getAttribute('name'), $node->getTemplateLine()), 'macro_'.$attribute->getAttribute('value'), $arguments, $node->getTemplateLine());
+5 -5
View File
@@ -528,8 +528,8 @@ final class CoreExtension extends AbstractExtension
* {# do something #}
* {% endif %}
*
* @param \DateTimeInterface|string|int|null $date A date, a timestamp or null to use the current time
* @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged
* @param \DateTimeInterface|string|int|null $date A date, a timestamp or null to use the current time
* @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged
*/
public function convertDate($date = null, $timezone = null): \DateTimeImmutable
{
@@ -778,9 +778,9 @@ final class CoreExtension extends AbstractExtension
* {{ [1, 2, 3]|join }}
* {# returns 123 #}
*
* @param iterable|array|string|float|int|bool|null $value An array
* @param string $glue The separator
* @param string|null $and The separator for the last pair
* @param iterable|array|string|float|int|bool|null $value An array
* @param string $glue The separator
* @param string|null $and The separator for the last pair
*
* @internal
*/
+1 -1
View File
@@ -35,7 +35,7 @@ class FilesystemLoader implements LoaderInterface
/**
* @param string|string[] $paths A path or an array of paths where to look for templates
* @param string|null $rootPath The root path common to all relative paths (null for getcwd())
* @param string|null $rootPath The root path common to all relative paths (null for getcwd())
*/
public function __construct($paths = [], ?string $rootPath = null)
{
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Twig\Node\Expression;
namespace Twig\Node\Expression;
/**
* Interface implemented by n-ary operators for n > 1.
+2 -2
View File
@@ -237,9 +237,9 @@ final class ModuleNode extends Node
->string($key)
->raw(\sprintf(']; unset($_trait_%s_blocks[', $i))
->string($key)
->raw("]); \$this->traitAliases[")
->raw(']); $this->traitAliases[')
->subcompile($value)
->raw("] = ")
->raw('] = ')
->string($key)
->raw(";\n\n")
;
+1 -1
View File
@@ -197,7 +197,7 @@ class LexerTest extends TestCase
EOF,
"\x6",
];
yield [
yield [
<<<'EOF'
{{ '\065\x64' }}
EOF,
+1 -1
View File
@@ -124,4 +124,4 @@ EOF
class NodeForTest extends Node
{
}
}