Repository: symfony/symfony
File: src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php (PHP)

Code before:
            }
            if ($result instanceof ConfigBuilderInterface) {
                $this->loadExtensionConfig($result->getExtensionAlias(), ContainerConfigurator::processValue($result->toArray()), $path);
            } elseif (is_iterable($result)) {
                foreach ($result as $key => $config) {
                    if ($config instanceof ConfigBuilderInterface) {
                        if (\is_string($key) && $config->getExtensionAlias() !== $key) {
                            throw new InvalidArgumentException(\sprintf('The extension alias "%s" of the "%s" config builder does not match the key "%s" in file "%s".', $config->getExtensionAlias(), get_debug_type($config), $key, $path));
                        }
                        $this->loadExtensionConfig($config->getExtensionAlias(), ContainerConfigurator::processValue($config->toArray()), $path);
                    } elseif (!\is_string($key) || !\is_array($config)) {
                        throw new InvalidArgumentException(\sprintf('The configuration returned in file "%s" must yield only string-keyed arrays or ConfigBuilderInterface values.', $path));
                    } else {
                        $this->loadExtensionConfig($key, ContainerConfigurator::processValue($config), $path);
                    }
                }
            } elseif (null !== $result) {
                throw new InvalidArgumentException(\sprintf('The return value in config file "%s" is invalid: "%s" given.', $path, get_debug_type($result)));
            }

            $this->loadExtensionConfigs();
        } finally {
            $this->instanceof = [];
            $this->registerAliasesForSinglyImplementedInterfaces();

            if (null !== $this->configBuilderAutoloader) {
                spl_autoload_unregister($this->configBuilderAutoloader);
                $this->configBuilderAutoloader = null;
            }
        }

        return null;
    }

    public function supports(mixed $resource, ?string $type = null): bool
    {
        if (!\is_string($resource)) {
            return false;
        }

        if (null === $type && 'php' === pathinfo($resource, \PATHINFO_EXTENSION)) {
            return true;
        }

        return 'php' === $type;
    }

    /**
     * Resolve the parameters to the $callback and execute it.
     */
    private function callConfigurator(callable $callback, ContainerConfigurator $containerConfigurator, string $path): mixed

Review comment (suggestion):
`null` is falsy, a `Closure` is not.
```suggestion
            if ($this->configBuilderAutoloader) {
```

Code after:
                    if ($config instanceof ConfigBuilderInterface) {
                        if (\is_string($key) && $config->getExtensionAlias() !== $key) {
                            throw new InvalidArgumentException(\sprintf('The extension alias "%s" of the "%s" config builder does not match the key "%s" in file "%s".', $config->getExtensionAlias(), get_debug_type($config), $key, $path));
                        }
                        $this->loadExtensionConfig($config->getExtensionAlias(), ContainerConfigurator::processValue($config->toArray()), $path);
                    } elseif (!\is_string($key) || !\is_array($config)) {
                        throw new InvalidArgumentException(\sprintf('The configuration returned in file "%s" must yield only string-keyed arrays or ConfigBuilderInterface values.', $path));
                    } else {
                        $this->loadExtensionConfig($key, ContainerConfigurator::processValue($config), $path);
                    }
                }
            } elseif (null !== $result) {
                throw new InvalidArgumentException(\sprintf('The return value in config file "%s" is invalid: "%s" given.', $path, get_debug_type($result)));
            }

            $this->loadExtensionConfigs();
        } finally {
            $this->instanceof = [];
            $this->registerAliasesForSinglyImplementedInterfaces();

            if ($autoloaderRegistered) {
                spl_autoload_unregister($this->configBuilderAutoloader);
                $this->configBuilderAutoloader = null;
            }
        }

        return null;
    }

    public function supports(mixed $resource, ?string $type = null): bool
    {
        if (!\is_string($resource)) {
            return false;
        }

        if (null === $type && 'php' === pathinfo($resource, \PATHINFO_EXTENSION)) {
            return true;
        }

        return 'php' === $type;
    }

    /**
     * Resolve the parameters to the $callback and execute it.
     */
    private function callConfigurator(callable $callback, ContainerConfigurator $containerConfigurator, string $path): mixed
    {
        $callback = $callback(...);
        $arguments = [];
        $configBuilders = [];
        $r = new \ReflectionFunction($callback);