Skip to content

Commit

Permalink
Merge branch '3.4' into 4.4
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nicolas-grekas committed May 23, 2020
2 parents ade3d89 + 3b9fe6d commit 592b3e0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion OptionsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function setDefault($option, $value)
$reflClosure = new \ReflectionFunction($value);
$params = $reflClosure->getParameters();

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

return implode('", "', $options);
}

private function getParameterClassName(\ReflectionParameter $parameter): ?string
{
if (!($type = $parameter->getType()) || $type->isBuiltin()) {
return null;
}

return $type->getName();
}
}

0 comments on commit 592b3e0

Please sign in to comment.