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

@@ -28,6 +28,7 @@ class CheckCircularReferencesPass implements CompilerPassInterface
{
private array $currentPath;
private array $checkedNodes;
private array $checkedLazyNodes;
/**
* Checks the ContainerBuilder object for circular references.
@@ -59,22 +60,36 @@ class CheckCircularReferencesPass implements CompilerPassInterface
$node = $edge->getDestNode();
$id = $node->getId();
if (empty($this->checkedNodes[$id])) {
// Don't check circular references for lazy edges
if (!$node->getValue() || (!$edge->isLazy() && !$edge->isWeak())) {
$searchKey = array_search($id, $this->currentPath);
$this->currentPath[] = $id;
if (!empty($this->checkedNodes[$id])) {
continue;
}
if (false !== $searchKey) {
throw new ServiceCircularReferenceException($id, \array_slice($this->currentPath, $searchKey));
}
$isLeaf = (bool) $node->getValue();
$isConcrete = !$edge->isLazy() && !$edge->isWeak();
$this->checkOutEdges($node->getOutEdges());
// Skip already checked lazy services if they are still lazy. Will not gain any new information.
if (!empty($this->checkedLazyNodes[$id]) && (!$isLeaf || !$isConcrete)) {
continue;
}
// Process concrete references, otherwise defer check circular references for lazy edges.
if (!$isLeaf || $isConcrete) {
$searchKey = array_search($id, $this->currentPath);
$this->currentPath[] = $id;
if (false !== $searchKey) {
throw new ServiceCircularReferenceException($id, \array_slice($this->currentPath, $searchKey));
}
$this->checkOutEdges($node->getOutEdges());
$this->checkedNodes[$id] = true;
array_pop($this->currentPath);
unset($this->checkedLazyNodes[$id]);
} else {
$this->checkedLazyNodes[$id] = true;
}
array_pop($this->currentPath);
}
}
}