Skip to content

Commit 85035b0

Browse files
committed
remove ability to access $this and the loader's internal state
1 parent 1bcdaa0 commit 85035b0

File tree

3 files changed

+2
-24
lines changed

3 files changed

+2
-24
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
8.0
55
---
66

7+
* Remove support for accessing the internal scope of the loader in PHP config files, use only its public API instead
78
* Add argument `$singular` to `NodeBuilder::arrayNode()`
89
* Add argument `$info` to `ArrayNodeDefinition::canBeDisabled()` and `canBeEnabled()`
910

Definition/Loader/DefinitionFileLoader.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,7 @@ public function load(mixed $resource, ?string $type = null): mixed
4848
return include $file;
4949
}, null, null);
5050

51-
try {
52-
$callback = $load($path);
53-
} catch (\Error $e) {
54-
$load = \Closure::bind(static function ($file) use ($loader) {
55-
return include $file;
56-
}, null, ProtectedDefinitionFileLoader::class);
57-
58-
$callback = $load($path);
59-
60-
trigger_deprecation('symfony/config', '7.4', 'Accessing the internal scope of the loader in config files is deprecated, use only its public API instead in "%s" on line %d.', $e->getFile(), $e->getLine());
61-
}
51+
$callback = $load($path);
6252

6353
if (\is_object($callback) && \is_callable($callback)) {
6454
$this->callConfigurator($callback, new DefinitionConfigurator($this->treeBuilder, $this, $path, $resource), $path);

Tests/Definition/Loader/DefinitionFileLoaderTest.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Component\Config\Tests\Definition\Loader;
1313

14-
use PHPUnit\Framework\Attributes\Group;
15-
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1614
use PHPUnit\Framework\TestCase;
1715
use Symfony\Component\Config\Definition\BaseNode;
1816
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
@@ -41,15 +39,4 @@ public function testLoad()
4139
$this->assertInstanceOf(BaseNode::class, $children['foo']);
4240
$this->assertSame('test.foo', $children['foo']->getPath(), '->load() loads a PHP file resource');
4341
}
44-
45-
#[IgnoreDeprecations]
46-
#[Group('legacy')]
47-
public function testTriggersDeprecationWhenAccessingLoaderInternalScope()
48-
{
49-
$loader = new DefinitionFileLoader(new TreeBuilder('test'), new FileLocator(__DIR__.'/../../Fixtures/Loader'));
50-
51-
$this->expectUserDeprecationMessageMatches('{^Since symfony/config 7.4: Accessing the internal scope of the loader in config files is deprecated, use only its public API instead in ".+" on line \d+\.$}');
52-
53-
$loader->load('legacy_internal_scope.php');
54-
}
5542
}

0 commit comments

Comments
 (0)