mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2025-01-22 13:21:12 +01:00
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:
parent
d7d581c1d2
commit
16c5d107ca
@ -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
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user