mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-28 04:58:46 +02:00
Re-dump autoloader and composer.lock
This commit is contained in:
@@ -66,7 +66,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
|
||||
if ('key' === $prefix) {
|
||||
if (false === $i) {
|
||||
throw new RuntimeException(sprintf('Invalid env "key:%s": a key specifier should be provided.', $name));
|
||||
throw new RuntimeException(\sprintf('Invalid env "key:%s": a key specifier should be provided.', $name));
|
||||
}
|
||||
|
||||
$next = substr($name, $i + 1);
|
||||
@@ -74,11 +74,11 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
$array = $getEnv($next);
|
||||
|
||||
if (!\is_array($array)) {
|
||||
throw new RuntimeException(sprintf('Resolved value of "%s" did not result in an array value.', $next));
|
||||
throw new RuntimeException(\sprintf('Resolved value of "%s" did not result in an array value.', $next));
|
||||
}
|
||||
|
||||
if (!isset($array[$key]) && !\array_key_exists($key, $array)) {
|
||||
throw new EnvNotFoundException(sprintf('Key "%s" not found in %s (resolved from "%s").', $key, json_encode($array), $next));
|
||||
throw new EnvNotFoundException(\sprintf('Key "%s" not found in %s (resolved from "%s").', $key, json_encode($array), $next));
|
||||
}
|
||||
|
||||
return $array[$key];
|
||||
@@ -86,7 +86,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
|
||||
if ('enum' === $prefix) {
|
||||
if (false === $i) {
|
||||
throw new RuntimeException(sprintf('Invalid env "enum:%s": a "%s" class-string should be provided.', $name, \BackedEnum::class));
|
||||
throw new RuntimeException(\sprintf('Invalid env "enum:%s": a "%s" class-string should be provided.', $name, \BackedEnum::class));
|
||||
}
|
||||
|
||||
$next = substr($name, $i + 1);
|
||||
@@ -94,14 +94,14 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
$backedEnumValue = $getEnv($next);
|
||||
|
||||
if (!\is_string($backedEnumValue) && !\is_int($backedEnumValue)) {
|
||||
throw new RuntimeException(sprintf('Resolved value of "%s" did not result in a string or int value.', $next));
|
||||
throw new RuntimeException(\sprintf('Resolved value of "%s" did not result in a string or int value.', $next));
|
||||
}
|
||||
|
||||
if (!is_subclass_of($backedEnumClassName, \BackedEnum::class)) {
|
||||
throw new RuntimeException(sprintf('"%s" is not a "%s".', $backedEnumClassName, \BackedEnum::class));
|
||||
throw new RuntimeException(\sprintf('"%s" is not a "%s".', $backedEnumClassName, \BackedEnum::class));
|
||||
}
|
||||
|
||||
return $backedEnumClassName::tryFrom($backedEnumValue) ?? throw new RuntimeException(sprintf('Enum value "%s" is not backed by "%s".', $backedEnumValue, $backedEnumClassName));
|
||||
return $backedEnumClassName::tryFrom($backedEnumValue) ?? throw new RuntimeException(\sprintf('Enum value "%s" is not backed by "%s".', $backedEnumValue, $backedEnumClassName));
|
||||
}
|
||||
|
||||
if ('defined' === $prefix) {
|
||||
@@ -114,14 +114,14 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
|
||||
if ('default' === $prefix) {
|
||||
if (false === $i) {
|
||||
throw new RuntimeException(sprintf('Invalid env "default:%s": a fallback parameter should be provided.', $name));
|
||||
throw new RuntimeException(\sprintf('Invalid env "default:%s": a fallback parameter should be provided.', $name));
|
||||
}
|
||||
|
||||
$next = substr($name, $i + 1);
|
||||
$default = substr($name, 0, $i);
|
||||
|
||||
if ('' !== $default && !$this->container->hasParameter($default)) {
|
||||
throw new RuntimeException(sprintf('Invalid env fallback in "default:%s": parameter "%s" not found.', $name, $default));
|
||||
throw new RuntimeException(\sprintf('Invalid env fallback in "default:%s": parameter "%s" not found.', $name, $default));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -139,10 +139,10 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
|
||||
if ('file' === $prefix || 'require' === $prefix) {
|
||||
if (!\is_scalar($file = $getEnv($name))) {
|
||||
throw new RuntimeException(sprintf('Invalid file name: env var "%s" is non-scalar.', $name));
|
||||
throw new RuntimeException(\sprintf('Invalid file name: env var "%s" is non-scalar.', $name));
|
||||
}
|
||||
if (!is_file($file)) {
|
||||
throw new EnvNotFoundException(sprintf('File "%s" not found (resolved from "%s").', $file, $name));
|
||||
throw new EnvNotFoundException(\sprintf('File "%s" not found (resolved from "%s").', $file, $name));
|
||||
}
|
||||
|
||||
if ('file' === $prefix) {
|
||||
@@ -214,7 +214,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
|
||||
if (false === $env) {
|
||||
if (!$this->container->hasParameter("env($name)")) {
|
||||
throw new EnvNotFoundException(sprintf('Environment variable not found: "%s".', $name));
|
||||
throw new EnvNotFoundException(\sprintf('Environment variable not found: "%s".', $name));
|
||||
}
|
||||
|
||||
$env = $this->container->getParameter("env($name)");
|
||||
@@ -227,7 +227,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
}
|
||||
|
||||
if (!isset($this->getProvidedTypes()[$prefix])) {
|
||||
throw new RuntimeException(sprintf('Unsupported env var prefix "%s".', $prefix));
|
||||
throw new RuntimeException(\sprintf('Unsupported env var prefix "%s".', $prefix));
|
||||
}
|
||||
|
||||
if (!\in_array($prefix, ['string', 'bool', 'not', 'int', 'float'], true)) {
|
||||
@@ -236,13 +236,13 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
}
|
||||
|
||||
if ('shuffle' === $prefix) {
|
||||
\is_array($env) ? shuffle($env) : throw new RuntimeException(sprintf('Env var "%s" cannot be shuffled, expected array, got "%s".', $name, get_debug_type($env)));
|
||||
\is_array($env) ? shuffle($env) : throw new RuntimeException(\sprintf('Env var "%s" cannot be shuffled, expected array, got "%s".', $name, get_debug_type($env)));
|
||||
|
||||
return $env;
|
||||
}
|
||||
|
||||
if (null !== $env && !\is_scalar($env)) {
|
||||
throw new RuntimeException(sprintf('Non-scalar env var "%s" cannot be cast to "%s".', $name, $prefix));
|
||||
throw new RuntimeException(\sprintf('Non-scalar env var "%s" cannot be cast to "%s".', $name, $prefix));
|
||||
}
|
||||
|
||||
if ('string' === $prefix) {
|
||||
@@ -257,7 +257,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
|
||||
if ('int' === $prefix) {
|
||||
if (null !== $env && false === $env = filter_var($env, \FILTER_VALIDATE_INT) ?: filter_var($env, \FILTER_VALIDATE_FLOAT)) {
|
||||
throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to int.', $name));
|
||||
throw new RuntimeException(\sprintf('Non-numeric env var "%s" cannot be cast to int.', $name));
|
||||
}
|
||||
|
||||
return (int) $env;
|
||||
@@ -265,7 +265,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
|
||||
if ('float' === $prefix) {
|
||||
if (null !== $env && false === $env = filter_var($env, \FILTER_VALIDATE_FLOAT)) {
|
||||
throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to float.', $name));
|
||||
throw new RuntimeException(\sprintf('Non-numeric env var "%s" cannot be cast to float.', $name));
|
||||
}
|
||||
|
||||
return (float) $env;
|
||||
@@ -273,7 +273,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
|
||||
if ('const' === $prefix) {
|
||||
if (!\defined($env)) {
|
||||
throw new RuntimeException(sprintf('Env var "%s" maps to undefined constant "%s".', $name, $env));
|
||||
throw new RuntimeException(\sprintf('Env var "%s" maps to undefined constant "%s".', $name, $env));
|
||||
}
|
||||
|
||||
return \constant($env);
|
||||
@@ -287,11 +287,11 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
$env = json_decode($env, true);
|
||||
|
||||
if (\JSON_ERROR_NONE !== json_last_error()) {
|
||||
throw new RuntimeException(sprintf('Invalid JSON in env var "%s": ', $name).json_last_error_msg());
|
||||
throw new RuntimeException(\sprintf('Invalid JSON in env var "%s": ', $name).json_last_error_msg());
|
||||
}
|
||||
|
||||
if (null !== $env && !\is_array($env)) {
|
||||
throw new RuntimeException(sprintf('Invalid JSON env var "%s": array or null expected, "%s" given.', $name, get_debug_type($env)));
|
||||
throw new RuntimeException(\sprintf('Invalid JSON env var "%s": array or null expected, "%s" given.', $name, get_debug_type($env)));
|
||||
}
|
||||
|
||||
return $env;
|
||||
@@ -301,10 +301,10 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
$params = parse_url($env);
|
||||
|
||||
if (false === $params) {
|
||||
throw new RuntimeException(sprintf('Invalid URL in env var "%s".', $name));
|
||||
throw new RuntimeException(\sprintf('Invalid URL in env var "%s".', $name));
|
||||
}
|
||||
if (!isset($params['scheme'], $params['host'])) {
|
||||
throw new RuntimeException(sprintf('Invalid URL in env var "%s": scheme and host expected.', $name));
|
||||
throw new RuntimeException(\sprintf('Invalid URL in env var "%s": scheme and host expected.', $name));
|
||||
}
|
||||
$params += [
|
||||
'port' => null,
|
||||
@@ -344,7 +344,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
}
|
||||
|
||||
if (!\is_scalar($value)) {
|
||||
throw new RuntimeException(sprintf('Parameter "%s" found when resolving env var "%s" must be scalar, "%s" given.', $match[1], $name, get_debug_type($value)));
|
||||
throw new RuntimeException(\sprintf('Parameter "%s" found when resolving env var "%s" must be scalar, "%s" given.', $match[1], $name, get_debug_type($value)));
|
||||
}
|
||||
|
||||
return $value;
|
||||
@@ -359,6 +359,6 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
return trim($env);
|
||||
}
|
||||
|
||||
throw new RuntimeException(sprintf('Unsupported env var prefix "%s" for env name "%s".', $prefix, $name));
|
||||
throw new RuntimeException(\sprintf('Unsupported env var prefix "%s" for env name "%s".', $prefix, $name));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user