Skip to content

Commit 592b3e0

Browse files
Merge branch '3.4' into 4.4
* 3.4: Skip Doctrine DBAL on php 8 until we have a compatible version. [DomCrawler] Catch expected ValueError. [Validator] Catch expected ValueError. [VarDumper] ReflectionFunction::isDisabled() is deprecated. [PropertyAccess] Parse php 8 TypeErrors correctly. [Intl] Fix call to ReflectionProperty::getValue() for static properties. [HttpKernel] Prevent calling method_exists() with non-string values. [Debug] php 8 does not pass $context to error handlers. [Config] Removed implicit cast of ReflectionProperty to string. [Debug] Undefined variables raise a warning in php 8. [Debug] Skip test that would trigger a fatal error on php 8. Address deprecation of ReflectionType::getClass(). Properties $originalName and $mimeType are never null in UploadedFile
2 parents ade3d89 + 3b9fe6d commit 592b3e0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

OptionsResolver.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function setDefault($option, $value)
180180
$reflClosure = new \ReflectionFunction($value);
181181
$params = $reflClosure->getParameters();
182182

183-
if (isset($params[0]) && null !== ($class = $params[0]->getClass()) && Options::class === $class->name) {
183+
if (isset($params[0]) && Options::class === $this->getParameterClassName($params[0])) {
184184
// Initialize the option if no previous value exists
185185
if (!isset($this->defaults[$option])) {
186186
$this->defaults[$option] = null;
@@ -1217,4 +1217,13 @@ private function formatOptions(array $options): string
12171217

12181218
return implode('", "', $options);
12191219
}
1220+
1221+
private function getParameterClassName(\ReflectionParameter $parameter): ?string
1222+
{
1223+
if (!($type = $parameter->getType()) || $type->isBuiltin()) {
1224+
return null;
1225+
}
1226+
1227+
return $type->getName();
1228+
}
12201229
}

0 commit comments

Comments
 (0)