Merge branch '5.0' into 5.1

* 5.0:
  [DI] fix
  Use "composer/package-versions-deprecated" when possible
  Fix
This commit is contained in:
Nicolas Grekas 2020-06-18 21:54:27 +02:00
commit eea6abf318
5 changed files with 7 additions and 3 deletions

View File

@ -107,6 +107,7 @@
"async-aws/ses": "^1.0",
"async-aws/sqs": "^1.0",
"cache/integration-tests": "dev-master",
"composer/package-versions-deprecated": "^1.8",
"doctrine/annotations": "~1.0",
"doctrine/cache": "~1.6",
"doctrine/collections": "~1.0",

View File

@ -25,6 +25,7 @@
"symfony/service-contracts": "^1.1|^2"
},
"require-dev": {
"composer/package-versions-deprecated": "^1.8",
"symfony/stopwatch": "^4.4|^5.0",
"symfony/cache": "^5.1",
"symfony/config": "^4.4|^5.0",

View File

@ -23,7 +23,8 @@ class InvalidParameterTypeException extends InvalidArgumentException
{
$acceptedType = $parameter->getType();
$acceptedType = $acceptedType instanceof \ReflectionNamedType ? $acceptedType->getName() : (string) $acceptedType;
$this->code = $type;
parent::__construct(sprintf('Invalid definition for service "%s": argument %d of "%s::%s" accepts "%s", "%s" passed.', $serviceId, 1 + $parameter->getPosition(), $parameter->getDeclaringClass()->getName(), $parameter->getDeclaringFunction()->getName(), $acceptedType, $type), $type);
parent::__construct(sprintf('Invalid definition for service "%s": argument %d of "%s::%s" accepts "%s", "%s" passed.', $serviceId, 1 + $parameter->getPosition(), $parameter->getDeclaringClass()->getName(), $parameter->getDeclaringFunction()->getName(), $acceptedType, $type));
}
}

View File

@ -45,10 +45,10 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
*/
private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbstract $function): ?string
{
if (!($type = $parameter->getType()) instanceof \ReflectionNamedType) {
if (!$type = $parameter->getType()) {
return null;
}
$name = $type->getName();
$name = $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type;
if ($function instanceof \ReflectionMethod) {
$lcName = strtolower($name);

View File

@ -47,6 +47,7 @@
]
},
"minimum-stability": "dev",
"version": "2.99",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"