Aggiornato Composer
This commit is contained in:
@@ -21,6 +21,7 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Prophecy\Prophecy\ProphecySubjectInterface;
|
||||
use ProxyManager\Proxy\ProxyInterface;
|
||||
use Symfony\Component\ErrorHandler\Internal\TentativeTypes;
|
||||
use Symfony\Component\HttpClient\HttplugClient;
|
||||
|
||||
/**
|
||||
* Autoloader checking if the class is really defined in the file found.
|
||||
@@ -56,7 +57,7 @@ class DebugClassLoader
|
||||
'null' => 'null',
|
||||
'resource' => 'resource',
|
||||
'boolean' => 'bool',
|
||||
'true' => 'bool',
|
||||
'true' => 'true',
|
||||
'false' => 'false',
|
||||
'integer' => 'int',
|
||||
'array' => 'array',
|
||||
@@ -73,6 +74,8 @@ class DebugClassLoader
|
||||
'static' => 'static',
|
||||
'$this' => 'static',
|
||||
'list' => 'array',
|
||||
'class-string' => 'string',
|
||||
'never' => 'never',
|
||||
];
|
||||
|
||||
private const BUILTIN_RETURN_TYPES = [
|
||||
@@ -90,6 +93,9 @@ class DebugClassLoader
|
||||
'parent' => true,
|
||||
'mixed' => true,
|
||||
'static' => true,
|
||||
'null' => true,
|
||||
'true' => true,
|
||||
'never' => true,
|
||||
];
|
||||
|
||||
private const MAGIC_METHODS = [
|
||||
@@ -295,7 +301,7 @@ class DebugClassLoader
|
||||
$this->checkClass($class, $file);
|
||||
}
|
||||
|
||||
private function checkClass(string $class, string $file = null): void
|
||||
private function checkClass(string $class, ?string $file = null): void
|
||||
{
|
||||
$exists = null === $file || class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false);
|
||||
|
||||
@@ -409,7 +415,9 @@ class DebugClassLoader
|
||||
if (!isset(self::$checkedClasses[$use])) {
|
||||
$this->checkClass($use);
|
||||
}
|
||||
if (isset(self::$deprecated[$use]) && strncmp($vendor, str_replace('_', '\\', $use), $vendorLen) && !isset(self::$deprecated[$class])) {
|
||||
if (isset(self::$deprecated[$use]) && strncmp($vendor, str_replace('_', '\\', $use), $vendorLen) && !isset(self::$deprecated[$class])
|
||||
&& !(HttplugClient::class === $class && \in_array($use, [\Http\Client\HttpClient::class, \Http\Message\RequestFactory::class, \Http\Message\StreamFactory::class, \Http\Message\UriFactory::class], true))
|
||||
) {
|
||||
$type = class_exists($class, false) ? 'class' : (interface_exists($class, false) ? 'interface' : 'trait');
|
||||
$verb = class_exists($use, false) || interface_exists($class, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses');
|
||||
|
||||
@@ -755,12 +763,18 @@ class DebugClassLoader
|
||||
return $ownInterfaces;
|
||||
}
|
||||
|
||||
private function setReturnType(string $types, string $class, string $method, string $filename, ?string $parent, \ReflectionType $returnType = null): void
|
||||
private function setReturnType(string $types, string $class, string $method, string $filename, ?string $parent, ?\ReflectionType $returnType = null): void
|
||||
{
|
||||
if ('__construct' === $method) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ('null' === $types) {
|
||||
self::$returnTypes[$class][$method] = ['null', 'null', $class, $filename];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($nullable = 0 === strpos($types, 'null|')) {
|
||||
$types = substr($types, 5);
|
||||
} elseif ($nullable = '|null' === substr($types, -5)) {
|
||||
@@ -1079,7 +1093,20 @@ EOTXT;
|
||||
}
|
||||
|
||||
$end = $method->isGenerator() ? $i : $method->getEndLine();
|
||||
$inClosure = false;
|
||||
$braces = 0;
|
||||
for (; $i < $end; ++$i) {
|
||||
if (!$inClosure) {
|
||||
$inClosure = false !== strpos($code[$i], 'function (');
|
||||
}
|
||||
|
||||
if ($inClosure) {
|
||||
$braces += substr_count($code[$i], '{') - substr_count($code[$i], '}');
|
||||
$inClosure = $braces > 0;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ('void' === $returnType) {
|
||||
$fixedCode[$i] = str_replace(' return null;', ' return;', $code[$i]);
|
||||
} elseif ('mixed' === $returnType || '?' === $returnType[0]) {
|
||||
|
||||
Reference in New Issue
Block a user