mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
Merge remote-tracking branch 'origin/support/3.2' into develop
This commit is contained in:
@@ -72,27 +72,40 @@ abstract class FileLoader extends Loader
|
||||
*/
|
||||
public function import(mixed $resource, ?string $type = null, bool $ignoreErrors = false, ?string $sourceResource = null, string|array|null $exclude = null)
|
||||
{
|
||||
if (\is_string($resource) && \strlen($resource) !== ($i = strcspn($resource, '*?{[')) && !str_contains($resource, "\n")) {
|
||||
$excluded = [];
|
||||
foreach ((array) $exclude as $pattern) {
|
||||
foreach ($this->glob($pattern, true, $_, false, true) as $path => $info) {
|
||||
// normalize Windows slashes and remove trailing slashes
|
||||
$excluded[rtrim(str_replace('\\', '/', $path), '/')] = true;
|
||||
}
|
||||
$excluded = [];
|
||||
foreach ((array) $exclude as $pattern) {
|
||||
foreach ($this->glob($pattern, true, $_, false, true) as $path => $info) {
|
||||
// normalize Windows slashes and remove trailing slashes
|
||||
$excluded[rtrim(str_replace('\\', '/', $path), '/')] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (\is_string($resource) && !class_exists($resource)) {
|
||||
$isGlobPattern = \strlen($resource) !== strcspn($resource, '*?{[');
|
||||
|
||||
if (!$isGlobPattern && $excluded) {
|
||||
$resource = rtrim(str_replace('\\', '/', $resource), '/');
|
||||
$resource .= '/**/*';
|
||||
$isGlobPattern = true;
|
||||
}
|
||||
|
||||
$ret = [];
|
||||
$isSubpath = 0 !== $i && str_contains(substr($resource, 0, $i), '/');
|
||||
foreach ($this->glob($resource, false, $_, $ignoreErrors || !$isSubpath, false, $excluded) as $path => $info) {
|
||||
if (null !== $res = $this->doImport($path, 'glob' === $type ? null : $type, $ignoreErrors, $sourceResource)) {
|
||||
$ret[] = $res;
|
||||
if ($isGlobPattern && !str_contains($resource, "\n")) {
|
||||
$ret = [];
|
||||
$i = strcspn($resource, '*?{[');
|
||||
$isSubpath = 0 !== $i && str_contains(substr($resource, 0, $i), '/');
|
||||
foreach ($this->glob($resource, false, $_, $ignoreErrors || !$isSubpath, false, $excluded) as $path => $info) {
|
||||
if (null !== $res = $this->doImport($path, 'glob' === $type ? null : $type, $ignoreErrors, $sourceResource)) {
|
||||
$ret[] = $res;
|
||||
}
|
||||
$isSubpath = true;
|
||||
}
|
||||
$isSubpath = true;
|
||||
}
|
||||
|
||||
if ($isSubpath) {
|
||||
return isset($ret[1]) ? $ret : ($ret[0] ?? null);
|
||||
if ($isSubpath) {
|
||||
return isset($ret[1]) ? $ret : ($ret[0] ?? null);
|
||||
}
|
||||
}
|
||||
} elseif (\is_array($resource) && $excluded) {
|
||||
$resource['_excluded'] = $excluded;
|
||||
}
|
||||
|
||||
return $this->doImport($resource, $type, $ignoreErrors, $sourceResource);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Config\Resource;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Form\FormTypeExtensionInterface;
|
||||
use Symfony\Component\Messenger\Handler\MessageSubscriberInterface;
|
||||
use Symfony\Contracts\Service\ServiceSubscriberInterface;
|
||||
|
||||
@@ -212,5 +213,12 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
|
||||
yield ServiceSubscriberInterface::class;
|
||||
yield print_r($class->name::getSubscribedServices(), true);
|
||||
}
|
||||
|
||||
if (interface_exists(FormTypeExtensionInterface::class, false) && $class->isSubclassOf(FormTypeExtensionInterface::class)) {
|
||||
yield FormTypeExtensionInterface::class;
|
||||
foreach ($class->name::getExtendedTypes() as $key => $value) {
|
||||
yield $key.print_r($value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user