mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +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:
@@ -29,7 +29,7 @@ abstract class FileLoader extends Loader
|
||||
|
||||
protected $locator;
|
||||
|
||||
private $currentDir;
|
||||
private ?string $currentDir = null;
|
||||
|
||||
public function __construct(FileLocatorInterface $locator, string $env = null)
|
||||
{
|
||||
@@ -39,6 +39,8 @@ abstract class FileLoader extends Loader
|
||||
|
||||
/**
|
||||
* Sets the current directory.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCurrentDir(string $dir)
|
||||
{
|
||||
@@ -47,10 +49,8 @@ abstract class FileLoader extends Loader
|
||||
|
||||
/**
|
||||
* Returns the file locator used by this loader.
|
||||
*
|
||||
* @return FileLocatorInterface
|
||||
*/
|
||||
public function getLocator()
|
||||
public function getLocator(): FileLocatorInterface
|
||||
{
|
||||
return $this->locator;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ abstract class FileLoader extends Loader
|
||||
* @throws FileLoaderImportCircularReferenceException
|
||||
* @throws FileLocatorFileNotFoundException
|
||||
*/
|
||||
public function import($resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null, $exclude = null)
|
||||
public function import(mixed $resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null, string|array $exclude = null)
|
||||
{
|
||||
if (\is_string($resource) && \strlen($resource) !== ($i = strcspn($resource, '*?{[')) && !str_contains($resource, "\n")) {
|
||||
$excluded = [];
|
||||
@@ -101,7 +101,7 @@ abstract class FileLoader extends Loader
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
protected function glob(string $pattern, bool $recursive, &$resource = null, bool $ignoreErrors = false, bool $forExclusion = false, array $excluded = [])
|
||||
protected function glob(string $pattern, bool $recursive, array|GlobResource &$resource = null, bool $ignoreErrors = false, bool $forExclusion = false, array $excluded = []): iterable
|
||||
{
|
||||
if (\strlen($pattern) === $i = strcspn($pattern, '*?{[')) {
|
||||
$prefix = $pattern;
|
||||
@@ -133,12 +133,20 @@ abstract class FileLoader extends Loader
|
||||
yield from $resource;
|
||||
}
|
||||
|
||||
private function doImport($resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null)
|
||||
private function doImport(mixed $resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null): mixed
|
||||
{
|
||||
try {
|
||||
$loader = $this->resolve($resource, $type);
|
||||
|
||||
if ($loader instanceof self && null !== $this->currentDir) {
|
||||
if ($loader instanceof DirectoryAwareLoaderInterface) {
|
||||
$loader = $loader->forDirectory($this->currentDir);
|
||||
}
|
||||
|
||||
if (!$loader instanceof self) {
|
||||
return $loader->load($resource, $type);
|
||||
}
|
||||
|
||||
if (null !== $this->currentDir) {
|
||||
$resource = $loader->getLocator()->locate($resource, $this->currentDir, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user