diff --git a/README.md b/README.md index 32c5e0a8..11257f48 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,7 @@ return [ 'patchers' => [], // callable[] 'whitelist' => [], // string[] 'whitelist-global-constants' => true, // bool + 'whitelist-global-classes' => true, // bool 'whitelist-global-functions' => true, // bool ]; ``` @@ -270,11 +271,11 @@ a PHPUnit PHAR with isolated code, you still want the PHAR to be able to understand the `PHPUnit\Framework\TestCase` class. -### Constants & functions from the global namespace +### Constants & Classes & functions from the global namespace -By default, PHP-Scoper will not prefix the user defined constants and functions -belonging to the global namespace. You can however change that setting for them -to be prefixed as usual unless explicitly whitelisted: +By default, PHP-Scoper will prefix the user defined constants, classes and +functions belonging to the global namespace. You can however change that +setting for them to be prefixed as usual unless explicitly whitelisted: ```php false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => false, ]; ``` diff --git a/specs/class/abstract.php b/class/abstract.php similarity index 87% rename from specs/class/abstract.php rename to class/abstract.php index 419fed07..f3eb4cf8 100644 --- a/specs/class/abstract.php +++ b/class/abstract.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], @@ -47,6 +48,35 @@ public abstract function b(); PHP , + 'Declaration in the global namespace with global classes whitelisted' => [ + 'whitelist-global-classes' => true, + 'registered-classes' => [ + ['A', 'Humbug\A'], + ], + 'payload' => <<<'PHP' + [ 'whitelist' => ['\*'], 'payload' => <<<'PHP' @@ -154,6 +184,34 @@ public abstract function b(); PHP , + 'Declaration in a namespace with global classes whitelisted' => [ + 'whitelist-global-classes' => true, + 'payload' => <<<'PHP' + [ 'whitelist' => ['Foo\*'], 'payload' => <<<'PHP' diff --git a/specs/class/anonymous.php b/class/anonymous.php similarity index 83% rename from specs/class/anonymous.php rename to class/anonymous.php index 4a61f26f..d373cd56 100644 --- a/specs/class/anonymous.php +++ b/class/anonymous.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], @@ -90,6 +91,80 @@ public function test() PHP , + 'Declaration in the global namespace with global classes whitelisted' => [ + 'whitelist-global-classes' => true, + 'registered-classes' => [ + ['A', 'Humbug\A'], + ['B', 'Humbug\B'], + ['C', 'Humbug\C'], + ], + 'payload' => <<<'PHP' + [ 'whitelist' => ['\*'], 'payload' => <<<'PHP' diff --git a/specs/class/conditional.php b/class/conditional.php similarity index 97% rename from specs/class/conditional.php rename to class/conditional.php index 28e03393..94aac641 100644 --- a/specs/class/conditional.php +++ b/class/conditional.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class/final.php b/class/final.php similarity index 73% rename from specs/class/final.php rename to class/final.php index 2a0812c8..f90409b2 100644 --- a/specs/class/final.php +++ b/class/final.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], @@ -40,6 +41,27 @@ final class A PHP , + 'Declaration in the global namespace with global classes whitelisted' => [ + 'whitelist-global-classes' => true, + 'registered-classes' => [ + ['A', 'Humbug\A'], + ], + 'payload' => <<<'PHP' + <<<'PHP' [ + 'whitelist-global-classes' => true, + 'payload' => <<<'PHP' + [ 'whitelist' => ['Foo\A'], 'registered-classes' => [ diff --git a/specs/class/interface.php b/class/interface.php similarity index 77% rename from specs/class/interface.php rename to class/interface.php index 507e0064..75ed9259 100644 --- a/specs/class/interface.php +++ b/class/interface.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], @@ -52,6 +53,41 @@ public function a(); PHP , + 'Declaration in the global namespace with global classes whitelisted' => [ + 'whitelist-global-classes' => true, + 'registered-classes' => [ + ['A', 'Humbug\A'], + ['C', 'Humbug\C'], + ['D', 'Humbug\D'], + ], + 'payload' => <<<'PHP' + <<<'PHP' [ + 'whitelist-global-classes' => true, + 'payload' => <<<'PHP' + [ 'whitelist' => ['Foo\A'], 'registered-classes' => [ diff --git a/specs/class/regular-extend.php b/class/regular-extend.php similarity index 98% rename from specs/class/regular-extend.php rename to class/regular-extend.php index afbad796..e69c8662 100644 --- a/specs/class/regular-extend.php +++ b/class/regular-extend.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class/regular.php b/class/regular.php similarity index 85% rename from specs/class/regular.php rename to class/regular.php index 0886e8b1..8e1766ed 100644 --- a/specs/class/regular.php +++ b/class/regular.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], @@ -45,6 +46,32 @@ public function a() PHP , + 'Declaration in the global namespace with global classes whitelisted' => [ + 'whitelist-global-classes' => true, + 'registered-classes' => [ + ['A', 'Humbug\A'], + ], + 'payload' => <<<'PHP' + <<<'PHP' [ + 'whitelist-global-classes' => true, + 'payload' => <<<'PHP' + [ 'whitelist' => ['Foo\A'], 'registered-classes' => [ diff --git a/specs/class/trait.php b/class/trait.php similarity index 84% rename from specs/class/trait.php rename to class/trait.php index e690279a..a54ea854 100644 --- a/specs/class/trait.php +++ b/class/trait.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], @@ -75,6 +76,62 @@ class B PHP , + 'Declaration in the global namespace with global classes whitelisted' => [ + 'whitelist-global-classes' => true, + 'registered-classes' => [ + ['B', 'Humbug\B'], + ], + 'payload' => <<<'PHP' + <<<'PHP' 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-FQ.php b/specs/class-FQ.php index 1618abc5..6af6ee75 100644 --- a/specs/class-FQ.php +++ b/specs/class-FQ.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/global-scope-single-level-with-single-level-use-statement-and-alias.php b/specs/class-const/global-scope-single-level-with-single-level-use-statement-and-alias.php index eaf4b1e9..42676893 100644 --- a/specs/class-const/global-scope-single-level-with-single-level-use-statement-and-alias.php +++ b/specs/class-const/global-scope-single-level-with-single-level-use-statement-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/global-scope-single-level-with-single-level-use-statement.php b/specs/class-const/global-scope-single-level-with-single-level-use-statement.php index e2cee3c6..ecd8c7a6 100644 --- a/specs/class-const/global-scope-single-level-with-single-level-use-statement.php +++ b/specs/class-const/global-scope-single-level-with-single-level-use-statement.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/global-scope-single-level.php b/specs/class-const/global-scope-single-level.php index 941bd43b..f54c9028 100644 --- a/specs/class-const/global-scope-single-level.php +++ b/specs/class-const/global-scope-single-level.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/global-scope-two-level-with-single-level-use-and-alias.php b/specs/class-const/global-scope-two-level-with-single-level-use-and-alias.php index 89068029..5a84033f 100644 --- a/specs/class-const/global-scope-two-level-with-single-level-use-and-alias.php +++ b/specs/class-const/global-scope-two-level-with-single-level-use-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/global-scope-two-level-with-single-level-use.php b/specs/class-const/global-scope-two-level-with-single-level-use.php index 7be1fb62..864fe24e 100644 --- a/specs/class-const/global-scope-two-level-with-single-level-use.php +++ b/specs/class-const/global-scope-two-level-with-single-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/global-scope-two-level.php b/specs/class-const/global-scope-two-level.php index 23cd268b..4ab8833c 100644 --- a/specs/class-const/global-scope-two-level.php +++ b/specs/class-const/global-scope-two-level.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/namespace-scope-single-level-with-single-level-use-statement-and-alias.php b/specs/class-const/namespace-scope-single-level-with-single-level-use-statement-and-alias.php index 794caf8c..33b01a67 100644 --- a/specs/class-const/namespace-scope-single-level-with-single-level-use-statement-and-alias.php +++ b/specs/class-const/namespace-scope-single-level-with-single-level-use-statement-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/namespace-scope-single-level.php b/specs/class-const/namespace-scope-single-level.php index fb29df21..95ea189d 100644 --- a/specs/class-const/namespace-scope-single-level.php +++ b/specs/class-const/namespace-scope-single-level.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/namespace-scope-two-level-with-single-level-use-and-alias.php b/specs/class-const/namespace-scope-two-level-with-single-level-use-and-alias.php index 02c45b4a..ad9f38d0 100644 --- a/specs/class-const/namespace-scope-two-level-with-single-level-use-and-alias.php +++ b/specs/class-const/namespace-scope-two-level-with-single-level-use-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/namespace-scope-two-level-with-single-level-use.php b/specs/class-const/namespace-scope-two-level-with-single-level-use.php index f60340eb..39e7c747 100644 --- a/specs/class-const/namespace-scope-two-level-with-single-level-use.php +++ b/specs/class-const/namespace-scope-two-level-with-single-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/namespace-scope-two-level.php b/specs/class-const/namespace-scope-two-level.php index e3ceac35..42b67328 100644 --- a/specs/class-const/namespace-scope-two-level.php +++ b/specs/class-const/namespace-scope-two-level.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-const/namespace-single-part-with-single-level-use-statement.php b/specs/class-const/namespace-single-part-with-single-level-use-statement.php index 336ae183..82738b39 100644 --- a/specs/class-const/namespace-single-part-with-single-level-use-statement.php +++ b/specs/class-const/namespace-single-part-with-single-level-use-statement.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/global-scope-single-level-with-single-level-use-statement-and-alias.php b/specs/class-static-prop/global-scope-single-level-with-single-level-use-statement-and-alias.php index f5a43165..e91f3e46 100644 --- a/specs/class-static-prop/global-scope-single-level-with-single-level-use-statement-and-alias.php +++ b/specs/class-static-prop/global-scope-single-level-with-single-level-use-statement-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/global-scope-single-level-with-single-level-use-statement.php b/specs/class-static-prop/global-scope-single-level-with-single-level-use-statement.php index 84ef395e..26ab6f0a 100644 --- a/specs/class-static-prop/global-scope-single-level-with-single-level-use-statement.php +++ b/specs/class-static-prop/global-scope-single-level-with-single-level-use-statement.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/global-scope-single-level.php b/specs/class-static-prop/global-scope-single-level.php index 0775ec0b..01d024b2 100644 --- a/specs/class-static-prop/global-scope-single-level.php +++ b/specs/class-static-prop/global-scope-single-level.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/global-scope-two-level-with-single-level-use-and-alias.php b/specs/class-static-prop/global-scope-two-level-with-single-level-use-and-alias.php index 43da4183..8979bb1d 100644 --- a/specs/class-static-prop/global-scope-two-level-with-single-level-use-and-alias.php +++ b/specs/class-static-prop/global-scope-two-level-with-single-level-use-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/global-scope-two-level-with-single-level-use.php b/specs/class-static-prop/global-scope-two-level-with-single-level-use.php index f046931a..d8d665ff 100644 --- a/specs/class-static-prop/global-scope-two-level-with-single-level-use.php +++ b/specs/class-static-prop/global-scope-two-level-with-single-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/global-scope-two-level.php b/specs/class-static-prop/global-scope-two-level.php index 9185701f..5cfa5a91 100644 --- a/specs/class-static-prop/global-scope-two-level.php +++ b/specs/class-static-prop/global-scope-two-level.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/namespace-scope-single-level-with-single-level-use-statement-and-alias.php b/specs/class-static-prop/namespace-scope-single-level-with-single-level-use-statement-and-alias.php index 3bfc7ae6..aa4e9a01 100644 --- a/specs/class-static-prop/namespace-scope-single-level-with-single-level-use-statement-and-alias.php +++ b/specs/class-static-prop/namespace-scope-single-level-with-single-level-use-statement-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/namespace-scope-single-level.php b/specs/class-static-prop/namespace-scope-single-level.php index 296332fe..a017037e 100644 --- a/specs/class-static-prop/namespace-scope-single-level.php +++ b/specs/class-static-prop/namespace-scope-single-level.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/namespace-scope-two-level-with-single-level-use-and-alias.php b/specs/class-static-prop/namespace-scope-two-level-with-single-level-use-and-alias.php index 840cee23..61ec22d6 100644 --- a/specs/class-static-prop/namespace-scope-two-level-with-single-level-use-and-alias.php +++ b/specs/class-static-prop/namespace-scope-two-level-with-single-level-use-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/namespace-scope-two-level-with-single-level-use.php b/specs/class-static-prop/namespace-scope-two-level-with-single-level-use.php index 3ad9e6e0..b39a93b6 100644 --- a/specs/class-static-prop/namespace-scope-two-level-with-single-level-use.php +++ b/specs/class-static-prop/namespace-scope-two-level-with-single-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/namespace-scope-two-level.php b/specs/class-static-prop/namespace-scope-two-level.php index e7dabc01..a81dbbfd 100644 --- a/specs/class-static-prop/namespace-scope-two-level.php +++ b/specs/class-static-prop/namespace-scope-two-level.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/class-static-prop/namespace-single-part-with-single-level-use-statement.php b/specs/class-static-prop/namespace-single-part-with-single-level-use-statement.php index 50a82675..5a39f961 100644 --- a/specs/class-static-prop/namespace-single-part-with-single-level-use-statement.php +++ b/specs/class-static-prop/namespace-single-part-with-single-level-use-statement.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/const-declaration-with-global-whitelisting.php b/specs/const/const-declaration-with-global-whitelisting.php index 9cc22438..1438baad 100644 --- a/specs/const/const-declaration-with-global-whitelisting.php +++ b/specs/const/const-declaration-with-global-whitelisting.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/const-declaration.php b/specs/const/const-declaration.php index 50d74d93..0806f973 100644 --- a/specs/const/const-declaration.php +++ b/specs/const/const-declaration.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/global-scope-global-with-global-whitelisting.php b/specs/const/global-scope-global-with-global-whitelisting.php index e3f308b3..418d5040 100644 --- a/specs/const/global-scope-global-with-global-whitelisting.php +++ b/specs/const/global-scope-global-with-global-whitelisting.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/global-scope-global-with-single-level-use-statement-and-alias.php b/specs/const/global-scope-global-with-single-level-use-statement-and-alias.php index 480bfab6..2dffaaaf 100644 --- a/specs/const/global-scope-global-with-single-level-use-statement-and-alias.php +++ b/specs/const/global-scope-global-with-single-level-use-statement-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/global-scope-global-with-single-level-use-statement-with-global-whitelisting.php b/specs/const/global-scope-global-with-single-level-use-statement-with-global-whitelisting.php index b1cd1596..0e8086be 100644 --- a/specs/const/global-scope-global-with-single-level-use-statement-with-global-whitelisting.php +++ b/specs/const/global-scope-global-with-single-level-use-statement-with-global-whitelisting.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/global-scope-global-with-single-level-use-statement.php b/specs/const/global-scope-global-with-single-level-use-statement.php index ec9693f3..6020ff04 100644 --- a/specs/const/global-scope-global-with-single-level-use-statement.php +++ b/specs/const/global-scope-global-with-single-level-use-statement.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/global-scope-global.php b/specs/const/global-scope-global.php index b7be1b85..9d9dc109 100644 --- a/specs/const/global-scope-global.php +++ b/specs/const/global-scope-global.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/global-scope-single-part-namespaced-with-single-level-use-alias.php b/specs/const/global-scope-single-part-namespaced-with-single-level-use-alias.php index 225437a8..85615ee4 100644 --- a/specs/const/global-scope-single-part-namespaced-with-single-level-use-alias.php +++ b/specs/const/global-scope-single-part-namespaced-with-single-level-use-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/global-scope-single-part-namespaced-with-single-level-use.php b/specs/const/global-scope-single-part-namespaced-with-single-level-use.php index 93b67725..01d0d7d4 100644 --- a/specs/const/global-scope-single-part-namespaced-with-single-level-use.php +++ b/specs/const/global-scope-single-part-namespaced-with-single-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/global-scope-single-part-namespaced.php b/specs/const/global-scope-single-part-namespaced.php index ea3d82c8..5a718d50 100644 --- a/specs/const/global-scope-single-part-namespaced.php +++ b/specs/const/global-scope-single-part-namespaced.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/global-scope-two-parts-namespaced-with-single-level-use-and-alias.php b/specs/const/global-scope-two-parts-namespaced-with-single-level-use-and-alias.php index cdcad581..dbc9add0 100644 --- a/specs/const/global-scope-two-parts-namespaced-with-single-level-use-and-alias.php +++ b/specs/const/global-scope-two-parts-namespaced-with-single-level-use-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/global-scope-two-parts-namespaced-with-single-level-use.php b/specs/const/global-scope-two-parts-namespaced-with-single-level-use.php index 72e7fa61..a27e7092 100644 --- a/specs/const/global-scope-two-parts-namespaced-with-single-level-use.php +++ b/specs/const/global-scope-two-parts-namespaced-with-single-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/global-scope-two-parts-namespaced.php b/specs/const/global-scope-two-parts-namespaced.php index 01202d8e..7735025b 100644 --- a/specs/const/global-scope-two-parts-namespaced.php +++ b/specs/const/global-scope-two-parts-namespaced.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/namespace-global-with-global-whitelisting.php b/specs/const/namespace-global-with-global-whitelisting.php index 50c07a54..3d0f82af 100644 --- a/specs/const/namespace-global-with-global-whitelisting.php +++ b/specs/const/namespace-global-with-global-whitelisting.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/namespace-global-with-single-level-use-statement-and-alias.php b/specs/const/namespace-global-with-single-level-use-statement-and-alias.php index 932acb5d..7b609835 100644 --- a/specs/const/namespace-global-with-single-level-use-statement-and-alias.php +++ b/specs/const/namespace-global-with-single-level-use-statement-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/namespace-global-with-single-level-use-statement.php b/specs/const/namespace-global-with-single-level-use-statement.php index 62e8908b..2fea5c35 100644 --- a/specs/const/namespace-global-with-single-level-use-statement.php +++ b/specs/const/namespace-global-with-single-level-use-statement.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/namespace-global.php b/specs/const/namespace-global.php index cfc1e806..2360f943 100644 --- a/specs/const/namespace-global.php +++ b/specs/const/namespace-global.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/namespace-single-part-namespaced.php b/specs/const/namespace-single-part-namespaced.php index 96f9f515..8ab5b086 100644 --- a/specs/const/namespace-single-part-namespaced.php +++ b/specs/const/namespace-single-part-namespaced.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/native-const-with-global-whitelisting.php b/specs/const/native-const-with-global-whitelisting.php index 007a848a..7a6d9f47 100644 --- a/specs/const/native-const-with-global-whitelisting.php +++ b/specs/const/native-const-with-global-whitelisting.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/const/native-const.php b/specs/const/native-const.php index 26dda4aa..d72bb114 100644 --- a/specs/const/native-const.php +++ b/specs/const/native-const.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/exp/cast.php b/specs/exp/cast.php index ec82e97f..373d82a5 100644 --- a/specs/exp/cast.php +++ b/specs/exp/cast.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/exp/catch.php b/specs/exp/catch.php index 63fc4bb1..50e7eebb 100644 --- a/specs/exp/catch.php +++ b/specs/exp/catch.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/exp/instanceof.php b/specs/exp/instanceof.php index 408d4a74..62fdfc97 100644 --- a/specs/exp/instanceof.php +++ b/specs/exp/instanceof.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/func-declaration/global.php b/specs/func-declaration/global.php index b42d1286..88e5b758 100644 --- a/specs/func-declaration/global.php +++ b/specs/func-declaration/global.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/func-declaration/method.php b/specs/func-declaration/method.php index 93893b38..6f49d379 100644 --- a/specs/func-declaration/method.php +++ b/specs/func-declaration/method.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/func-declaration/namespace.php b/specs/func-declaration/namespace.php index 01c77b71..e4a0a224 100644 --- a/specs/func-declaration/namespace.php +++ b/specs/func-declaration/namespace.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/global-scope-global-func-with-single-level-use-statement-and-alias.php b/specs/function/global-scope-global-func-with-single-level-use-statement-and-alias.php index 6e07df6e..4b614547 100644 --- a/specs/function/global-scope-global-func-with-single-level-use-statement-and-alias.php +++ b/specs/function/global-scope-global-func-with-single-level-use-statement-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/global-scope-global-func-with-single-level-use-statement.php b/specs/function/global-scope-global-func-with-single-level-use-statement.php index 498ac2e4..a6cc9c3c 100644 --- a/specs/function/global-scope-global-func-with-single-level-use-statement.php +++ b/specs/function/global-scope-global-func-with-single-level-use-statement.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/global-scope-global-func.php b/specs/function/global-scope-global-func.php index 36b2e566..298bdb73 100644 --- a/specs/function/global-scope-global-func.php +++ b/specs/function/global-scope-global-func.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/global-scope-single-part-namespaced-func-with-single-level-use-and-alias.php b/specs/function/global-scope-single-part-namespaced-func-with-single-level-use-and-alias.php index dc602104..d4ab3b7e 100644 --- a/specs/function/global-scope-single-part-namespaced-func-with-single-level-use-and-alias.php +++ b/specs/function/global-scope-single-part-namespaced-func-with-single-level-use-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/global-scope-single-part-namespaced-func-with-single-level-use.php b/specs/function/global-scope-single-part-namespaced-func-with-single-level-use.php index 2d4d3d51..22a3c19f 100644 --- a/specs/function/global-scope-single-part-namespaced-func-with-single-level-use.php +++ b/specs/function/global-scope-single-part-namespaced-func-with-single-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/global-scope-single-part-namespaced-func.php b/specs/function/global-scope-single-part-namespaced-func.php index 9fec4b99..ae939177 100644 --- a/specs/function/global-scope-single-part-namespaced-func.php +++ b/specs/function/global-scope-single-part-namespaced-func.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/namespace-global-func-with-single-level-use-statement-and-alias.php b/specs/function/namespace-global-func-with-single-level-use-statement-and-alias.php index d5002b1c..e3a898ef 100644 --- a/specs/function/namespace-global-func-with-single-level-use-statement-and-alias.php +++ b/specs/function/namespace-global-func-with-single-level-use-statement-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/namespace-global-func-with-single-level-use-statement.php b/specs/function/namespace-global-func-with-single-level-use-statement.php index 27c06089..e8106997 100644 --- a/specs/function/namespace-global-func-with-single-level-use-statement.php +++ b/specs/function/namespace-global-func-with-single-level-use-statement.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/namespace-global-func.php b/specs/function/namespace-global-func.php index 5796f70f..30141650 100644 --- a/specs/function/namespace-global-func.php +++ b/specs/function/namespace-global-func.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/namespace-global-scope-func.php b/specs/function/namespace-global-scope-func.php index 4921259f..71133c9d 100644 --- a/specs/function/namespace-global-scope-func.php +++ b/specs/function/namespace-global-scope-func.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/namespace-single-part-namespaced-func.php b/specs/function/namespace-single-part-namespaced-func.php index db59c57c..98d62bd1 100644 --- a/specs/function/namespace-single-part-namespaced-func.php +++ b/specs/function/namespace-single-part-namespaced-func.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/function/native-func.php b/specs/function/native-func.php index 2f9bb8b9..0c4e1950 100644 --- a/specs/function/native-func.php +++ b/specs/function/native-func.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/misc.php b/specs/misc.php index 65264187..b0467fd8 100644 --- a/specs/misc.php +++ b/specs/misc.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/namespace/after-hashbang.php b/specs/namespace/after-hashbang.php index 7d04cbf6..1ead404a 100644 --- a/specs/namespace/after-hashbang.php +++ b/specs/namespace/after-hashbang.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/namespace/braces.php b/specs/namespace/braces.php index 5ee92d11..de98b262 100644 --- a/specs/namespace/braces.php +++ b/specs/namespace/braces.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/namespace/creation-for-whitelist.php b/specs/namespace/creation-for-whitelist.php index c521dba1..0446a8ea 100644 --- a/specs/namespace/creation-for-whitelist.php +++ b/specs/namespace/creation-for-whitelist.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/namespace/no-braces.php b/specs/namespace/no-braces.php index 292d612c..b23cd523 100644 --- a/specs/namespace/no-braces.php +++ b/specs/namespace/no-braces.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/namespace/outside-statements.php b/specs/namespace/outside-statements.php index 503d154b..8855a569 100644 --- a/specs/namespace/outside-statements.php +++ b/specs/namespace/outside-statements.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/new/global-scope-single-part-with-single-level-use-statement-an-alias.php b/specs/new/global-scope-single-part-with-single-level-use-statement-an-alias.php index 22812053..50e6c285 100644 --- a/specs/new/global-scope-single-part-with-single-level-use-statement-an-alias.php +++ b/specs/new/global-scope-single-part-with-single-level-use-statement-an-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/new/global-scope-single-part-with-single-level-use-statement.php b/specs/new/global-scope-single-part-with-single-level-use-statement.php index d4c9faad..1656b8d7 100644 --- a/specs/new/global-scope-single-part-with-single-level-use-statement.php +++ b/specs/new/global-scope-single-part-with-single-level-use-statement.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/new/global-scope-single-part.php b/specs/new/global-scope-single-part.php index 3484ce3c..be42c907 100644 --- a/specs/new/global-scope-single-part.php +++ b/specs/new/global-scope-single-part.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/new/global-scope-two-parts-with-single-level-use-and-alias.php b/specs/new/global-scope-two-parts-with-single-level-use-and-alias.php index 85d12fa6..c97312c7 100644 --- a/specs/new/global-scope-two-parts-with-single-level-use-and-alias.php +++ b/specs/new/global-scope-two-parts-with-single-level-use-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/new/global-scope-two-parts-with-single-level-use.php b/specs/new/global-scope-two-parts-with-single-level-use.php index 33bf6331..56f7b4e5 100644 --- a/specs/new/global-scope-two-parts-with-single-level-use.php +++ b/specs/new/global-scope-two-parts-with-single-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/new/global-scope-two-parts.php b/specs/new/global-scope-two-parts.php index 21744270..0e518c7d 100644 --- a/specs/new/global-scope-two-parts.php +++ b/specs/new/global-scope-two-parts.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/new/namespace-single-part-with-single-level-use-statement.php b/specs/new/namespace-single-part-with-single-level-use-statement.php index 9e6d9bcf..52b74990 100644 --- a/specs/new/namespace-single-part-with-single-level-use-statement.php +++ b/specs/new/namespace-single-part-with-single-level-use-statement.php @@ -20,6 +20,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/new/namespace-single-part.php b/specs/new/namespace-single-part.php index def0f0bd..315ee527 100644 --- a/specs/new/namespace-single-part.php +++ b/specs/new/namespace-single-part.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/new/namespace-two-parts-with-single-level-use.php b/specs/new/namespace-two-parts-with-single-level-use.php index f552efb3..d0ef96bf 100644 --- a/specs/new/namespace-two-parts-with-single-level-use.php +++ b/specs/new/namespace-two-parts-with-single-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/new/namespace-two-parts-with-two-level-use.php b/specs/new/namespace-two-parts-with-two-level-use.php index 02f0458f..dcece728 100644 --- a/specs/new/namespace-two-parts-with-two-level-use.php +++ b/specs/new/namespace-two-parts-with-two-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/new/namespace-two-parts.php b/specs/new/namespace-two-parts.php index 2932ab30..9b713753 100644 --- a/specs/new/namespace-two-parts.php +++ b/specs/new/namespace-two-parts.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/special-keywords/self-static-parent-const.php b/specs/special-keywords/self-static-parent-const.php index d28cff5e..2cfa1bae 100644 --- a/specs/special-keywords/self-static-parent-const.php +++ b/specs/special-keywords/self-static-parent-const.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/special-keywords/self-static-parent-method.php b/specs/special-keywords/self-static-parent-method.php index 17b582b3..9fddc508 100644 --- a/specs/special-keywords/self-static-parent-method.php +++ b/specs/special-keywords/self-static-parent-method.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/special-keywords/self-static-parent-static-var.php b/specs/special-keywords/self-static-parent-static-var.php index 793afc54..4e24fa47 100644 --- a/specs/special-keywords/self-static-parent-static-var.php +++ b/specs/special-keywords/self-static-parent-static-var.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/static-method/global-scope-single-part-with-single-level-use-statement-and-alias.php b/specs/static-method/global-scope-single-part-with-single-level-use-statement-and-alias.php index 798ddbc1..fe4d4c28 100644 --- a/specs/static-method/global-scope-single-part-with-single-level-use-statement-and-alias.php +++ b/specs/static-method/global-scope-single-part-with-single-level-use-statement-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/static-method/global-scope-single-part-with-single-level-use-statement.php b/specs/static-method/global-scope-single-part-with-single-level-use-statement.php index 79fb45fd..86e7296e 100644 --- a/specs/static-method/global-scope-single-part-with-single-level-use-statement.php +++ b/specs/static-method/global-scope-single-part-with-single-level-use-statement.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/static-method/global-scope-single-part.php b/specs/static-method/global-scope-single-part.php index b604e3cc..0778535e 100644 --- a/specs/static-method/global-scope-single-part.php +++ b/specs/static-method/global-scope-single-part.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/static-method/global-scope-two-parts-with-single-level-use-and-alias.php b/specs/static-method/global-scope-two-parts-with-single-level-use-and-alias.php index 366bed52..6864dba2 100644 --- a/specs/static-method/global-scope-two-parts-with-single-level-use-and-alias.php +++ b/specs/static-method/global-scope-two-parts-with-single-level-use-and-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/static-method/global-scope-two-parts-with-single-level-use.php b/specs/static-method/global-scope-two-parts-with-single-level-use.php index b85c54ca..817fe544 100644 --- a/specs/static-method/global-scope-two-parts-with-single-level-use.php +++ b/specs/static-method/global-scope-two-parts-with-single-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/static-method/global-scope-two-parts.php b/specs/static-method/global-scope-two-parts.php index 1027e51b..851c1625 100644 --- a/specs/static-method/global-scope-two-parts.php +++ b/specs/static-method/global-scope-two-parts.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/static-method/namespace-single-part-with-single-level-use-statement.php b/specs/static-method/namespace-single-part-with-single-level-use-statement.php index ffca3298..cc7e42f7 100644 --- a/specs/static-method/namespace-single-part-with-single-level-use-statement.php +++ b/specs/static-method/namespace-single-part-with-single-level-use-statement.php @@ -20,6 +20,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/static-method/namespace-single-part.php b/specs/static-method/namespace-single-part.php index 4d4b066f..aa631331 100644 --- a/specs/static-method/namespace-single-part.php +++ b/specs/static-method/namespace-single-part.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/static-method/namespace-two-parts-with-single-level-use.php b/specs/static-method/namespace-two-parts-with-single-level-use.php index d3ee81e9..623a9dab 100644 --- a/specs/static-method/namespace-two-parts-with-single-level-use.php +++ b/specs/static-method/namespace-two-parts-with-single-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/static-method/namespace-two-parts-with-two-level-use.php b/specs/static-method/namespace-two-parts-with-two-level-use.php index 3d87f16e..0a92f5ec 100644 --- a/specs/static-method/namespace-two-parts-with-two-level-use.php +++ b/specs/static-method/namespace-two-parts-with-two-level-use.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/static-method/namespace-two-parts.php b/specs/static-method/namespace-two-parts.php index eaca518c..1257251f 100644 --- a/specs/static-method/namespace-two-parts.php +++ b/specs/static-method/namespace-two-parts.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/use/use-class-alias.php b/specs/use/use-class-alias.php index d718bbf0..625ed7de 100644 --- a/specs/use/use-class-alias.php +++ b/specs/use/use-class-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/use/use-class-group.php b/specs/use/use-class-group.php index a1661b0d..c52df696 100644 --- a/specs/use/use-class-group.php +++ b/specs/use/use-class-group.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/use/use-class.php b/specs/use/use-class.php index 50b25385..e70e8526 100644 --- a/specs/use/use-class.php +++ b/specs/use/use-class.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/use/use-const-alias.php b/specs/use/use-const-alias.php index b6c8c703..70498c11 100644 --- a/specs/use/use-const-alias.php +++ b/specs/use/use-const-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/use/use-const-group.php b/specs/use/use-const-group.php index b043905a..83d41d68 100644 --- a/specs/use/use-const-group.php +++ b/specs/use/use-const-group.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/use/use-const.php b/specs/use/use-const.php index db1fee7e..eca8a068 100644 --- a/specs/use/use-const.php +++ b/specs/use/use-const.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/use/use-func-alias.php b/specs/use/use-func-alias.php index 6f65d3e3..b8297fb7 100644 --- a/specs/use/use-func-alias.php +++ b/specs/use/use-func-alias.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/use/use-func-group.php b/specs/use/use-func-group.php index 05202fce..4989d62c 100644 --- a/specs/use/use-func-group.php +++ b/specs/use/use-func-group.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/use/use-func.php b/specs/use/use-func.php index 0276fe85..77aff1e6 100644 --- a/specs/use/use-func.php +++ b/specs/use/use-func.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/use/use-mix-group.php b/specs/use/use-mix-group.php index a54a6ec3..d62ff455 100644 --- a/specs/use/use-mix-group.php +++ b/specs/use/use-mix-group.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => true, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/specs/whitelist-case-sensitiveness.php b/specs/whitelist-case-sensitiveness.php index 1fb159d2..bf4e2879 100644 --- a/specs/whitelist-case-sensitiveness.php +++ b/specs/whitelist-case-sensitiveness.php @@ -19,6 +19,7 @@ 'prefix' => 'Humbug', 'whitelist' => [], 'whitelist-global-constants' => false, + 'whitelist-global-classes' => false, 'whitelist-global-functions' => true, 'registered-classes' => [], 'registered-functions' => [], diff --git a/src/Configuration.php b/src/Configuration.php index adce798f..8207d4d3 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -33,6 +33,7 @@ class Configuration private const PATCHERS_KEYWORD = 'patchers'; private const WHITELIST_KEYWORD = 'whitelist'; private const WHITELIST_GLOBAL_CONSTANTS_KEYWORD = 'whitelist-global-constants'; + private const WHITELIST_GLOBAL_CLASSES_KEYWORD = 'whitelist-global-classes'; private const WHITELIST_GLOBAL_FUNCTIONS_KEYWORD = 'whitelist-global-functions'; private const KEYWORDS = [ @@ -283,7 +284,23 @@ private static function retrieveWhitelist(array $config): Whitelist sprintf( 'Expected %s to be a boolean, found "%s" instead.', self::WHITELIST_GLOBAL_CONSTANTS_KEYWORD, - gettype($whitelist) + gettype($whitelistGlobalConstants) + ) + ); + } + } + + if (false === array_key_exists(self::WHITELIST_GLOBAL_CLASSES_KEYWORD, $config)) { + $whitelistGlobalClasses = true; + } else { + $whitelistGlobalClasses = $config[self::WHITELIST_GLOBAL_CLASSES_KEYWORD]; + + if (false === is_bool($whitelistGlobalClasses)) { + throw new InvalidArgumentException( + sprintf( + 'Expected %s to be a boolean, found "%s" instead.', + self::WHITELIST_GLOBAL_CLASSES_KEYWORD, + gettype($whitelistGlobalClasses) ) ); } @@ -299,13 +316,13 @@ private static function retrieveWhitelist(array $config): Whitelist sprintf( 'Expected %s to be a boolean, found "%s" instead.', self::WHITELIST_GLOBAL_FUNCTIONS_KEYWORD, - gettype($whitelist) + gettype($whitelistGlobalFunctions) ) ); } } - return Whitelist::create($whitelistGlobalConstants, $whitelistGlobalFunctions, ...$whitelist); + return Whitelist::create($whitelistGlobalConstants, $whitelistGlobalClasses, $whitelistGlobalFunctions, ...$whitelist); } private static function retrieveFinders(array $config): array diff --git a/src/Whitelist.php b/src/Whitelist.php index 5b2d4471..413a3594 100644 --- a/src/Whitelist.php +++ b/src/Whitelist.php @@ -44,13 +44,18 @@ final class Whitelist implements Countable private $patterns; private $whitelistGlobalConstants; + private $whitelistGlobalClasses; private $whitelistGlobalFunctions; private $whitelistedFunctions = []; private $whitelistedClasses = []; - public static function create(bool $whitelistGlobalConstants, bool $whitelistGlobalFunctions, string ...$elements): self - { + public static function create( + bool $whitelistGlobalConstants, + bool $whitelistGlobalClasses, + bool $whitelistGlobalFunctions, + string ...$elements + ): self { $symbols = []; $constants = []; $namespaces = []; @@ -100,6 +105,7 @@ public static function create(bool $whitelistGlobalConstants, bool $whitelistGlo return new self( $whitelistGlobalConstants, + $whitelistGlobalClasses, $whitelistGlobalFunctions, array_unique($original), array_flip($symbols), @@ -128,6 +134,7 @@ private static function assertValidPattern(string $element): void */ private function __construct( bool $whitelistGlobalConstants, + bool $whitelistGlobalClasses, bool $whitelistGlobalFunctions, array $original, array $symbols, @@ -136,6 +143,7 @@ private function __construct( array $namespaces ) { $this->whitelistGlobalConstants = $whitelistGlobalConstants; + $this->whitelistGlobalClasses = $whitelistGlobalClasses; $this->whitelistGlobalFunctions = $whitelistGlobalFunctions; $this->original = $original; $this->symbols = $symbols; @@ -207,12 +215,12 @@ public function isGlobalWhitelistedConstant(string $constantName): bool */ public function whitelistGlobalClasses(): bool { - return $this->whitelistGlobalFunctions; + return $this->whitelistGlobalClasses; } public function isGlobalWhitelistedClass(string $className): bool { - return false; + return $this->whitelistGlobalClasses && false === strpos($className, '\\'); } public function recordWhitelistedClass(FullyQualified $original, FullyQualified $alias): void diff --git a/src/scoper.inc.php.tpl b/src/scoper.inc.php.tpl index 53b3a8de..315d36a9 100644 --- a/src/scoper.inc.php.tpl +++ b/src/scoper.inc.php.tpl @@ -64,11 +64,16 @@ return [ // If `true` then the user defined constants belonging to the global namespace will not be prefixed. // - // For more see https://github.com/humbug/php-scoper#constants-from-the-global-namespace-whitelisting + // For more see https://github.com/humbug/php-scoper#constants--constants--functions-from-the-global-namespace + 'whitelist-global-constants' => true, + + // If `true` then the user defined classes belonging to the global namespace will not be prefixed. + // + // For more see https://github.com/humbug/php-scoper#constants--constants--functions-from-the-global-namespace 'whitelist-global-constants' => true, // If `true` then the user defined functions belonging to the global namespace will not be prefixed. // - // For more see https://github.com/humbug/php-scoper#global-user-functions + // For more see https://github.com/humbug/php-scoper#constants--constants--functions-from-the-global-namespace 'whitelist-global-functions' => true, ]; diff --git a/tests/Autoload/ScoperAutoloadGeneratorTest.php b/tests/Autoload/ScoperAutoloadGeneratorTest.php index 2171b39d..c1cf94a7 100644 --- a/tests/Autoload/ScoperAutoloadGeneratorTest.php +++ b/tests/Autoload/ScoperAutoloadGeneratorTest.php @@ -37,7 +37,7 @@ public function test_generate_the_autoload(Whitelist $whitelist, string $expecte public function provideWhitelists() { yield [ - Whitelist::create(true, true), + Whitelist::create(true, true, true), <<<'PHP' recordWhitelistedFunction( new FullyQualified('foo'), @@ -112,7 +112,7 @@ function bar() { yield [ (function () { - $whitelist = Whitelist::create(true, true); + $whitelist = Whitelist::create(true, true, true); $whitelist->recordWhitelistedFunction( new FullyQualified('Acme\foo'), @@ -173,7 +173,7 @@ function baz() { yield [ (function () { - $whitelist = Whitelist::create(true, true, 'A\Foo', 'B\Bar'); + $whitelist = Whitelist::create(true, true, true, 'A\Foo', 'B\Bar'); $whitelist->recordWhitelistedFunction( new FullyQualified('foo'), diff --git a/tests/Console/Command/AddPrefixCommandTest.php b/tests/Console/Command/AddPrefixCommandTest.php index 42d3dac9..529777c7 100644 --- a/tests/Console/Command/AddPrefixCommandTest.php +++ b/tests/Console/Command/AddPrefixCommandTest.php @@ -174,7 +174,7 @@ public function test_scope_the_given_paths() $inputContents, 'MyPrefix', [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willReturn($prefixedContents) ; @@ -237,7 +237,7 @@ public function test_let_the_file_unchanged_when_cannot_scope_a_file() $inputContents, 'MyPrefix', [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willReturn($prefixedContents) ; @@ -250,7 +250,7 @@ public function test_let_the_file_unchanged_when_cannot_scope_a_file() $inputContents, 'MyPrefix', [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willThrow(new \RuntimeException('Scoping of the file failed')) ; @@ -310,7 +310,7 @@ public function test_do_not_scope_duplicated_given_paths() $inputContents, 'MyPrefix', [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willReturn($prefixedContents) ; @@ -371,7 +371,7 @@ public function test_scope_the_given_paths_and_the_ones_found_by_the_finder() $inputContents, 'MyPrefix', [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willReturn($prefixedFileContents) ; @@ -425,7 +425,7 @@ function (string $prefix): bool { } ), [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willReturn('') ; @@ -483,7 +483,7 @@ public function test_scope_the_current_working_directory_if_no_path_given() $inputContents, 'MyPrefix', [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willReturn($prefixedContents) ; @@ -529,7 +529,7 @@ public function test_prefix_can_end_by_a_backslash() Argument::any(), 'MyPrefix', [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willReturn('') ; @@ -572,7 +572,7 @@ public function test_prefix_can_end_by_multiple_backslashes() Argument::any(), 'MyPrefix', [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willReturn('') ; @@ -630,7 +630,7 @@ public function test_an_output_directory_can_be_given() $inputContents, 'MyPrefix', [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willReturn($prefixedContents) ; @@ -692,7 +692,7 @@ public function test_relative_output_directory_are_made_absolute() $inputContents, 'MyPrefix', [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willReturn($prefixedContents) ; @@ -783,7 +783,7 @@ public function test_attempts_to_use_patch_file_in_current_directory() return true; }), - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willReturn($prefixedContents) ; @@ -868,7 +868,7 @@ public function test_can_scope_projects_with_invalid_files() $fileContents, 'MyPrefix', [], - Whitelist::create(true, true) + Whitelist::create(true, true, true) ) ->willThrow($scopingException = new RuntimeException('Could not scope file')) ; diff --git a/tests/PhpParser/TraverserFactoryTest.php b/tests/PhpParser/TraverserFactoryTest.php index 5f6e3596..88a62ef6 100644 --- a/tests/PhpParser/TraverserFactoryTest.php +++ b/tests/PhpParser/TraverserFactoryTest.php @@ -28,7 +28,7 @@ public function test_creates_a_new_traverser_at_each_call() { $prefix = 'Humbug'; - $whitelist = Whitelist::create(true, true, 'Foo'); + $whitelist = Whitelist::create(true, true, true, 'Foo'); $classReflector = new Reflector( (new BetterReflection())->classReflector(), diff --git a/tests/Scoper/Composer/InstalledPackagesScoperTest.php b/tests/Scoper/Composer/InstalledPackagesScoperTest.php index 033ad349..4f980361 100644 --- a/tests/Scoper/Composer/InstalledPackagesScoperTest.php +++ b/tests/Scoper/Composer/InstalledPackagesScoperTest.php @@ -39,7 +39,7 @@ public function test_delegates_scoping_to_the_decorated_scoper_if_is_not_a_insta $fileContents = ''; $prefix = 'Humbug'; $patchers = [create_fake_patcher()]; - $whitelist = Whitelist::create(true, true, 'Foo'); + $whitelist = Whitelist::create(true, true, true, 'Foo'); /** @var Scoper|ObjectProphecy $decoratedScoperProphecy */ $decoratedScoperProphecy = $this->prophesize(Scoper::class); @@ -72,7 +72,7 @@ public function test_it_prefixes_the_composer_autoloaders(string $fileContents, $prefix = 'Foo'; $patchers = [create_fake_patcher()]; - $whitelist = Whitelist::create(true, true, 'Foo'); + $whitelist = Whitelist::create(true, true, true, 'Foo'); $actual = $scoper->scope($filePath, $fileContents, $prefix, $patchers, $whitelist); diff --git a/tests/Scoper/Composer/JsonFileScoperTest.php b/tests/Scoper/Composer/JsonFileScoperTest.php index 94f3d7e0..423c9810 100644 --- a/tests/Scoper/Composer/JsonFileScoperTest.php +++ b/tests/Scoper/Composer/JsonFileScoperTest.php @@ -39,7 +39,7 @@ public function test_delegates_scoping_to_the_decorated_scoper_if_is_not_a_compo $fileContents = ''; $prefix = 'Humbug'; $patchers = [create_fake_patcher()]; - $whitelist = Whitelist::create(true, true, 'Foo'); + $whitelist = Whitelist::create(true, true, true, 'Foo'); /** @var Scoper|ObjectProphecy $decoratedScoperProphecy */ $decoratedScoperProphecy = $this->prophesize(Scoper::class); @@ -72,7 +72,7 @@ public function test_it_prefixes_the_composer_autoloaders(string $fileContents, $prefix = 'Foo'; $patchers = [create_fake_patcher()]; - $whitelist = Whitelist::create(true, true, 'Foo'); + $whitelist = Whitelist::create(true, true, true, 'Foo'); $actual = $scoper->scope($filePath, $fileContents, $prefix, $patchers, $whitelist); @@ -146,7 +146,7 @@ public function test_it_prefixes_psr0_autoloaders(string $fileContents, string $ $prefix = 'Foo'; $patchers = [create_fake_patcher()]; - $whitelist = Whitelist::create(true, true, 'Foo'); + $whitelist = Whitelist::create(true, true, true, 'Foo'); $actual = $scoper->scope($filePath, $fileContents, $prefix, $patchers, $whitelist); diff --git a/tests/Scoper/NullScoperTest.php b/tests/Scoper/NullScoperTest.php index dd9ab6ab..cb012f48 100644 --- a/tests/Scoper/NullScoperTest.php +++ b/tests/Scoper/NullScoperTest.php @@ -38,7 +38,7 @@ public function test_returns_the_file_content_unchanged() $patchers = [create_fake_patcher()]; - $whitelist = Whitelist::create(true, true, 'Foo'); + $whitelist = Whitelist::create(true, true, true, 'Foo'); $scoper = new NullScoper(); diff --git a/tests/Scoper/PatchScoperTest.php b/tests/Scoper/PatchScoperTest.php index 6cec6738..cca7f179 100644 --- a/tests/Scoper/PatchScoperTest.php +++ b/tests/Scoper/PatchScoperTest.php @@ -73,7 +73,7 @@ function (string $patcherFilePath, string $patcherPrefix, string $contents) use }, ]; - $whitelist = Whitelist::create(true, true, 'Foo'); + $whitelist = Whitelist::create(true, true, true, 'Foo'); $this->decoratedScoperProphecy ->scope($filePath, $contents, $prefix, $patchers, $whitelist) diff --git a/tests/Scoper/PhpScoperSpecTest.php b/tests/Scoper/PhpScoperSpecTest.php index 9f21292b..61c0b7c1 100644 --- a/tests/Scoper/PhpScoperSpecTest.php +++ b/tests/Scoper/PhpScoperSpecTest.php @@ -53,6 +53,7 @@ class PhpScoperSpecTest extends TestCase 'prefix', 'whitelist', 'whitelist-global-constants', + 'whitelist-global-classes', 'whitelist-global-functions', 'registered-classes', 'registered-functions', @@ -62,6 +63,7 @@ class PhpScoperSpecTest extends TestCase 'prefix', 'whitelist', 'whitelist-global-constants', + 'whitelist-global-classes', 'whitelist-global-functions', 'registered-classes', 'registered-functions', @@ -250,6 +252,7 @@ private function parseSpecFile(string $file, array $meta, $fixtureTitle, $fixtur $fixtureSet['prefix'] ?? $meta['prefix'], Whitelist::create( $fixtureSet['whitelist-global-constants'] ?? $meta['whitelist-global-constants'], + $fixtureSet['whitelist-global-classes'] ?? $meta['whitelist-global-classes'], $fixtureSet['whitelist-global-functions'] ?? $meta['whitelist-global-functions'], ...($fixtureSet['whitelist'] ?? $meta['whitelist']) ), diff --git a/tests/Scoper/PhpScoperTest.php b/tests/Scoper/PhpScoperTest.php index 94a1ea70..91e611c6 100644 --- a/tests/Scoper/PhpScoperTest.php +++ b/tests/Scoper/PhpScoperTest.php @@ -144,7 +144,7 @@ public function test_can_scope_a_PHP_file() $prefix = 'Humbug'; $filePath = 'file.php'; $patchers = [create_fake_patcher()]; - $whitelist = Whitelist::create(true, true, 'Foo'); + $whitelist = Whitelist::create(true, true, true, 'Foo'); $contents = <<<'PHP' decoratedScoperProphecy ->scope($filePath, $fileContents, $prefix, $patchers, $whitelist) @@ -204,7 +204,7 @@ public function test_can_scope_a_PHP_file_with_the_wrong_extension() $prefix = 'Humbug'; $filePath = 'file'; $patchers = [create_fake_patcher()]; - $whitelist = Whitelist::create(true, true, 'Foo'); + $whitelist = Whitelist::create(true, true, true, 'Foo'); $contents = <<<'PHP' scoper->scope($filePath, $contents, $prefix, $patchers, $whitelist); @@ -334,7 +334,7 @@ public function test_creates_a_new_traverser_for_each_file() $prefix = 'Humbug'; $patchers = [create_fake_patcher()]; - $whitelist = Whitelist::create(true, true, 'Foo'); + $whitelist = Whitelist::create(true, true, true, 'Foo'); $this->decoratedScoperProphecy ->scope(Argument::any(), Argument::any(), $prefix, $patchers, $whitelist) diff --git a/tests/WhitelistTest.php b/tests/WhitelistTest.php index 659db6f4..d46916ed 100644 --- a/tests/WhitelistTest.php +++ b/tests/WhitelistTest.php @@ -34,7 +34,7 @@ public function test_it_can_be_created_from_a_list_of_strings( array $expectedSymbols, array $expectedConstants ) { - $whitelistObject = Whitelist::create(true, true, ...$whitelist); + $whitelistObject = Whitelist::create(true, true, true, ...$whitelist); $whitelistReflection = new ReflectionClass(Whitelist::class); @@ -51,14 +51,16 @@ public function test_it_can_be_created_from_a_list_of_strings( $actualConstants = $whitelistConstantReflection->getValue($whitelistObject); $this->assertTrue($whitelistObject->whitelistGlobalConstants()); + $this->assertTrue($whitelistObject->whitelistGlobalClasses()); $this->assertTrue($whitelistObject->whitelistGlobalFunctions()); $this->assertSame($expectedNamespaces, $actualNamespaces); $this->assertSame($expectedSymbols, array_flip($actualSymbols)); $this->assertSame($expectedConstants, array_flip($actualConstants)); - $whitelistObject = Whitelist::create(false, false, ...$whitelist); + $whitelistObject = Whitelist::create(false, false, false, ...$whitelist); $this->assertFalse($whitelistObject->whitelistGlobalConstants()); + $this->assertFalse($whitelistObject->whitelistGlobalClasses()); $this->assertFalse($whitelistObject->whitelistGlobalFunctions()); $this->assertSame($expectedNamespaces, $actualNamespaces); $this->assertSame($expectedSymbols, array_flip($actualSymbols)); @@ -80,7 +82,6 @@ public function test_it_can_tell_if_a_constant_is_a_whitelisted_global_constant( */ public function test_it_can_tell_if_a_class_is_a_whitelisted_global_class(Whitelist $whitelist, string $constant, bool $expected) { - $this->markTestSkipped('TODO'); $actual = $whitelist->isGlobalWhitelistedClass($constant); $this->assertSame($expected, $actual); @@ -98,7 +99,7 @@ public function test_it_can_tell_if_a_function_is_a_whitelisted_global_function( public function test_it_can_record_whitelisted_functions() { - $whitelist = Whitelist::create(true, true); + $whitelist = Whitelist::create(true, true, true); $whitelist->recordWhitelistedFunction( new FullyQualified('Acme\foo'), @@ -125,7 +126,7 @@ public function test_it_can_record_whitelisted_functions() public function test_it_can_record_whitelisted_classes() { $this->markTestSkipped('TODO'); - $whitelist = Whitelist::create(true, true); + $whitelist = Whitelist::create(true, true, true); $whitelist->recordWhitelistedClass( new FullyQualified('Acme\foo'), @@ -201,258 +202,345 @@ public function provideWhitelists(): Generator public function provideGlobalConstantNames(): Generator { - yield [ - Whitelist::create(true, true), - 'PHP_SCOPER_VERSION', - true, - ]; - - yield [ - Whitelist::create(false, true), - 'PHP_SCOPER_VERSION', - false, - ]; - - yield [ - Whitelist::create(true, true), - 'Humbug\PHP_SCOPER_VERSION', - false, - ]; - - yield [ - Whitelist::create(false, true), - 'Humbug\PHP_SCOPER_VERSION', - false, - ]; - - yield [ - Whitelist::create(true, true), - 'Humbug\PHP_SCOPER_VERSION', - false, - ]; - - yield [ - Whitelist::create(false, true, 'PHP_SCOPER_VERSION'), - 'PHP_SCOPER_VERSION', - false, - ]; + foreach ([true, false] as $whitelistGlobalClasses) { + foreach ([true, false] as $whitelistGlobalFunctions) { + yield [ + Whitelist::create(true, $whitelistGlobalClasses, $whitelistGlobalFunctions), + 'PHP_SCOPER_VERSION', + true, + ]; + + yield [ + Whitelist::create(false, $whitelistGlobalClasses, $whitelistGlobalFunctions), + 'PHP_SCOPER_VERSION', + false, + ]; + yield [ + Whitelist::create(true, $whitelistGlobalClasses, $whitelistGlobalFunctions, 'PHP_SCOPER_VERSION'), + 'PHP_SCOPER_VERSION', + true, + ]; + + yield [ + Whitelist::create(false, $whitelistGlobalClasses, $whitelistGlobalFunctions, 'PHP_SCOPER_VERSION'), + 'PHP_SCOPER_VERSION', + false, + ]; + + yield [ + Whitelist::create(true, $whitelistGlobalClasses, $whitelistGlobalFunctions), + 'Humbug\PHP_SCOPER_VERSION', + false, + ]; + + yield [ + Whitelist::create(false, $whitelistGlobalClasses, $whitelistGlobalFunctions), + 'Humbug\PHP_SCOPER_VERSION', + false, + ]; + + yield [ + Whitelist::create(true, $whitelistGlobalClasses, $whitelistGlobalFunctions, 'Humbug\PHP_SCOPER_VERSION'), + 'Humbug\PHP_SCOPER_VERSION', + false, + ]; + + yield [ + Whitelist::create(false, $whitelistGlobalClasses, $whitelistGlobalFunctions, 'Humbug\PHP_SCOPER_VERSION'), + 'Humbug\PHP_SCOPER_VERSION', + false, + ]; + } + } } public function provideGlobalClassNames(): Generator { - yield [ - Whitelist::create(true, true, 'PHP_SCOPER_VERSION'), - 'Foo', - false, - ]; + foreach ([true, false] as $whitelistGlobalConstants) { + foreach ([true, false] as $whitelistGlobalFunctions) { + yield [ + Whitelist::create($whitelistGlobalConstants, true, $whitelistGlobalFunctions), + 'Foo', + true, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, false, $whitelistGlobalFunctions), + 'Foo', + false, + ]; + yield [ + Whitelist::create($whitelistGlobalConstants, true, $whitelistGlobalFunctions, 'Foo'), + 'Foo', + true, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, false, $whitelistGlobalFunctions, 'Foo'), + 'Foo', + false, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, true, $whitelistGlobalFunctions), + 'Acme\Foo', + false, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, false, $whitelistGlobalFunctions), + 'Acme\Foo', + false, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, true, $whitelistGlobalFunctions, 'Acme\Foo'), + 'Acme\Foo', + false, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, false, $whitelistGlobalFunctions, 'Acme\Foo'), + 'Acme\Foo', + false, + ]; + } + } } public function provideGlobalFunctionNames(): Generator { - yield [ - Whitelist::create(true, true, 'PHP_SCOPER_VERSION'), - 'foo', - true, - ]; - - yield [ - Whitelist::create(true, false, 'PHP_SCOPER_VERSION'), - 'foo', - false, - ]; - - yield [ - Whitelist::create(true, true, 'PHP_SCOPER_VERSION'), - 'Acme\foo', - false, - ]; - - yield [ - Whitelist::create(true, false, 'PHP_SCOPER_VERSION'), - 'Acme\foo', - false, - ]; + foreach ([true, false] as $whitelistGlobalConstants) { + foreach ([true, false] as $whitelistGlobalClasses) { + yield [ + Whitelist::create($whitelistGlobalConstants, $whitelistGlobalClasses, true), + 'foo', + true, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, $whitelistGlobalClasses, false), + 'foo', + false, + ]; + yield [ + Whitelist::create($whitelistGlobalConstants, $whitelistGlobalClasses, true, 'foo'), + 'foo', + true, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, $whitelistGlobalClasses, false, 'foo'), + 'foo', + false, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, $whitelistGlobalClasses, true), + 'Acme\foo', + false, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, $whitelistGlobalClasses, false), + 'Acme\foo', + false, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, $whitelistGlobalClasses, true, 'Acme\foo'), + 'Acme\foo', + false, + ]; + + yield [ + Whitelist::create($whitelistGlobalConstants, $whitelistGlobalClasses, false, 'Acme\foo'), + 'Acme\foo', + false, + ]; + } + } } public function provideSymbolNames(): Generator { yield [ - Whitelist::create(true, true), + Whitelist::create(true, true, true), 'Acme\Foo', false, false, ]; yield [ - Whitelist::create(true, true, 'Acme\Foo'), + Whitelist::create(true, true, true, 'Acme\Foo'), 'Acme\Foo', false, true, ]; yield [ - Whitelist::create(true, true, 'Acme\Foo'), + Whitelist::create(true, true, true, 'Acme\Foo'), 'acme\foo', false, true, ]; yield [ - Whitelist::create(true, true, 'Acme\Foo'), + Whitelist::create(true, true, true, 'Acme\Foo'), 'acme\foo', true, false, ]; yield [ - Whitelist::create(true, true, 'Acme\Foo'), + Whitelist::create(true, true, true, 'Acme\Foo'), 'Acme\Foo\Bar', true, false, ]; yield [ - Whitelist::create(true, true, 'Acme\Foo'), + Whitelist::create(true, true, true, 'Acme\Foo'), 'Acme', true, false, ]; yield [ - Whitelist::create(true, true, 'Acme'), + Whitelist::create(true, true, true, 'Acme'), 'Acme', true, true, ]; yield [ - Whitelist::create(true, true, 'Acme'), + Whitelist::create(true, true, true, 'Acme'), 'Acme', false, true, ]; yield [ - Whitelist::create(true, true, 'Acme'), + Whitelist::create(true, true, true, 'Acme'), 'acme', false, true, ]; yield [ - Whitelist::create(true, true, 'Acme'), + Whitelist::create(true, true, true, 'Acme'), 'acme', true, false, ]; yield [ - Whitelist::create(true, true, 'Acme\*'), + Whitelist::create(true, true, true, 'Acme\*'), 'Acme', true, false, ]; yield [ - Whitelist::create(true, true, 'Acme\*'), + Whitelist::create(true, true, true, 'Acme\*'), 'Acme', false, false, ]; yield [ - Whitelist::create(true, true, 'Acme\*'), + Whitelist::create(true, true, true, 'Acme\*'), 'acme', true, false, ]; yield [ - Whitelist::create(true, true, 'Acme\*'), + Whitelist::create(true, true, true, 'Acme\*'), 'acme', false, false, ]; yield [ - Whitelist::create(true, true, 'Acme\*'), + Whitelist::create(true, true, true, 'Acme\*'), 'Acme\Foo', true, false, ]; yield [ - Whitelist::create(true, true, 'Acme\*'), + Whitelist::create(true, true, true, 'Acme\*'), 'Acme\Foo', false, false, ]; yield [ - Whitelist::create(true, true, 'Acme\*'), + Whitelist::create(true, true, true, 'Acme\*'), 'acme\Foo', true, false, ]; yield [ - Whitelist::create(true, true, 'Acme\*'), + Whitelist::create(true, true, true, 'Acme\*'), 'acme\Foo', false, false, ]; yield [ - Whitelist::create(true, true, 'Acme\F*'), + Whitelist::create(true, true, true, 'Acme\F*'), 'Acme', true, false, ]; yield [ - Whitelist::create(true, true, 'Acme\F*'), + Whitelist::create(true, true, true, 'Acme\F*'), 'Acme', false, false, ]; yield [ - Whitelist::create(true, true, 'Acme\F*'), + Whitelist::create(true, true, true, 'Acme\F*'), 'acme', true, false, ]; yield [ - Whitelist::create(true, true, 'Acme\F*'), + Whitelist::create(true, true, true, 'Acme\F*'), 'acme', false, false, ]; yield [ - Whitelist::create(true, true, 'Acme\F*'), + Whitelist::create(true, true, true, 'Acme\F*'), 'Acme\Foo', true, true, ]; yield [ - Whitelist::create(true, true, 'Acme\F*'), + Whitelist::create(true, true, true, 'Acme\F*'), 'Acme\Foo', false, true, ]; yield [ - Whitelist::create(true, true, 'Acme\F*'), + Whitelist::create(true, true, true, 'Acme\F*'), 'acme\foo', true, false, ]; yield [ - Whitelist::create(true, true, 'Acme\F*'), + Whitelist::create(true, true, true, 'Acme\F*'), 'acme\foo', false, true, @@ -462,67 +550,67 @@ public function provideSymbolNames(): Generator public function provideNamespaceWhitelists(): Generator { yield [ - Whitelist::create(true, true), + Whitelist::create(true, true, true), 'Acme\Foo', false, ]; yield [ - Whitelist::create(true, true, 'Acme\Foo\*'), + Whitelist::create(true, true, true, 'Acme\Foo\*'), 'Acme\Foo', true, ]; yield [ - Whitelist::create(true, true, 'Acme\Foo\*'), + Whitelist::create(true, true, true, 'Acme\Foo\*'), 'acme\foo', true, ]; yield [ - Whitelist::create(true, true, 'Acme\*'), + Whitelist::create(true, true, true, 'Acme\*'), 'Acme\Foo', true, ]; yield [ - Whitelist::create(true, true, 'Acme\*'), + Whitelist::create(true, true, true, 'Acme\*'), 'acme\foo', true, ]; yield [ - Whitelist::create(true, true, 'Acme\Foo\*'), + Whitelist::create(true, true, true, 'Acme\Foo\*'), 'Acme\Foo\Bar', true, ]; yield [ - Whitelist::create(true, true, 'Acme\Foo\*'), + Whitelist::create(true, true, true, 'Acme\Foo\*'), 'acme\foo\bar', true, ]; yield [ - Whitelist::create(true, true, '\*'), + Whitelist::create(true, true, true, '\*'), 'Acme', true, ]; yield [ - Whitelist::create(true, true, '\*'), + Whitelist::create(true, true, true, '\*'), 'acme', true, ]; yield [ - Whitelist::create(true, true, '\*'), + Whitelist::create(true, true, true, '\*'), 'Acme\Foo', true, ]; yield [ - Whitelist::create(true, true, '\*'), + Whitelist::create(true, true, true, '\*'), 'acme\foo', true, ]; @@ -531,47 +619,47 @@ public function provideNamespaceWhitelists(): Generator public function provideWhitelistToConvert(): Generator { yield [ - Whitelist::create(true, true), + Whitelist::create(true, true, true), [], ]; yield [ - Whitelist::create(true, true, 'Acme\Foo'), + Whitelist::create(true, true, true, 'Acme\Foo'), ['Acme\Foo'], ]; yield [ - Whitelist::create(true, true, '\Acme\Foo'), + Whitelist::create(true, true, true, '\Acme\Foo'), ['Acme\Foo'], ]; yield [ - Whitelist::create(true, true, 'Acme\Foo\*'), + Whitelist::create(true, true, true, 'Acme\Foo\*'), ['Acme\Foo\*'], ]; yield [ - Whitelist::create(true, true, '\Acme\Foo\*'), + Whitelist::create(true, true, true, '\Acme\Foo\*'), ['Acme\Foo\*'], ]; yield [ - Whitelist::create(true, true, '*'), + Whitelist::create(true, true, true, '*'), ['*'], ]; yield [ - Whitelist::create(true, true, '\*'), + Whitelist::create(true, true, true, '\*'), ['*'], ]; yield [ - Whitelist::create(true, true, 'Acme', 'Acme\Foo', 'Acme\Foo\*', '*'), + Whitelist::create(true, true, true, 'Acme', 'Acme\Foo', 'Acme\Foo\*', '*'), ['Acme', 'Acme\Foo', 'Acme\Foo\*', '*'], ]; yield [ - Whitelist::create(true, true, 'Acme', 'Acme'), + Whitelist::create(true, true, true, 'Acme', 'Acme'), ['Acme'], ]; }