Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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