Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation for symfony/config 4.2+ #853

Merged
merged 1 commit into from Oct 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions DependencyInjection/Configuration.php
Expand Up @@ -33,8 +33,14 @@ public function __construct($debug)
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('doctrine');
$treeBuilder = new TreeBuilder('doctrine');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use use function instead of \.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not possible: "php": "^5.5.9|^7.0", in composer.json

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, put the "new" statement in the "if" (with/without parms).
There is other "new TreeBuilder()" in the file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof Using \fn directly violates our coding standard so it's invalid. If, due to PHP 5.5 compatibily, use function cannot be used, the function should be kept in fallback mode.
This breaks build: https://travis-ci.org/doctrine/DoctrineBundle/jobs/443601176#L649


if (\method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$rootNode = $treeBuilder->root('doctrine');
}

$this->addDbalSection($rootNode);
$this->addOrmSection($rootNode);
Expand Down