Merge remote-tracking branch 'origin/support/3.2' into develop

This commit is contained in:
lenaick.moreira
2026-03-02 10:56:31 +01:00
123 changed files with 2898 additions and 2149 deletions

View File

@@ -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);

View File

@@ -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);
}
}
}
}