8000 [DI] Handle root namespace in service definitions by ro0NL · Pull Request #23468 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DI] Handle root namespace in service definitions #23468

8000 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

Closed
wants to merge 2 commits into from
Closed

[DI] Handle root namespace in service definitions #23468

wants to merge 2 commits into from

Conversation

ro0NL
Copy link
Contributor
@ro0NL ro0NL commented Jul 10, 2017
Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #...
License MIT
Doc PR symfony/symfony-docs#...

Fixes

Cannot dump definition because of invalid class name ('\\stdClass')

for

services:
    foo: {class: '\stdClass' }

ContainerBuilder allows it, so PhpDumper should as well.

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Jul 11, 2017
return '\\'.substr(str_replace('\\\\', '\\', $class), 1, -1);
$class = substr(str_replace('\\\\', '\\', $class), 1, -1);

return '\\' === substr($class, 0, 1) ? $class : '\\'.$class;
Copy link
Contributor

Choose a reason for hiding this comment

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

0 === strpos($class, '\\')

@nicolas-grekas
Copy link
Member

Thank you @ro0NL.

nicolas-grekas added a commit that referenced this pull request Jul 12, 2017
This PR was squashed before being merged into the 2.7 branch (closes #23468).

Discussion
----------

[DI] Handle root namespace in service definitions

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

Fixes

```
Cannot dump definition because of invalid class name ('\\stdClass')
```

for

```yaml
services:
    foo: {class: '\stdClass' }
```

`ContainerBuilder` allows it, so `PhpDumper` should as well.

Commits
-------

05170c8 [DI] Handle root namespace in service definitions
@ro0NL ro0NL deleted the di/root-namespace branch July 12, 2017 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0