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

Code before:
    }

    public function load(mixed $resource, ?string $type = null): mixed
    {
        // the container and loader variables are exposed to the included file below
        $container = $this->container;
        $loader = $this;

        $path = $this->locator->locate($resource);
        $this->setCurrentDir(\dirname($path));
        $this->container->fileExists($path);

        // Force load ContainerConfigurator to make env(), param() etc available.
        class_exists(ContainerConfigurator::class);

        $autoloaderRegistered = false;
        if (!$this->configBuilderAutoloader && $this->generator) {
            $this->configBuilderAutoloader = function (string $class) {
                if (str_starts_with($class, 'Symfony\\Config\\') && str_ends_with($class, 'Config')) {
                    $this->configBuilder($class);
                }
            };

            spl_autoload_register($this->configBuilderAutoloader);
            $autoloaderRegistered = true;
        }

        // the closure forbids access to the private scope in the included file
        $load = \Closure::bind(static function ($path, $env) use ($container, $loader, $resource, $type) {
            return include $path;
        }, null, null);

        try {
            try {
                if (1 === $result = $load($path, $this->env)) {
                    $result = null;
                }
            } catch (\Error $e) {
                $load = \Closure::bind(function ($path, $env) use ($container, $loader, $resource, $type) {
                    return include $path;
                }, $this, ProtectedPhpFileLoader::class);

                if (1 === $result = $load($path, $this->env)) {
                    $result = null;
                }

                trigger_deprecation('symfony/dependency-injection', '8.1', 'Using `$this` or its internal scope in config files is deprecated, use the `$loader` variable instead in "%s" on line %d.', $e->getFile(), $e->getLine());
            }

            if (\is_object($result) && \is_callable($result)) {
                $result = $this->callConfigurator($result, new ContainerConfigurator($this->container, $this, $this->instanceof, $path, $resource, $this->env), $path);

Review comment (suggestion):
```suggestion
        if ($autoloaderRegistered = !$this->configBuilderAutoloader && $this->generator) {
            spl_autoload_register($this->configBuilderAutoloader = function (string $class) {
                if (str_starts_with($class, 'Symfony\\Config\\') && str_ends_with($class, 'Config')) {
                    $this->configBuilder($class);
                }
            });
        }
```

Code after:
    }

    public function load(mixed $resource, ?string $type = null): mixed
    {
        // the container and loader variables are exposed to the included file below
        $container = $this->container;
        $loader = $this;

        $path = $this->locator->locate($resource);
        $this->setCurrentDir(\dirname($path));
        $this->container->fileExists($path);

        // Force load ContainerConfigurator to make env(), param() etc available.
        class_exists(ContainerConfigurator::class);

        if ($autoloaderRegistered = !$this->configBuilderAutoloader && $this->generator) {
            spl_autoload_register($this->configBuilderAutoloader = function (string $class) {
                if (str_starts_with($class, 'Symfony\\Config\\') && str_ends_with($class, 'Config')) {
                    $this->configBuilder($class);
                }
            });
        }

        // the closure forbids access to the private scope in the included file
        $load = \Closure::bind(static function ($path, $env) use ($container, $loader, $resource, $type) {
            return include $path;
        }, null, null);

        try {
            try {
                if (1 === $result = $load($path, $this->env)) {
                    $result = null;
                }
            } catch (\Error $e) {
                $load = \Closure::bind(function ($path, $env) use ($container, $loader, $resource, $type) {
                    return include $path;
                }, $this, ProtectedPhpFileLoader::class);

                if (1 === $result = $load($path, $this->env)) {
                    $result = null;
                }

                trigger_deprecation('symfony/dependency-injection', '8.1', 'Using `$this` or its internal scope in config files is deprecated, use the `$loader` variable instead in "%s" on line %d.', $e->getFile(), $e->getLine());
            }

            if (\is_object($result) && \is_callable($result)) {
                $result = $this->callConfigurator($result, new ContainerConfigurator($this->container, $this, $this->instanceof, $path, $resource, $this->env), $path);
            }
            if ($result instanceof ConfigBuilderInterface) {
                $this->loadExtensionConfig($result->getExtensionAlias(), ContainerConfigurator::processValue($result->toArray()), $path);
            } elseif (is_iterable($result)) {