N°8834 - Add compatibility with PHP 8.4 (#819)

* N°8834 - Add compatibility with PHP 8.4

* Rollback of scssphp/scssphp version upgrade due to compilation error
This commit is contained in:
Lenaick
2026-02-26 10:36:32 +01:00
committed by GitHub
parent d4821b7edc
commit fc967c06ce
961 changed files with 12298 additions and 7130 deletions

View File

@@ -12,6 +12,7 @@
namespace Symfony\Bridge\Twig\Node;
use Twig\Compiler;
use Twig\Extension\CoreExtension;
use Twig\Node\Expression\ArrayExpression;
use Twig\Node\Expression\ConstantExpression;
use Twig\Node\Expression\FunctionExpression;
@@ -50,7 +51,7 @@ final class SearchAndRenderBlockNode extends FunctionExpression
$labelIsExpression = false;
// Only insert the label into the array if it is not empty
if (!twig_test_empty($label->getAttribute('value'))) {
if (null !== $label->getAttribute('value') && false !== $label->getAttribute('value') && '' !== (string) $label->getAttribute('value')) {
$originalVariables = $variables;
$variables = new ArrayExpression([], $lineno);
$labelKey = new ConstantExpression('label', $lineno);
@@ -97,7 +98,12 @@ final class SearchAndRenderBlockNode extends FunctionExpression
// Check at runtime whether the label is empty.
// If not, add it to the array at runtime.
$compiler->raw('(twig_test_empty($_label_ = ');
if (method_exists(CoreExtension::class, 'testEmpty')) {
$compiler->raw('(CoreExtension::testEmpty($_label_ = ');
} else {
$compiler->raw('(twig_test_empty($_label_ = ');
}
$compiler->subcompile($label);
$compiler->raw(') ? [] : ["label" => $_label_])');
}