diff --git a/specs/class-const/global-scope-single-level.php b/specs/class-const/global-scope-single-level.php index f54c9028..d3f2a5d9 100644 --- a/specs/class-const/global-scope-single-level.php +++ b/specs/class-const/global-scope-single-level.php @@ -40,7 +40,7 @@ class Command {} class Command { } -\Humbug\Command::MAIN_CONST; +Command::MAIN_CONST; PHP ], diff --git a/specs/class-const/global-scope-two-level.php b/specs/class-const/global-scope-two-level.php index 4ab8833c..dfac8c3a 100644 --- a/specs/class-const/global-scope-two-level.php +++ b/specs/class-const/global-scope-two-level.php @@ -46,7 +46,7 @@ class Command } namespace Humbug; -\Humbug\PHPUnit\Command::MAIN_CONST; +PHPUnit\Command::MAIN_CONST; PHP ], diff --git a/specs/class-const/namespace-scope-single-level.php b/specs/class-const/namespace-scope-single-level.php index 34218347..fd07dd49 100644 --- a/specs/class-const/namespace-scope-single-level.php +++ b/specs/class-const/namespace-scope-single-level.php @@ -42,7 +42,7 @@ class Command {} class Command { } -\Humbug\X\Command::MAIN_CONST; +Command::MAIN_CONST; PHP ], diff --git a/specs/class-const/namespace-scope-two-level.php b/specs/class-const/namespace-scope-two-level.php index 42b67328..4f8a365c 100644 --- a/specs/class-const/namespace-scope-two-level.php +++ b/specs/class-const/namespace-scope-two-level.php @@ -46,7 +46,7 @@ class Command } namespace Humbug\X; -\Humbug\X\PHPUnit\Command::MAIN_CONST; +PHPUnit\Command::MAIN_CONST; PHP ], @@ -103,7 +103,7 @@ class Command \class_alias('Humbug\\X\\PHPUnit\\Command', 'X\\PHPUnit\\Command', \false); namespace Humbug\X; -\Humbug\X\PHPUnit\Command::MAIN_CONST; +PHPUnit\Command::MAIN_CONST; PHP ], diff --git a/specs/class-static-prop/global-scope-single-level.php b/specs/class-static-prop/global-scope-single-level.php index 01d024b2..2a8b51f1 100644 --- a/specs/class-static-prop/global-scope-single-level.php +++ b/specs/class-static-prop/global-scope-single-level.php @@ -39,7 +39,7 @@ class Command {} class Command { } -\Humbug\Command::$mainStaticProp; +Command::$mainStaticProp; PHP , diff --git a/specs/class-static-prop/global-scope-two-level.php b/specs/class-static-prop/global-scope-two-level.php index 5cfa5a91..82f18462 100644 --- a/specs/class-static-prop/global-scope-two-level.php +++ b/specs/class-static-prop/global-scope-two-level.php @@ -45,7 +45,7 @@ class Command } namespace Humbug; -\Humbug\PHPUnit\Command::$mainStaticProp; +PHPUnit\Command::$mainStaticProp; PHP , diff --git a/specs/class-static-prop/namespace-scope-single-level.php b/specs/class-static-prop/namespace-scope-single-level.php index de378eca..a304957a 100644 --- a/specs/class-static-prop/namespace-scope-single-level.php +++ b/specs/class-static-prop/namespace-scope-single-level.php @@ -41,7 +41,7 @@ class Command {} class Command { } -\Humbug\X\Command::$mainStaticProp; +Command::$mainStaticProp; PHP , diff --git a/specs/class-static-prop/namespace-scope-two-level.php b/specs/class-static-prop/namespace-scope-two-level.php index a81dbbfd..03ddbb2e 100644 --- a/specs/class-static-prop/namespace-scope-two-level.php +++ b/specs/class-static-prop/namespace-scope-two-level.php @@ -45,7 +45,7 @@ class Command } namespace Humbug\X; -\Humbug\X\PHPUnit\Command::$mainStaticProp; +PHPUnit\Command::$mainStaticProp; PHP , @@ -101,7 +101,7 @@ class Command \class_alias('Humbug\\X\\PHPUnit\\Command', 'X\\PHPUnit\\Command', \false); namespace Humbug\X; -\Humbug\X\PHPUnit\Command::$mainStaticProp; +PHPUnit\Command::$mainStaticProp; PHP ], diff --git a/specs/class/anonymous.php b/specs/class/anonymous.php index cda3b739..2710682e 100644 --- a/specs/class/anonymous.php +++ b/specs/class/anonymous.php @@ -66,14 +66,14 @@ public function test() { } }; -new class extends \Humbug\A implements \Humbug\B, \Humbug\C, \Iterator +new class extends A implements B, C, \Iterator { }; new class { public $foo; }; -new class($a, $b) extends \Humbug\A +new class($a, $b) extends A { use T; }; @@ -81,7 +81,7 @@ class A { public function test() { - return new class($this) extends \Humbug\A + return new class($this) extends A { const A = 'B'; }; @@ -141,14 +141,14 @@ public function test() { } }; -new class extends \Humbug\A implements \Humbug\B, \Humbug\C, \Iterator +new class extends A implements B, C, \Iterator { }; new class { public $foo; }; -new class($a, $b) extends \Humbug\A +new class($a, $b) extends A { use T; }; @@ -156,7 +156,7 @@ class A { public function test() { - return new class($this) extends \Humbug\A + return new class($this) extends A { const A = 'B'; }; @@ -284,7 +284,7 @@ public function test() { } }; -new class extends \Humbug\A implements \Humbug\B, \Humbug\C, \Iterator +new class extends \Humbug\A implements B, \Humbug\C, \Iterator { }; new class @@ -356,14 +356,14 @@ public function test() { } }; -new class extends \Humbug\Foo\A implements \Humbug\Foo\B, \Humbug\Foo\C, \Iterator +new class extends A implements B, C, \Iterator { }; new class { public $foo; }; -new class($a, $b) extends \Humbug\Foo\A +new class($a, $b) extends A { use T; }; @@ -371,7 +371,7 @@ class A { public function test() { - return new class($this) extends \Humbug\Foo\A + return new class($this) extends A { const A = 'B'; }; @@ -428,7 +428,7 @@ class A { public function test() { - return new class($this) extends \Humbug\A + return new class($this) extends A { const A = 'B'; }; @@ -449,7 +449,7 @@ public function test() { } }; -new class extends A implements \Humbug\Foo\B, \Humbug\Foo\C, \Iterator +new class extends A implements B, C, \Iterator { }; namespace Humbug\Bar; diff --git a/specs/class/interface.php b/specs/class/interface.php index 16e4833c..c5a227c2 100644 --- a/specs/class/interface.php +++ b/specs/class/interface.php @@ -45,7 +45,7 @@ class C class D { } -interface A extends \Humbug\C, \Humbug\D, \Iterator +interface A extends C, D, \Iterator { public function a(); } @@ -82,7 +82,7 @@ class D { } \class_alias('Humbug\\D', 'D', \false); -interface A extends \Humbug\C, \Humbug\D, \Iterator +interface A extends C, D, \Iterator { public function a(); } @@ -117,7 +117,7 @@ class C class D { } -interface A extends \Humbug\Foo\C, \Humbug\Foo\D, Iterator +interface A extends C, D, Iterator { public function a(); } @@ -153,7 +153,7 @@ class C class D { } -interface A extends \Humbug\Foo\C, \Humbug\Foo\D, Iterator +interface A extends C, D, Iterator { public function a(); } @@ -192,7 +192,7 @@ class C class D { } -interface A extends \Humbug\Foo\C, \Humbug\Foo\D, Iterator +interface A extends C, D, Iterator { public function a(); } @@ -297,7 +297,7 @@ class D class E { } -interface A extends \Humbug\X\D, \Humbug\X\E +interface A extends D, E { public function a(); } @@ -309,7 +309,7 @@ class D class E { } -interface B extends \Humbug\Y\D, \Humbug\Y\E +interface B extends D, E { public function a(); } @@ -321,7 +321,7 @@ class D class E { } -interface C extends \Humbug\Z\D, \Humbug\Z\E +interface C extends D, E { public function a(); } diff --git a/specs/class/regular-extend.php b/specs/class/regular-extend.php index 3710770b..b1cebcb5 100644 --- a/specs/class/regular-extend.php +++ b/specs/class/regular-extend.php @@ -45,7 +45,7 @@ public function a() { } } -class B extends \Humbug\A implements \Iterator +class B extends A implements \Iterator { } @@ -77,7 +77,7 @@ public function a() { } } -class B extends \Humbug\Foo\A implements Iterator +class B extends A implements Iterator { } @@ -111,7 +111,7 @@ public function a() { } } -class B extends \Humbug\Foo\A +class B extends A { } \class_alias('Humbug\\Foo\\B', 'Foo\\B', \false); diff --git a/specs/class/typed-properties.php b/specs/class/typed-properties.php index cb437c1e..440eede6 100644 --- a/specs/class/typed-properties.php +++ b/specs/class/typed-properties.php @@ -43,7 +43,7 @@ public function a() {} class A { public string $name; - public ?\Humbug\B $foo; + public ?B $foo; public function a() { } @@ -75,7 +75,7 @@ public function a() {} class A { public string $name; - public ?\Humbug\B $foo; + public ?B $foo; public function a() { } @@ -106,7 +106,7 @@ public function a() class A { public string $name; - public ?\Humbug\Foo\B $foo; + public ?B $foo; public function a() { } @@ -135,7 +135,7 @@ public function a() {} class A { public string $name; - public ?\Humbug\Foo\B $foo; + public ?B $foo; public function a() { } @@ -170,7 +170,7 @@ public function a() {} class A { public string $name; - public ?\Humbug\Foo\B $foo; + public ?B $foo; public function a() { } @@ -209,10 +209,10 @@ public function a() class A { public string $name; - public ?\Humbug\Foo\B $foo; + public ?B $foo; public ?C $foo; public ?DateTimeImmutable $bar; - public ?\Humbug\Foo\Closure $baz; + public ?Closure $baz; public function a() { } diff --git a/specs/const/const-declaration-with-global-whitelisting.php b/specs/const/const-declaration-with-global-whitelisting.php index bf0192da..0c86745c 100644 --- a/specs/const/const-declaration-with-global-whitelisting.php +++ b/specs/const/const-declaration-with-global-whitelisting.php @@ -40,12 +40,12 @@ namespace Humbug; -const FOO_CONST = \Humbug\foo(); -\define('BAR_CONST', \Humbug\foo()); -\define('Humbug\\Acme\\BAR_CONST', \Humbug\foo()); -\define(\FOO_CONST, \Humbug\foo()); -\define(\FOO_CONST, \Humbug\foo()); -\define(\Humbug\Acme\BAR_CONST, \Humbug\foo()); +const FOO_CONST = foo(); +\define('BAR_CONST', foo()); +\define('Humbug\\Acme\\BAR_CONST', foo()); +\define(\FOO_CONST, foo()); +\define(\FOO_CONST, foo()); +\define(\Humbug\Acme\BAR_CONST, foo()); PHP ], @@ -92,12 +92,12 @@ namespace Humbug; -\define('FOO_CONST', \Humbug\foo()); -\define('BAR_CONST', \Humbug\foo()); -\define('Acme\\BAR_CONST', \Humbug\foo()); -\define(\FOO_CONST, \Humbug\foo()); -\define(\FOO_CONST, \Humbug\foo()); -\define(\Acme\BAR_CONST, \Humbug\foo()); +\define('FOO_CONST', foo()); +\define('BAR_CONST', foo()); +\define('Acme\\BAR_CONST', foo()); +\define(\FOO_CONST, foo()); +\define(\FOO_CONST, foo()); +\define(\Acme\BAR_CONST, foo()); PHP ], diff --git a/specs/const/const-declaration.php b/specs/const/const-declaration.php index 5b6b2fb6..12d2bc98 100644 --- a/specs/const/const-declaration.php +++ b/specs/const/const-declaration.php @@ -51,22 +51,22 @@ namespace Humbug; -const FOO_CONST = \Humbug\foo(); +const FOO_CONST = foo(); const X = 'x', Y = ''; if (!\defined('Humbug\\BAR_CONST')) { - \define('Humbug\\BAR_CONST', \Humbug\foo()); + \define('Humbug\\BAR_CONST', foo()); } if (!\defined('Humbug\\Acme\\BAR_CONST')) { - \define('Humbug\\Acme\\BAR_CONST', \Humbug\foo()); + \define('Humbug\\Acme\\BAR_CONST', foo()); } if (!\defined('Humbug\\FOO_CONST')) { - \define(\Humbug\FOO_CONST, \Humbug\foo()); + \define(\Humbug\FOO_CONST, foo()); } if (!\defined('Humbug\\FOO_CONST')) { - \define(\Humbug\FOO_CONST, \Humbug\foo()); + \define(\Humbug\FOO_CONST, foo()); } if (!\defined('Humbug\\Acme\\BAR_CONST')) { - \define(\Humbug\Acme\BAR_CONST, \Humbug\foo()); + \define(\Humbug\Acme\BAR_CONST, foo()); } PHP @@ -154,22 +154,22 @@ namespace Humbug; -\define('FOO_CONST', \Humbug\foo()); +\define('FOO_CONST', foo()); const X = 'x', Y = ''; if (!\defined('BAR_CONST')) { - \define('BAR_CONST', \Humbug\foo()); + \define('BAR_CONST', foo()); } if (!\defined('Acme\\BAR_CONST')) { - \define('Acme\\BAR_CONST', \Humbug\foo()); + \define('Acme\\BAR_CONST', foo()); } if (!\defined('FOO_CONST')) { - \define(\FOO_CONST, \Humbug\foo()); + \define(\FOO_CONST, foo()); } if (!\defined('FOO_CONST')) { - \define(\FOO_CONST, \Humbug\foo()); + \define(\FOO_CONST, foo()); } if (!\defined('Acme\\BAR_CONST')) { - \define(\Acme\BAR_CONST, \Humbug\foo()); + \define(\Acme\BAR_CONST, foo()); } if (!\defined('BAZ')) { \define('BAZ', 'baz'); diff --git a/specs/const/namespace-single-part-namespaced.php b/specs/const/namespace-single-part-namespaced.php index 8ab5b086..cb6fcbda 100644 --- a/specs/const/namespace-single-part-namespaced.php +++ b/specs/const/namespace-single-part-namespaced.php @@ -36,7 +36,7 @@ namespace Humbug\A; -\Humbug\A\PHPUnit\DUMMY_CONST; +PHPUnit\DUMMY_CONST; PHP , @@ -70,7 +70,7 @@ namespace Humbug\A; -\Humbug\A\PHPUnit\DUMMY_CONST; +PHPUnit\DUMMY_CONST; PHP ], diff --git a/specs/exp/catch.php b/specs/exp/catch.php index 7108f1dc..25dbcba8 100644 --- a/specs/exp/catch.php +++ b/specs/exp/catch.php @@ -81,7 +81,7 @@ try { echo "foo"; -} catch (\Humbug\FooException $t) { +} catch (FooException $t) { } PHP @@ -147,7 +147,7 @@ try { echo "foo"; -} catch (\Humbug\Acme\FooException $t) { +} catch (FooException $t) { } PHP @@ -171,7 +171,7 @@ try { echo "foo"; -} catch (\Humbug\Acme\FooException $t) { +} catch (FooException $t) { } PHP diff --git a/specs/exp/coalescing-assignment.php b/specs/exp/coalescing-assignment.php index 0c7ed4d8..41fe646a 100644 --- a/specs/exp/coalescing-assignment.php +++ b/specs/exp/coalescing-assignment.php @@ -70,7 +70,7 @@ namespace Humbug; -$x ??= new \Humbug\Foo(); +$x ??= new Foo(); PHP , @@ -87,7 +87,7 @@ namespace Humbug\Acme; -$x ??= new \Humbug\Acme\Foo(); +$x ??= new Foo(); PHP , diff --git a/specs/exp/instanceof.php b/specs/exp/instanceof.php index 5343e171..d4a9df98 100644 --- a/specs/exp/instanceof.php +++ b/specs/exp/instanceof.php @@ -74,8 +74,8 @@ namespace Humbug; -$x = new \Humbug\Foo(); -$x instanceof \Humbug\Foo; +$x = new Foo(); +$x instanceof Foo; PHP , @@ -93,8 +93,8 @@ namespace Humbug\Acme; -$x = new \Humbug\Acme\Foo(); -$x instanceof \Humbug\Acme\Foo; +$x = new Foo(); +$x instanceof Foo; PHP , diff --git a/specs/func-arrow/global-scope-arrow-func.php b/specs/func-arrow/global-scope-arrow-func.php index 4451f14f..0965c807 100644 --- a/specs/func-arrow/global-scope-arrow-func.php +++ b/specs/func-arrow/global-scope-arrow-func.php @@ -42,7 +42,7 @@ fn($x) => $x; fn(int $x) => $x; fn(int $x): int => $x; -fn(\Humbug\Foo $x): \Humbug\Bar => $x; +fn(Foo $x): Bar => $x; fn(\DateTimeImmutable $x): \Closure => $x; PHP @@ -67,7 +67,7 @@ fn($x) => $x; fn(int $x) => $x; fn(int $x): int => $x; -fn(\Humbug\Foo $x): \Humbug\Bar => $x; +fn(Foo $x): Bar => $x; fn(\DateTimeImmutable $x): \Closure => $x; PHP diff --git a/specs/func-arrow/namespace-arrow-func.php b/specs/func-arrow/namespace-arrow-func.php index 419bd528..014c668f 100644 --- a/specs/func-arrow/namespace-arrow-func.php +++ b/specs/func-arrow/namespace-arrow-func.php @@ -44,8 +44,8 @@ fn($x) => $x; fn(int $x) => $x; fn(int $x): int => $x; -fn(\Humbug\Acme\Foo $x): \Humbug\Acme\Bar => $x; -fn(\Humbug\Acme\DateTimeImmutable $x): \Humbug\Acme\Closure => $x; +fn(Foo $x): Bar => $x; +fn(DateTimeImmutable $x): Closure => $x; PHP , @@ -71,8 +71,8 @@ fn($x) => $x; fn(int $x) => $x; fn(int $x): int => $x; -fn(\Humbug\Acme\Foo $x): \Humbug\Acme\Bar => $x; -fn(\Humbug\Acme\DateTimeImmutable $x): \Humbug\Acme\Closure => $x; +fn(Foo $x): Bar => $x; +fn(DateTimeImmutable $x): Closure => $x; PHP ], @@ -102,8 +102,8 @@ fn($x) => $x; fn(int $x) => $x; fn(int $x): int => $x; -fn(\Humbug\Acme\Foo $x): \Humbug\Acme\Bar => $x; -fn(\Humbug\Acme\DateTimeImmutable $x): \Humbug\Acme\Closure => $x; +fn(Foo $x): Bar => $x; +fn(DateTimeImmutable $x): Closure => $x; PHP ], diff --git a/specs/func-declaration/global.php b/specs/func-declaration/global.php index a3f815e0..1fcd64ed 100644 --- a/specs/func-declaration/global.php +++ b/specs/func-declaration/global.php @@ -154,7 +154,7 @@ class Y const FOO_CONST = 'foo'; \define('BAR_CONST', 'foo'); -function foo(\Humbug\Foo $arg0, \Humbug\Foo $arg1, \Humbug\Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, \ArrayIterator $arg4, \ArrayIterator $arg5, \Humbug\X\Y $arg6, \Humbug\X\Y $arg7, string $foo = \Humbug\FOO_CONST, string $bar = \BAR_CONST) +function foo(Foo $arg0, \Humbug\Foo $arg1, Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, \ArrayIterator $arg4, \ArrayIterator $arg5, \Humbug\X\Y $arg6, \Humbug\X\Y $arg7, string $foo = \Humbug\FOO_CONST, string $bar = \BAR_CONST) { } diff --git a/specs/func-declaration/method.php b/specs/func-declaration/method.php index 2ec91413..739c926d 100644 --- a/specs/func-declaration/method.php +++ b/specs/func-declaration/method.php @@ -102,10 +102,10 @@ class Main { const FOO_CONST = 'foo'; const BAR_CONST = 'bar'; - function foo(\Humbug\Foo $arg0, \Humbug\Foo $arg1, \Humbug\Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, \ArrayIterator $arg4, \ArrayIterator $arg5, \Humbug\X\Y $arg6, \Humbug\X\Y $arg7, string $foo = self::FOO_CONST, string $bar = self::BAR_CONST) + function foo(Foo $arg0, \Humbug\Foo $arg1, Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, \ArrayIterator $arg4, \ArrayIterator $arg5, \Humbug\X\Y $arg6, \Humbug\X\Y $arg7, string $foo = self::FOO_CONST, string $bar = self::BAR_CONST) { } - static function foo(\Humbug\Foo $arg0, \Humbug\Foo $arg1, \Humbug\Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, \ArrayIterator $arg4, \ArrayIterator $arg5, \Humbug\X\Y $arg6, \Humbug\X\Y $arg7, string $foo = self::FOO_CONST, string $bar = self::BAR_CONST) + static function foo(Foo $arg0, \Humbug\Foo $arg1, Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, \ArrayIterator $arg4, \ArrayIterator $arg5, \Humbug\X\Y $arg6, \Humbug\X\Y $arg7, string $foo = self::FOO_CONST, string $bar = self::BAR_CONST) { } } diff --git a/specs/func-declaration/namespace.php b/specs/func-declaration/namespace.php index c69b1ece..d3b506e5 100644 --- a/specs/func-declaration/namespace.php +++ b/specs/func-declaration/namespace.php @@ -148,7 +148,7 @@ class Foo class ArrayIterator { } -function foo(\Humbug\Pi\Foo $arg0 = null, \Humbug\Foo $arg1, \Humbug\Pi\Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, \Humbug\Pi\ArrayIterator $arg4, \ArrayIterator $arg5, \Humbug\Pi\X\Y $arg6, \Humbug\X\Y $arg7) +function foo(Foo $arg0 = null, \Humbug\Foo $arg1, Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, ArrayIterator $arg4, \ArrayIterator $arg5, X\Y $arg6, \Humbug\X\Y $arg7) { } @@ -235,7 +235,7 @@ class Foo class ArrayIterator { } -function foo(\Humbug\Pi\Foo $arg0 = null, \Humbug\Foo $arg1, \Humbug\Pi\Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, \Humbug\Pi\ArrayIterator $arg4, \ArrayIterator $arg5, \Humbug\Pi\X\Y $arg6, \Humbug\X\Y $arg7) +function foo(Foo $arg0 = null, \Humbug\Foo $arg1, Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, ArrayIterator $arg4, \ArrayIterator $arg5, X\Y $arg6, \Humbug\X\Y $arg7) { } @@ -314,7 +314,7 @@ class Y use Humbug\Foo\Bar; use ArrayIterator; use Humbug\X\Y; -function foo(Foo $arg0, \Humbug\Foo $arg1, Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, ArrayIterator $arg4, \ArrayIterator $arg5, \Humbug\Pi\X\Y $arg6, \Humbug\X\Y $arg7) +function foo(Foo $arg0, \Humbug\Foo $arg1, Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, ArrayIterator $arg4, \ArrayIterator $arg5, X\Y $arg6, \Humbug\X\Y $arg7) { } @@ -558,13 +558,13 @@ function foo() : ?ArrayIterator function foo() : ?\ArrayIterator { } -function foo() : \Humbug\Pi\X\Y +function foo() : X\Y { } function foo() : \Humbug\X\Y { } -function foo() : ?\Humbug\Pi\X\Y +function foo() : ?X\Y { } function foo() : ?\Humbug\X\Y diff --git a/specs/function/global-scope-global-func.php b/specs/function/global-scope-global-func.php index f23c5be7..af6bf049 100644 --- a/specs/function/global-scope-global-func.php +++ b/specs/function/global-scope-global-func.php @@ -34,7 +34,7 @@ namespace Humbug; -\Humbug\main(); +main(); PHP , @@ -48,7 +48,7 @@ namespace Humbug; -\Humbug\MAIN(); +MAIN(); PHP , diff --git a/specs/function/global-scope-single-part-namespaced-func.php b/specs/function/global-scope-single-part-namespaced-func.php index 42635a51..1c6d2e2d 100644 --- a/specs/function/global-scope-single-part-namespaced-func.php +++ b/specs/function/global-scope-single-part-namespaced-func.php @@ -34,7 +34,7 @@ namespace Humbug; -\Humbug\PHPUnit\main(); +PHPUnit\main(); PHP , diff --git a/specs/function/namespace-single-part-namespaced-func.php b/specs/function/namespace-single-part-namespaced-func.php index 3f5907fb..5bbef18b 100644 --- a/specs/function/namespace-single-part-namespaced-func.php +++ b/specs/function/namespace-single-part-namespaced-func.php @@ -36,7 +36,7 @@ namespace Humbug\X; -\Humbug\X\PHPUnit\main(); +PHPUnit\main(); PHP , @@ -71,7 +71,7 @@ namespace Humbug\X; -\Humbug\X\PHPUnit\main(); +PHPUnit\main(); PHP ], diff --git a/specs/function/whitelist-func-used.php b/specs/function/whitelist-func-used.php index 99892ad4..5643b623 100644 --- a/specs/function/whitelist-func-used.php +++ b/specs/function/whitelist-func-used.php @@ -34,7 +34,7 @@ namespace Humbug; -\Humbug\main(); +main(); PHP , @@ -72,7 +72,7 @@ namespace Humbug; -\Humbug\main(); +main(); PHP ], @@ -86,7 +86,7 @@ namespace Humbug; -\Humbug\main(); +main(); PHP , diff --git a/specs/misc/class-FQ.php b/specs/misc/class-FQ.php index 3dd852f1..6db38511 100644 --- a/specs/misc/class-FQ.php +++ b/specs/misc/class-FQ.php @@ -92,7 +92,7 @@ class Poz use Humbug\Foo as X; use Humbug\Foo\Bar as Y; use Humbug\Foo\Bar\Poz as Z; -\Humbug\Foo::MAIN_CONST; +Foo::MAIN_CONST; X::MAIN_CONST; Y::MAIN_CONST; X\Bar::MAIN_CONST; @@ -163,15 +163,15 @@ class Poz use Humbug\Foo as X; use Humbug\Foo\Bar as Y; use Humbug\Foo\Bar\Poz as Z; -\Humbug\Foo::MAIN_CONST; +Foo::MAIN_CONST; X::MAIN_CONST; Y::MAIN_CONST; X\Bar::MAIN_CONST; -\Humbug\Foo\Bar::MAIN_CONST; +Foo\Bar::MAIN_CONST; Z::MAIN_CONST; Y\Poz::MAIN_CONST; X\Bar\Poz::MAIN_CONST; -\Humbug\Foo\Bar\Poz::MAIN_CONST; +Foo\Bar\Poz::MAIN_CONST; PHP , @@ -323,18 +323,18 @@ class Poz use Humbug\Foo as X; use Humbug\Foo\Bar as Y; use Humbug\Foo\Bar\Poz as Z; -\Humbug\A\Aoo::MAIN_CONST; -\Humbug\A\Aoo\Aoz::MAIN_CONST; -\Humbug\A\Aoo\Aoz\Poz::MAIN_CONST; -\Humbug\A\Foo::MAIN_CONST; +Aoo::MAIN_CONST; +Aoo\Aoz::MAIN_CONST; +Aoo\Aoz\Poz::MAIN_CONST; +Foo::MAIN_CONST; X::MAIN_CONST; Y::MAIN_CONST; X\Bar::MAIN_CONST; -\Humbug\A\Foo\Bar::MAIN_CONST; +Foo\Bar::MAIN_CONST; Z::MAIN_CONST; Y\Poz::MAIN_CONST; X\Bar\Poz::MAIN_CONST; -\Humbug\A\Foo\Bar\Poz::MAIN_CONST; +Foo\Bar\Poz::MAIN_CONST; PHP ], diff --git a/specs/misc/date.php b/specs/misc/date.php index 010ba990..e6995165 100644 --- a/specs/misc/date.php +++ b/specs/misc/date.php @@ -50,7 +50,7 @@ namespace Humbug; const ISO8601_BASIC = 'Humbug\\Ymd\\THis\\Z'; -new \Humbug\Foo('Humbug\\d\\H\\Z'); +new Foo('Humbug\\d\\H\\Z'); new \DateTime('d\\H\\Z'); new \DateTimeImmutable('d\\H\\Z'); \date_create('d\\H\\Z'); @@ -97,7 +97,7 @@ use DateTime; use DateTimeImmutable; const ISO8601_BASIC = 'Humbug\\Ymd\\THis\\Z'; -new \Humbug\Acme\Foo('Humbug\\d\\H\\Z'); +new Foo('Humbug\\d\\H\\Z'); new DateTime('d\\H\\Z'); new DateTimeImmutable('d\\H\\Z'); \date_create('d\\H\\Z'); diff --git a/specs/misc/name-resolution.php b/specs/misc/name-resolution.php index 4a6c645d..629a7deb 100644 --- a/specs/misc/name-resolution.php +++ b/specs/misc/name-resolution.php @@ -46,7 +46,7 @@ function __construct() { namespace Humbug\PHPUnit\Framework; use function assert; -abstract class TestCase extends \Humbug\PHPUnit\Framework\Assert +abstract class TestCase extends Assert { function __construct() { @@ -78,7 +78,7 @@ function __construct() { namespace Humbug\PHPUnit\Framework; use const SORT_NUMERIC; -abstract class TestCase extends \Humbug\PHPUnit\Framework\SORT_NUMERIC +abstract class TestCase extends SORT_NUMERIC { function __construct() { diff --git a/specs/new/global-scope-single-part-with-single-level-use-statement-and-alias.php b/specs/new/global-scope-single-part-with-single-level-use-statement-and-alias.php index 18fb0d47..76100956 100644 --- a/specs/new/global-scope-single-part-with-single-level-use-statement-and-alias.php +++ b/specs/new/global-scope-single-part-with-single-level-use-statement-and-alias.php @@ -78,7 +78,7 @@ class Foo namespace Humbug; use Humbug\Foo as X; -new \Humbug\Foo(); +new Foo(); PHP ], diff --git a/specs/new/global-scope-single-part.php b/specs/new/global-scope-single-part.php index 7064f5cd..5858fcde 100644 --- a/specs/new/global-scope-single-part.php +++ b/specs/new/global-scope-single-part.php @@ -35,7 +35,7 @@ namespace Humbug; -new \Humbug\Foo(); +new Foo(); PHP ], @@ -80,7 +80,7 @@ namespace Humbug; -new \Humbug\Unknown(); +new Unknown(); PHP ], diff --git a/specs/new/global-scope-two-parts.php b/specs/new/global-scope-two-parts.php index 0e518c7d..fc48a47b 100644 --- a/specs/new/global-scope-two-parts.php +++ b/specs/new/global-scope-two-parts.php @@ -46,7 +46,7 @@ class Bar } namespace Humbug; -new \Humbug\Foo\Bar(); +new Foo\Bar(); PHP ], diff --git a/specs/new/namespace-single-part.php b/specs/new/namespace-single-part.php index 315ee527..b9c92db7 100644 --- a/specs/new/namespace-single-part.php +++ b/specs/new/namespace-single-part.php @@ -42,7 +42,7 @@ class Foo {} class Foo { } -new \Humbug\A\Foo(); +new Foo(); PHP ], diff --git a/specs/new/namespace-two-parts.php b/specs/new/namespace-two-parts.php index 9b713753..464ada04 100644 --- a/specs/new/namespace-two-parts.php +++ b/specs/new/namespace-two-parts.php @@ -46,7 +46,7 @@ class Bar } namespace Humbug\X; -new \Humbug\X\Foo\Bar(); +new Foo\Bar(); PHP ], diff --git a/specs/special-keywords/self-parent-return-type.php b/specs/special-keywords/self-parent-return-type.php index bba30636..4f1096c0 100644 --- a/specs/special-keywords/self-parent-return-type.php +++ b/specs/special-keywords/self-parent-return-type.php @@ -81,7 +81,7 @@ public function getName() : string return $this->name; } } -class B extends \Humbug\A +class B extends A { public function normalize() : parent { @@ -90,7 +90,7 @@ public function normalize() : parent return $instance; } } -echo (new \Humbug\B('yo'))->normalize()->getName() . \PHP_EOL; +echo (new B('yo'))->normalize()->getName() . \PHP_EOL; PHP , @@ -156,7 +156,7 @@ public function getName() : string return $this->name; } } -class B extends \Humbug\Foo\A +class B extends A { public function normalize() : parent { diff --git a/specs/special-keywords/self-static-parent-const.php b/specs/special-keywords/self-static-parent-const.php index 1b957be2..3c5f8964 100644 --- a/specs/special-keywords/self-static-parent-const.php +++ b/specs/special-keywords/self-static-parent-const.php @@ -84,7 +84,7 @@ public function getName() : string return $this->name; } } -class B extends \Humbug\A +class B extends A { const FOO = 'BAR'; public function __construct(string $name) @@ -93,8 +93,8 @@ public function __construct(string $name) parent::FOO; } } -\Humbug\B::test(); -echo (new \Humbug\B('yo'))->getName() . \PHP_EOL; +B::test(); +echo (new B('yo'))->getName() . \PHP_EOL; PHP , @@ -164,7 +164,7 @@ public function getName() : string return $this->name; } } -class B extends \Humbug\Foo\A +class B extends A { const FOO = 'BAR'; public function __construct(string $name) diff --git a/specs/special-keywords/self-static-parent-method.php b/specs/special-keywords/self-static-parent-method.php index 05ce3ade..522800c4 100644 --- a/specs/special-keywords/self-static-parent-method.php +++ b/specs/special-keywords/self-static-parent-method.php @@ -108,7 +108,7 @@ public function with(self $arg) : self return $arg; } } -class B extends \Humbug\A +class B extends A { public function __construct(string $name) { @@ -119,8 +119,8 @@ public static function who() echo __METHOD__ . \PHP_EOL; } } -\Humbug\B::test(); -echo (new \Humbug\B('yo'))->getName() . \PHP_EOL; +B::test(); +echo (new B('yo'))->getName() . \PHP_EOL; PHP , @@ -214,7 +214,7 @@ public function with(self $arg) : self return $arg; } } -class B extends \Humbug\Foo\A +class B extends A { public function __construct(string $name) { diff --git a/specs/special-keywords/self-static-parent-static-var.php b/specs/special-keywords/self-static-parent-static-var.php index c277e71d..dcbf6d50 100644 --- a/specs/special-keywords/self-static-parent-static-var.php +++ b/specs/special-keywords/self-static-parent-static-var.php @@ -84,7 +84,7 @@ public function getName() : string return $this->name; } } -class B extends \Humbug\A +class B extends A { static $foo = 'BAR'; public function __construct(string $name) @@ -93,8 +93,8 @@ public function __construct(string $name) parent::$foo; } } -\Humbug\B::test(); -echo (new \Humbug\B('yo'))->getName() . \PHP_EOL; +B::test(); +echo (new B('yo'))->getName() . \PHP_EOL; PHP , @@ -164,7 +164,7 @@ public function getName() : string return $this->name; } } -class B extends \Humbug\Foo\A +class B extends A { static $foo = 'BAR'; public function __construct(string $name) diff --git a/specs/static-method/global-scope-single-part.php b/specs/static-method/global-scope-single-part.php index 0778535e..6d89cef0 100644 --- a/specs/static-method/global-scope-single-part.php +++ b/specs/static-method/global-scope-single-part.php @@ -39,7 +39,7 @@ class Command {} class Command { } -\Humbug\Command::main(); +Command::main(); PHP , diff --git a/specs/static-method/global-scope-two-parts.php b/specs/static-method/global-scope-two-parts.php index 851c1625..6f8d8138 100644 --- a/specs/static-method/global-scope-two-parts.php +++ b/specs/static-method/global-scope-two-parts.php @@ -45,7 +45,7 @@ class Bar } namespace Humbug; -\Humbug\Foo\Bar::main(); +Foo\Bar::main(); PHP , diff --git a/specs/static-method/namespace-single-part.php b/specs/static-method/namespace-single-part.php index aa631331..3a57b655 100644 --- a/specs/static-method/namespace-single-part.php +++ b/specs/static-method/namespace-single-part.php @@ -41,7 +41,7 @@ class Foo {} class Foo { } -\Humbug\A\Foo::main(); +Foo::main(); PHP , diff --git a/specs/static-method/namespace-two-parts.php b/specs/static-method/namespace-two-parts.php index 1257251f..3195dcc2 100644 --- a/specs/static-method/namespace-two-parts.php +++ b/specs/static-method/namespace-two-parts.php @@ -45,7 +45,7 @@ class Bar } namespace Humbug\X; -\Humbug\X\Foo\Bar::main(); +Foo\Bar::main(); PHP , @@ -101,7 +101,7 @@ class Bar \class_alias('Humbug\\X\\Foo\\Bar', 'X\\Foo\\Bar', \false); namespace Humbug\X; -\Humbug\X\Foo\Bar::main(); +Foo\Bar::main(); PHP ], diff --git a/specs/string-literal/array-var.php b/specs/string-literal/array-var.php index 2166d6ef..3f2fd271 100644 --- a/specs/string-literal/array-var.php +++ b/specs/string-literal/array-var.php @@ -56,7 +56,7 @@ namespace Humbug; $x = ['Humbug\\Symfony\\Component\\Yaml\\Ya_1' => 'Humbug\\Symfony\\Component\\Yaml\\Ya_1', 'Humbug\\Symfony\\Component\\Yaml\\Ya_1' => 'Humbug\\Symfony\\Component\\Yaml\\Ya_1', 'Humbug\\Symfony\\Component\\Yaml\\Ya_1' => 'Humbug\\Symfony\\Component\\Yaml\\Ya_1', 'Humbug\\Symfony\\Component\\Yaml\\Ya_1' => 'Humbug\\Symfony\\Component\\Yaml\\Ya_1', 'Closure', 'usedAttributes', 'FOO', 'PHP_EOL']; -(new \Humbug\X())->foo()(['Symfony\\Component\\Yaml\\Ya_1' => 'Symfony\\Component\\Yaml\\Ya_1', '\\Symfony\\Component\\Yaml\\Ya_1' => '\\Symfony\\Component\\Yaml\\Ya_1', 'Humbug\\Symfony\\Component\\Yaml\\Ya_1' => 'Humbug\\Symfony\\Component\\Yaml\\Ya_1', '\\Humbug\\Symfony\\Component\\Yaml\\Ya_1' => '\\Humbug\\Symfony\\Component\\Yaml\\Ya_1', 'Closure', 'usedAttributes', 'FOO', 'PHP_EOL']); +(new X())->foo()(['Symfony\\Component\\Yaml\\Ya_1' => 'Symfony\\Component\\Yaml\\Ya_1', '\\Symfony\\Component\\Yaml\\Ya_1' => '\\Symfony\\Component\\Yaml\\Ya_1', 'Humbug\\Symfony\\Component\\Yaml\\Ya_1' => 'Humbug\\Symfony\\Component\\Yaml\\Ya_1', '\\Humbug\\Symfony\\Component\\Yaml\\Ya_1' => '\\Humbug\\Symfony\\Component\\Yaml\\Ya_1', 'Closure', 'usedAttributes', 'FOO', 'PHP_EOL']); PHP , diff --git a/specs/string-literal/const.php b/specs/string-literal/const.php index 9314969b..7ee8b9da 100644 --- a/specs/string-literal/const.php +++ b/specs/string-literal/const.php @@ -144,7 +144,7 @@ class Yaml } namespace Humbug; -const X = \Humbug\Symfony\Component\Yaml\Yaml::class; +const X = Symfony\Component\Yaml\Yaml::class; const X = \Humbug\Symfony\Component\Yaml\Yaml::class; const X = \Humbug\Symfony\Component\Yaml\Yaml::class; const X = \Humbug\Symfony\Component\Yaml\Yaml::class; diff --git a/specs/string-literal/func-arg.php b/specs/string-literal/func-arg.php index 367d9830..32994c62 100644 --- a/specs/string-literal/func-arg.php +++ b/specs/string-literal/func-arg.php @@ -113,18 +113,18 @@ class_alias('\\DateTime', '\\DateTimeInterface'); namespace Humbug; -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('DateTime'); -\Humbug\foo('\\DateTime'); -\Humbug\foo('Swift'); -\Humbug\foo('\\Swift'); -\Humbug\foo(['DateTime', 'autoload']); -\Humbug\foo(['\\DateTime', 'autoload']); -\Humbug\foo(['Swift', 'autoload']); -\Humbug\foo(['\\Swift', 'autoload']); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('DateTime'); +foo('\\DateTime'); +foo('Swift'); +foo('\\Swift'); +foo(['DateTime', 'autoload']); +foo(['\\DateTime', 'autoload']); +foo(['Swift', 'autoload']); +foo(['\\Swift', 'autoload']); \spl_autoload_register(['Humbug\\Swift', 'autoload']); \spl_autoload_register(['Humbug\\Swift', 'autoload']); \spl_autoload_register(['Humbug\\Swift', 'autoload']); @@ -260,14 +260,14 @@ class_alias('DateTime', 'DateTimeInterface'); namespace Humbug; -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('DateTime'); -\Humbug\foo('Swift'); -\Humbug\foo(['DateTime', 'autoload']); -\Humbug\foo(['Swift', 'autoload']); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('DateTime'); +foo('Swift'); +foo(['DateTime', 'autoload']); +foo(['Swift', 'autoload']); (function ($x = 'Humbug\\Symfony\\Component\\Yaml\\Ya_1') { })(); (function ($x = 'Humbug\\Symfony\\Component\\Yaml\\Ya_1') { @@ -391,14 +391,14 @@ class_alias('DateTime', 'DateTimeInterface'); namespace Humbug; -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); -\Humbug\foo('DateTime'); -\Humbug\foo('Swift'); -\Humbug\foo(['DateTime', 'autoload']); -\Humbug\foo(['Swift', 'autoload']); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1'); +foo('DateTime'); +foo('Swift'); +foo(['DateTime', 'autoload']); +foo(['Swift', 'autoload']); \spl_autoload_register(['Humbug\\Swift', 'autoload']); \spl_autoload_register(['Humbug\\Swift', 'autoload']); \spl_autoload_register(['Humbug\\Swift', 'autoload']); @@ -463,9 +463,9 @@ class_alias('Swift'.'', 'Mailer'.''); namespace Humbug; -\Humbug\foo('Symfony\\Component' . '\\Yaml\\Ya_1'); -\Humbug\foo('\\Symfony\\Component' . '\\Yaml\\Ya_1'); -\Humbug\foo('Swift' . ''); +foo('Symfony\\Component' . '\\Yaml\\Ya_1'); +foo('\\Symfony\\Component' . '\\Yaml\\Ya_1'); +foo('Swift' . ''); \spl_autoload_register(['Swift' . '', 'autoload']); \is_a($swift, 'Swift' . ''); \is_subclass_of($swift, 'Swift' . ''); @@ -538,14 +538,14 @@ class Yaml } namespace Humbug; -\Humbug\foo(\Humbug\Symfony\Component\Yaml\Yaml::class); -\Humbug\foo(\Humbug\Symfony\Component\Yaml\Yaml::class); -\Humbug\foo(\Humbug\Symfony\Component\Yaml\Yaml::class); -\Humbug\foo(\Humbug\Symfony\Component\Yaml\Yaml::class); -\Humbug\foo(\DateTime::class); -\Humbug\foo(\Humbug\Swift::class); -\Humbug\foo([\DateTime::class, 'autoload']); -\Humbug\foo([\Humbug\Swift::class, 'autoload']); +foo(Symfony\Component\Yaml\Yaml::class); +foo(\Humbug\Symfony\Component\Yaml\Yaml::class); +foo(\Humbug\Symfony\Component\Yaml\Yaml::class); +foo(\Humbug\Symfony\Component\Yaml\Yaml::class); +foo(\DateTime::class); +foo(\Humbug\Swift::class); +foo([\DateTime::class, 'autoload']); +foo([\Humbug\Swift::class, 'autoload']); \spl_autoload_register([\Humbug\Swift::class, 'autoload']); \spl_autoload_register([\Humbug\Swift::class, 'autoload']); \spl_autoload_register([\DateTime::class, 'autoload']); @@ -603,10 +603,10 @@ class Ya_1 \class_alias('Humbug\\Symfony\\Component\\Yaml\\Ya_1', 'Symfony\\Component\\Yaml\\Ya_1', \false); namespace Humbug; -\Humbug\foo(\Humbug\Symfony\Component\Yaml\Ya_1::class); -\Humbug\foo(\Humbug\Symfony\Component\Yaml\Ya_1::class); -\Humbug\foo(\Humbug\Symfony\Component\Yaml\Ya_1::class); -\Humbug\foo(\Humbug\Symfony\Component\Yaml\Ya_1::class); +foo(\Humbug\Symfony\Component\Yaml\Ya_1::class); +foo(\Humbug\Symfony\Component\Yaml\Ya_1::class); +foo(\Humbug\Symfony\Component\Yaml\Ya_1::class); +foo(\Humbug\Symfony\Component\Yaml\Ya_1::class); PHP ], diff --git a/specs/string-literal/method-arg.php b/specs/string-literal/method-arg.php index 9d3218f9..886cc5d6 100644 --- a/specs/string-literal/method-arg.php +++ b/specs/string-literal/method-arg.php @@ -49,8 +49,8 @@ function foo($x = 'Humbug\\Symfony\\Component\\Yaml\\Ya_1', $y = 'Foo') { } } -(new \Humbug\X())->foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1', $y = 'Foo'); -$x = new \Humbug\X(); +(new X())->foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1', $y = 'Foo'); +$x = new X(); $x->foo()('Humbug\\Symfony\\Component\\Yaml\\Ya_1', $y = 'Foo'); PHP @@ -76,7 +76,7 @@ static function foo($x = 'Humbug\\Symfony\\Component\\Yaml\\Ya_1', $y = 'Foo') { } } -\Humbug\X::foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1', $y = 'Foo'); +X::foo('Humbug\\Symfony\\Component\\Yaml\\Ya_1', $y = 'Foo'); PHP , diff --git a/specs/string-literal/new.php b/specs/string-literal/new.php index a6d5eeb8..1d135516 100644 --- a/specs/string-literal/new.php +++ b/specs/string-literal/new.php @@ -42,14 +42,14 @@ namespace Humbug; -new \Humbug\X('Yaml', ['Yaml']); -new \Humbug\X('\\Yaml', ['\\Yaml']); -new \Humbug\X('Closure', ['Closure']); -new \Humbug\X('\\Closure', ['\\Closure']); -new \Humbug\X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); -new \Humbug\X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); -new \Humbug\X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); -new \Humbug\X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); +new X('Yaml', ['Yaml']); +new X('\\Yaml', ['\\Yaml']); +new X('Closure', ['Closure']); +new X('\\Closure', ['\\Closure']); +new X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); +new X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); +new X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); +new X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); PHP , @@ -70,11 +70,11 @@ namespace Humbug; -new \Humbug\X('Humbug\\Symfony\\Component\\Yaml\\Ya_1l', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1l']); -new \Humbug\X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); -new \Humbug\X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); -new \Humbug\X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); -new \Humbug\X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); +new X('Humbug\\Symfony\\Component\\Yaml\\Ya_1l', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1l']); +new X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); +new X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); +new X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); +new X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); PHP ], @@ -95,11 +95,11 @@ namespace Humbug; -new \Humbug\X('Humbug\\Symfony\\Yaml', ['Humbug\\Symfony\\Yaml']); -new \Humbug\X('Symfony\\Component\\Yaml\\Ya_1', ['Symfony\\Component\\Yaml\\Ya_1']); -new \Humbug\X('\\Symfony\\Component\\Yaml\\Ya_1', ['\\Symfony\\Component\\Yaml\\Ya_1']); -new \Humbug\X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); -new \Humbug\X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); +new X('Humbug\\Symfony\\Yaml', ['Humbug\\Symfony\\Yaml']); +new X('Symfony\\Component\\Yaml\\Ya_1', ['Symfony\\Component\\Yaml\\Ya_1']); +new X('\\Symfony\\Component\\Yaml\\Ya_1', ['\\Symfony\\Component\\Yaml\\Ya_1']); +new X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); +new X('Humbug\\Symfony\\Component\\Yaml\\Ya_1', ['Humbug\\Symfony\\Component\\Yaml\\Ya_1']); PHP ], @@ -115,8 +115,8 @@ namespace Humbug; -new \Humbug\X('Symfony\\Component' . '\\Yaml\\Ya_1', ['Symfony\\Component' . '\\Yaml\\Ya_1']); -new \Humbug\X('\\Symfony\\Component' . '\\Yaml\\Ya_1', ['\\Symfony\\Component' . '\\Yaml\\Ya_1']); +new X('Symfony\\Component' . '\\Yaml\\Ya_1', ['Symfony\\Component' . '\\Yaml\\Ya_1']); +new X('\\Symfony\\Component' . '\\Yaml\\Ya_1', ['\\Symfony\\Component' . '\\Yaml\\Ya_1']); PHP , @@ -144,10 +144,10 @@ class Yaml } namespace Humbug; -new \Humbug\X(\Humbug\Symfony\Component\Yaml\Yaml::class, [\Humbug\Symfony\Component\Yaml\Yaml::class]); -new \Humbug\X(\Humbug\Symfony\Component\Yaml\Yaml::class, [\Humbug\Symfony\Component\Yaml\Yaml::class]); -new \Humbug\X(\Humbug\Symfony\Component\Yaml\Yaml::class, [\Humbug\Symfony\Component\Yaml\Yaml::class]); -new \Humbug\X(\Humbug\Symfony\Component\Yaml\Yaml::class, [\Humbug\Symfony\Component\Yaml\Yaml::class]); +new X(Symfony\Component\Yaml\Yaml::class, [Symfony\Component\Yaml\Yaml::class]); +new X(\Humbug\Symfony\Component\Yaml\Yaml::class, [\Humbug\Symfony\Component\Yaml\Yaml::class]); +new X(\Humbug\Symfony\Component\Yaml\Yaml::class, [\Humbug\Symfony\Component\Yaml\Yaml::class]); +new X(\Humbug\Symfony\Component\Yaml\Yaml::class, [\Humbug\Symfony\Component\Yaml\Yaml::class]); PHP , @@ -181,10 +181,10 @@ class Ya_1 \class_alias('Humbug\\Symfony\\Component\\Yaml\\Ya_1', 'Symfony\\Component\\Yaml\\Ya_1', \false); namespace Humbug; -new \Humbug\X(\Humbug\Symfony\Component\Yaml\Ya_1::class, [\Humbug\Symfony\Component\Yaml\Ya_1::class]); -new \Humbug\X(\Humbug\Symfony\Component\Yaml\Ya_1::class, [\Humbug\Symfony\Component\Yaml\Ya_1::class]); -new \Humbug\X(\Humbug\Symfony\Component\Yaml\Ya_1::class, [\Humbug\Symfony\Component\Yaml\Ya_1::class]); -new \Humbug\X(\Humbug\Symfony\Component\Yaml\Ya_1::class, [\Humbug\Symfony\Component\Yaml\Ya_1::class]); +new X(\Humbug\Symfony\Component\Yaml\Ya_1::class, [\Humbug\Symfony\Component\Yaml\Ya_1::class]); +new X(\Humbug\Symfony\Component\Yaml\Ya_1::class, [\Humbug\Symfony\Component\Yaml\Ya_1::class]); +new X(\Humbug\Symfony\Component\Yaml\Ya_1::class, [\Humbug\Symfony\Component\Yaml\Ya_1::class]); +new X(\Humbug\Symfony\Component\Yaml\Ya_1::class, [\Humbug\Symfony\Component\Yaml\Ya_1::class]); PHP ], diff --git a/specs/string-literal/var.php b/specs/string-literal/var.php index de6bd7b0..56aa90d5 100644 --- a/specs/string-literal/var.php +++ b/specs/string-literal/var.php @@ -161,7 +161,7 @@ class Yaml } namespace Humbug; -$x = \Humbug\Symfony\Component\Yaml\Yaml::class; +$x = Symfony\Component\Yaml\Yaml::class; $x = \Humbug\Symfony\Component\Yaml\Yaml::class; $x = \Humbug\Symfony\Component\Yaml\Yaml::class; $x = \Humbug\Symfony\Component\Yaml\Yaml::class; diff --git a/src/PhpParser/NodeVisitor/NameStmtPrefixer.php b/src/PhpParser/NodeVisitor/NameStmtPrefixer.php index 178ce198..4dc80a90 100644 --- a/src/PhpParser/NodeVisitor/NameStmtPrefixer.php +++ b/src/PhpParser/NodeVisitor/NameStmtPrefixer.php @@ -40,6 +40,7 @@ use PhpParser\Node\Stmt\Interface_; use PhpParser\Node\Stmt\Property; use PhpParser\NodeVisitorAbstract; +use function array_merge; use function count; use function in_array; @@ -157,7 +158,6 @@ private function prefixName(Name $name): Node // Do not prefix if there is a matching use statement. $useStatement = $this->useStatements->findStatementForNode($this->namespaceStatements->findNamespaceForNode($name), $name); - if ( $useStatement !== null && !($name instanceof FullyQualified) @@ -185,6 +185,28 @@ private function prefixName(Name $name): Node return $resolvedName; } + // Do not prefix if the Name is inside of the current namespace + $namespace = $this->namespaceStatements->getCurrentNamespaceName(); + if ( + ( + // In a namespace + $namespace !== null + && array_merge($namespace->parts, $name->parts) === $resolvedName->parts + ) + || ( + // In the global scope + $namespace === null + && $name->parts === $resolvedName->parts + && !($name instanceof FullyQualified) + && !($parentNode instanceof ConstFetch) + && !$this->whitelist->isSymbolWhitelisted($resolvedName->toString()) + && !$this->reflector->isFunctionInternal($resolvedName->toString()) + && !$this->reflector->isClassInternal($resolvedName->toString()) + ) + ) { + return $name; + } + // Check if the class can be prefixed if (false === ($parentNode instanceof ConstFetch || $parentNode instanceof FuncCall) && $this->reflector->isClassInternal($resolvedName->toString())