Revert "Add check for leading backslash in Name ctor"

This reverts commit 2f67429ec93857b8a3ae5a15165818e5eda8fb56.

Reverting this to avoid a BC break in a patch release, will
reapply for the next major version.
This commit is contained in:
Nikita Popov 2018-09-18 09:00:32 +02:00
parent d7d581c1d2
commit 16c5d107ca
3 changed files with 0 additions and 17 deletions

View File

@ -11,11 +11,6 @@ Version 4.0.4-dev
* `var()`
* `propertyFetch()`
### Changed
* Passing a string with a leading backslash to the `Name` constructor will now throw an exception.
Most likely a use of `Name\FullyQualified` was intended.
### Deprecated
* `Builder\Param::setTypeHint()` has been deprecated in favor of the newly introduced

View File

@ -222,10 +222,6 @@ class Name extends NodeAbstract
throw new \InvalidArgumentException('Name cannot be empty');
}
if ('\\' === $name[0]) {
throw new \InvalidArgumentException('Name cannot start with backslash. Did you mean to use Name\FullyQualified?');
}
return explode('\\', $name);
} elseif (\is_array($name)) {
if (empty($name)) {

View File

@ -155,14 +155,6 @@ class NameTest extends TestCase
new Name([]);
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Name cannot start with backslash. Did you mean to use Name\FullyQualified?
*/
public function testInvalidLeadingBackslash() {
new Name('\Foo');
}
/** @dataProvider provideTestIsSpecialClassName */
public function testIsSpecialClassName($name, $expected) {
$name = new Name($name);