mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 14:38:47 +02:00
Re-dump autoloader and composer.lock
This commit is contained in:
@@ -28,19 +28,19 @@ final class ProxyHelper
|
||||
public static function generateLazyGhost(\ReflectionClass $class): string
|
||||
{
|
||||
if (\PHP_VERSION_ID >= 80200 && \PHP_VERSION_ID < 80300 && $class->isReadOnly()) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy ghost with PHP < 8.3: class "%s" is readonly.', $class->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy ghost with PHP < 8.3: class "%s" is readonly.', $class->name));
|
||||
}
|
||||
if ($class->isFinal()) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy ghost: class "%s" is final.', $class->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy ghost: class "%s" is final.', $class->name));
|
||||
}
|
||||
if ($class->isInterface() || $class->isAbstract() || $class->isTrait()) {
|
||||
throw new LogicException(\sprintf('Cannot generate lazy ghost: "%s" is not a concrete class.', $class->name));
|
||||
}
|
||||
if (\stdClass::class !== $class->name && $class->isInternal()) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy ghost: class "%s" is internal.', $class->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy ghost: class "%s" is internal.', $class->name));
|
||||
}
|
||||
if ($class->hasMethod('__get') && 'mixed' !== (self::exportType($class->getMethod('__get')) ?? 'mixed')) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy ghost: return type of method "%s::__get()" should be "mixed".', $class->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy ghost: return type of method "%s::__get()" should be "mixed".', $class->name));
|
||||
}
|
||||
|
||||
static $traitMethods;
|
||||
@@ -48,14 +48,14 @@ final class ProxyHelper
|
||||
|
||||
foreach ($traitMethods as $method) {
|
||||
if ($class->hasMethod($method->name) && $class->getMethod($method->name)->isFinal()) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy ghost: method "%s::%s()" is final.', $class->name, $method->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy ghost: method "%s::%s()" is final.', $class->name, $method->name));
|
||||
}
|
||||
}
|
||||
|
||||
$parent = $class;
|
||||
while ($parent = $parent->getParentClass()) {
|
||||
if (\stdClass::class !== $parent->name && $parent->isInternal()) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy ghost: class "%s" extends "%s" which is internal.', $class->name, $parent->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy ghost: class "%s" extends "%s" which is internal.', $class->name, $parent->name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ final class ProxyHelper
|
||||
}
|
||||
|
||||
if ($flags & (\ReflectionProperty::IS_FINAL | \ReflectionProperty::IS_PRIVATE)) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy ghost: property "%s::$%s" is final or private(set).', $class->name, $name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy ghost: property "%s::$%s" is final or private(set).', $class->name, $name));
|
||||
}
|
||||
|
||||
$p = $propertyScopes[$k][4] ?? Hydrator::$propertyScopes[$class->name][$k][4] = new \ReflectionProperty($scope, $name);
|
||||
@@ -92,7 +92,7 @@ final class ProxyHelper
|
||||
$arg = '$'.$method->getParameters()[0]->name;
|
||||
$hooks .= " set({$parameters}) { \$this->initializeLazyObject(); parent::\${$name}::set({$arg}); }\n";
|
||||
} else {
|
||||
throw new LogicException(sprintf('Cannot generate lazy ghost: hook "%s::%s()" is not supported.', $class->name, $method->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy ghost: hook "%s::%s()" is not supported.', $class->name, $method->name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,13 +127,13 @@ final class ProxyHelper
|
||||
public static function generateLazyProxy(?\ReflectionClass $class, array $interfaces = []): string
|
||||
{
|
||||
if (!class_exists($class?->name ?? \stdClass::class, false)) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy proxy: "%s" is not a class.', $class->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy proxy: "%s" is not a class.', $class->name));
|
||||
}
|
||||
if ($class?->isFinal()) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy proxy: class "%s" is final.', $class->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy proxy: class "%s" is final.', $class->name));
|
||||
}
|
||||
if (\PHP_VERSION_ID >= 80200 && \PHP_VERSION_ID < 80300 && $class?->isReadOnly()) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy proxy with PHP < 8.3: class "%s" is readonly.', $class->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy proxy with PHP < 8.3: class "%s" is readonly.', $class->name));
|
||||
}
|
||||
|
||||
$propertyScopes = $class ? Hydrator::$propertyScopes[$class->name] ??= Hydrator::getPropertyScopes($class->name) : [];
|
||||
@@ -159,7 +159,7 @@ final class ProxyHelper
|
||||
}
|
||||
|
||||
if ($flags & (\ReflectionProperty::IS_FINAL | \ReflectionProperty::IS_PRIVATE)) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy proxy: property "%s::$%s" is final or private(set).', $class->name, $name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy proxy: property "%s::$%s" is final or private(set).', $class->name, $name));
|
||||
}
|
||||
|
||||
$p = $propertyScopes[$k][4] ?? Hydrator::$propertyScopes[$class->name][$k][4] = new \ReflectionProperty($scope, $name);
|
||||
@@ -170,7 +170,7 @@ final class ProxyHelper
|
||||
$methodReflectors = [$class?->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) ?? []];
|
||||
foreach ($interfaces as $interface) {
|
||||
if (!$interface->isInterface()) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy proxy: "%s" is not an interface.', $interface->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy proxy: "%s" is not an interface.', $interface->name));
|
||||
}
|
||||
$methodReflectors[] = $interface->getMethods();
|
||||
|
||||
@@ -228,7 +228,7 @@ final class ProxyHelper
|
||||
|
||||
EOPHP;
|
||||
} else {
|
||||
throw new LogicException(sprintf('Cannot generate lazy proxy: hook "%s::%s()" is not supported.', $class->name, $method->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy proxy: hook "%s::%s()" is not supported.', $class->name, $method->name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ final class ProxyHelper
|
||||
}
|
||||
if ($method->isFinal()) {
|
||||
if ($extendsInternalClass || $methodsHaveToBeProxied || method_exists(LazyProxyTrait::class, $method->name)) {
|
||||
throw new LogicException(sprintf('Cannot generate lazy proxy: method "%s::%s()" is final.', $class->name, $method->name));
|
||||
throw new LogicException(\sprintf('Cannot generate lazy proxy: method "%s::%s()" is final.', $class->name, $method->name));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -396,7 +396,7 @@ final class ProxyHelper
|
||||
$args = substr($args, 0, -2);
|
||||
} else {
|
||||
$args = explode(', ', $args, 1 + $byRefIndex);
|
||||
$args[$byRefIndex] = sprintf('...\array_slice(\func_get_args(), %d)', $byRefIndex);
|
||||
$args[$byRefIndex] = \sprintf('...\array_slice(\func_get_args(), %d)', $byRefIndex);
|
||||
$args = implode(', ', $args);
|
||||
}
|
||||
|
||||
@@ -477,7 +477,9 @@ final class ProxyHelper
|
||||
return '';
|
||||
}
|
||||
if (null === $glue) {
|
||||
return (!$noBuiltin && $type->allowsNull() && !\in_array($name, ['mixed', 'null'], true) ? '?' : '').$types[0];
|
||||
$defaultNull = $owner instanceof \ReflectionParameter && 'NULL' === rtrim(substr(explode('$'.$owner->name.' = ', (string) $owner, 2)[1] ?? '', 0, -2));
|
||||
|
||||
return (!$noBuiltin && ($type->allowsNull() || $defaultNull) && !\in_array($name, ['mixed', 'null'], true) ? '?' : '').$types[0];
|
||||
}
|
||||
sort($types);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user