mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -19,18 +19,20 @@ namespace Symfony\Component\Config\Exception;
|
||||
class LoaderLoadException extends \Exception
|
||||
{
|
||||
/**
|
||||
* @param string $resource The resource that could not be imported
|
||||
* @param mixed $resource The resource that could not be imported
|
||||
* @param string|null $sourceResource The original resource importing the new resource
|
||||
* @param int|null $code The error code
|
||||
* @param int $code The error code
|
||||
* @param \Throwable|null $previous A previous exception
|
||||
* @param string|null $type The type of resource
|
||||
*/
|
||||
public function __construct(string $resource, string $sourceResource = null, ?int $code = 0, \Throwable $previous = null, string $type = null)
|
||||
public function __construct(mixed $resource, string $sourceResource = null, int $code = 0, \Throwable $previous = null, string $type = null)
|
||||
{
|
||||
if (null === $code) {
|
||||
trigger_deprecation('symfony/config', '5.3', 'Passing null as $code to "%s()" is deprecated, pass 0 instead.', __METHOD__);
|
||||
|
||||
$code = 0;
|
||||
if (!\is_string($resource)) {
|
||||
try {
|
||||
$resource = json_encode($resource, \JSON_THROW_ON_ERROR);
|
||||
} catch (\JsonException) {
|
||||
$resource = sprintf('resource of type "%s"', get_debug_type($resource));
|
||||
}
|
||||
}
|
||||
|
||||
$message = '';
|
||||
@@ -38,7 +40,7 @@ class LoaderLoadException extends \Exception
|
||||
// Include the previous exception, to help the user see what might be the underlying cause
|
||||
|
||||
// Trim the trailing period of the previous message. We only want 1 period remove so no rtrim...
|
||||
if ('.' === substr($previous->getMessage(), -1)) {
|
||||
if (str_ends_with($previous->getMessage(), '.')) {
|
||||
$trimmedMessage = substr($previous->getMessage(), 0, -1);
|
||||
$message .= sprintf('%s', $trimmedMessage).' in ';
|
||||
} else {
|
||||
@@ -68,21 +70,19 @@ class LoaderLoadException extends \Exception
|
||||
$message .= sprintf(' Make sure the "%s" bundle is correctly registered and loaded in the application kernel class.', $bundle);
|
||||
$message .= sprintf(' If the bundle is registered, make sure the bundle path "%s" is not empty.', $resource);
|
||||
} elseif (null !== $type) {
|
||||
// maybe there is no loader for this specific type
|
||||
if ('annotation' === $type) {
|
||||
$message .= ' Make sure to use PHP 8+ or that annotations are installed and enabled.';
|
||||
} else {
|
||||
$message .= sprintf(' Make sure there is a loader supporting the "%s" type.', $type);
|
||||
}
|
||||
$message .= sprintf(' Make sure there is a loader supporting the "%s" type.', $type);
|
||||
}
|
||||
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
protected function varToString($var)
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function varToString(mixed $var)
|
||||
{
|
||||
if (\is_object($var)) {
|
||||
return sprintf('Object(%s)', \get_class($var));
|
||||
return sprintf('Object(%s)', $var::class);
|
||||
}
|
||||
|
||||
if (\is_array($var)) {
|
||||
|
||||
Reference in New Issue
Block a user