N°9319 increase php min. version to 8.2 (#887)

* Update minimum PHP version to 8.2
* Fix previous wrong resolution of merge conflict
This commit is contained in:
jf-cbd
2026-04-20 14:47:44 +02:00
committed by GitHub
parent f439490bfc
commit 805087a01b
171 changed files with 5629 additions and 1446 deletions

View File

@@ -1295,16 +1295,9 @@ EOF;
}
}
if (Container::class !== $this->baseClass) {
$r = $this->container->getReflectionClass($this->baseClass, false);
if (null !== $r
&& (null !== $constructor = $r->getConstructor())
&& 0 === $constructor->getNumberOfRequiredParameters()
&& Container::class !== $constructor->getDeclaringClass()->name
) {
$code .= " parent::__construct();\n";
$code .= " \$this->parameterBag = null;\n\n";
}
if ($this->needsUnsetParameterBag()) {
$code .= " parent::__construct();\n";
$code .= " unset(\$this->parameterBag);\n\n";
}
if ($this->container->getParameterBag()->all()) {
@@ -1582,9 +1575,22 @@ EOF;
return $code ? \sprintf("\n \$this->privates['service_container'] = static function (\$container) {%s\n };\n", $code) : '';
}
private function needsUnsetParameterBag(): bool
{
if (Container::class === $this->baseClass) {
return false;
}
$r = $this->container->getReflectionClass($this->baseClass, false);
return null !== $r
&& (null !== $constructor = $r->getConstructor())
&& 0 === $constructor->getNumberOfRequiredParameters()
&& Container::class !== $constructor->getDeclaringClass()->name;
}
private function addDefaultParametersMethod(): string
{
if (!$this->container->getParameterBag()->all()) {
if (!$this->container->getParameterBag()->all() && !$this->needsUnsetParameterBag()) {
return '';
}