Skip to content

Commit

Permalink
Do not prefixes names in the same namespace (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic authored May 10, 2021
1 parent 1952bfc commit 98c92f2
Show file tree
Hide file tree
Showing 50 changed files with 239 additions and 217 deletions.
2 changes: 1 addition & 1 deletion specs/class-const/global-scope-single-level.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Command {}
class Command
{
}
\Humbug\Command::MAIN_CONST;
Command::MAIN_CONST;

PHP
],
Expand Down
2 changes: 1 addition & 1 deletion specs/class-const/global-scope-two-level.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Command
}
namespace Humbug;
\Humbug\PHPUnit\Command::MAIN_CONST;
PHPUnit\Command::MAIN_CONST;

PHP
],
Expand Down
2 changes: 1 addition & 1 deletion specs/class-const/namespace-scope-single-level.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Command {}
class Command
{
}
\Humbug\X\Command::MAIN_CONST;
Command::MAIN_CONST;

PHP
],
Expand Down
4 changes: 2 additions & 2 deletions specs/class-const/namespace-scope-two-level.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Command
}
namespace Humbug\X;
\Humbug\X\PHPUnit\Command::MAIN_CONST;
PHPUnit\Command::MAIN_CONST;

PHP
],
Expand Down Expand Up @@ -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
],
Expand Down
2 changes: 1 addition & 1 deletion specs/class-static-prop/global-scope-single-level.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Command {}
class Command
{
}
\Humbug\Command::$mainStaticProp;
Command::$mainStaticProp;

PHP
,
Expand Down
2 changes: 1 addition & 1 deletion specs/class-static-prop/global-scope-two-level.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Command
}
namespace Humbug;
\Humbug\PHPUnit\Command::$mainStaticProp;
PHPUnit\Command::$mainStaticProp;

PHP
,
Expand Down
2 changes: 1 addition & 1 deletion specs/class-static-prop/namespace-scope-single-level.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Command {}
class Command
{
}
\Humbug\X\Command::$mainStaticProp;
Command::$mainStaticProp;

PHP
,
Expand Down
4 changes: 2 additions & 2 deletions specs/class-static-prop/namespace-scope-two-level.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Command
}
namespace Humbug\X;
\Humbug\X\PHPUnit\Command::$mainStaticProp;
PHPUnit\Command::$mainStaticProp;

PHP
,
Expand Down Expand Up @@ -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
],
Expand Down
24 changes: 12 additions & 12 deletions specs/class/anonymous.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,22 @@ 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;
};
class A
{
public function test()
{
return new class($this) extends \Humbug\A
return new class($this) extends A
{
const A = 'B';
};
Expand Down Expand Up @@ -141,22 +141,22 @@ 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;
};
class A
{
public function test()
{
return new class($this) extends \Humbug\A
return new class($this) extends A
{
const A = 'B';
};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -356,22 +356,22 @@ 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;
};
class A
{
public function test()
{
return new class($this) extends \Humbug\Foo\A
return new class($this) extends A
{
const A = 'B';
};
Expand Down Expand Up @@ -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';
};
Expand All @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions specs/class/interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand All @@ -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();
}
Expand Down
6 changes: 3 additions & 3 deletions specs/class/regular-extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function a()
{
}
}
class B extends \Humbug\A implements \Iterator
class B extends A implements \Iterator
{
}

Expand Down Expand Up @@ -77,7 +77,7 @@ public function a()
{
}
}
class B extends \Humbug\Foo\A implements Iterator
class B extends A implements Iterator
{
}

Expand Down Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions specs/class/typed-properties.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function a() {}
class A
{
public string $name;
public ?\Humbug\B $foo;
public ?B $foo;
public function a()
{
}
Expand Down Expand Up @@ -75,7 +75,7 @@ public function a() {}
class A
{
public string $name;
public ?\Humbug\B $foo;
public ?B $foo;
public function a()
{
}
Expand Down Expand Up @@ -106,7 +106,7 @@ public function a()
class A
{
public string $name;
public ?\Humbug\Foo\B $foo;
public ?B $foo;
public function a()
{
}
Expand Down Expand Up @@ -135,7 +135,7 @@ public function a() {}
class A
{
public string $name;
public ?\Humbug\Foo\B $foo;
public ?B $foo;
public function a()
{
}
Expand Down Expand Up @@ -170,7 +170,7 @@ public function a() {}
class A
{
public string $name;
public ?\Humbug\Foo\B $foo;
public ?B $foo;
public function a()
{
}
Expand Down Expand Up @@ -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()
{
}
Expand Down
24 changes: 12 additions & 12 deletions specs/const/const-declaration-with-global-whitelisting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
Expand Down Expand Up @@ -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
],
Expand Down
Loading

0 comments on commit 98c92f2

Please sign in to comment.