Skip to content

Commit b5fa715

Browse files
mdeboerSpomky
authored andcommitted
Cloudstek/fixes (#156)
* Update gitignore * Remove tree builder without root node deprecation notice in Symfony 4.2 and up. Removes the "A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0." notice in Symfony 4.2 and up, with BC. * Ignore deprecation notices caused by vendor libraries Ignores deprecation notices caused by vendor libraries whilst still failing tests for deprecation notices caused by code outside the vendors directory. This only affects the exit code and will still report all notices.
1 parent 6c764ae commit b5fa715

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ jose.phar.version
77
.travis/secrets.tar
88
report.md
99
composer.lock
10+
.php_cs
11+
.php_cs.cache
12+
vendor/
13+
src/Bundle/JoseFramework/var/

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<ini name="intl.error_level" value="0" />
2828
<ini name="memory_limit" value="-1" />
2929
<server name="KERNEL_CLASS" value="Jose\Bundle\JoseFramework\Tests\AppKernel" />
30+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak_vendors" />
3031
</php>
3132
<filter>
3233
<whitelist>

src/Bundle/JoseFramework/DependencyInjection/Configuration.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,23 @@ public function __construct(string $alias, array $sources)
4242

4343
public function getConfigTreeBuilder()
4444
{
45-
$treeBuilder = new TreeBuilder();
46-
$rootNode = $treeBuilder->root($this->alias);
45+
$treeBuilder = new TreeBuilder($this->alias);
46+
$rootNode = $this->getRootNode($treeBuilder, $this->alias);
4747

4848
foreach ($this->sources as $source) {
4949
$source->getNodeDefinition($rootNode);
5050
}
5151

5252
return $treeBuilder;
5353
}
54+
55+
private function getRootNode(TreeBuilder $treeBuilder, $name)
56+
{
57+
// BC layer for symfony/config 4.1 and older
58+
if (! \method_exists($treeBuilder, 'getRootNode')) {
59+
return $treeBuilder->root($name);
60+
}
61+
62+
return $treeBuilder->getRootNode();
63+
}
5464
}

0 commit comments

Comments
 (0)