Skip to content

Commit

Permalink
Redeclare PHP8 constants for forward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljoelphillips committed Dec 12, 2020
1 parent 07f70ab commit b4e0780
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/Reflection/ReflectionClassConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

class ReflectionClassConstant
{
public const IS_PUBLIC = 1;
public const IS_PROTECTED = 2;
public const IS_PRIVATE = 4;

private bool $valueWasCached = false;

/** @var scalar|array<scalar>|null const value */
Expand Down
13 changes: 6 additions & 7 deletions test/unit/Reflection/ReflectionClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Qux;
use Reflection as CoreReflection;
use ReflectionClass as CoreReflectionClass;
use ReflectionClassConstant as CoreReflectionClassConstant;
use ReflectionMethod as CoreReflectionMethod;
use ReflectionProperty as CoreReflectionProperty;
use Roave\BetterReflection\Reflection\Exception\NotAClassReflection;
Expand Down Expand Up @@ -1817,13 +1816,13 @@ public function testGetConstantsReturnsInheritedConstants(): void
public function getConstantsWithFilterDataProvider(): array
{
return [
[CoreReflectionClassConstant::IS_PUBLIC, 3],
[CoreReflectionClassConstant::IS_PROTECTED, 1],
[CoreReflectionClassConstant::IS_PRIVATE, 1],
[ReflectionClassConstant::IS_PUBLIC, 3],
[ReflectionClassConstant::IS_PROTECTED, 1],
[ReflectionClassConstant::IS_PRIVATE, 1],
[
CoreReflectionClassConstant::IS_PUBLIC |
CoreReflectionClassConstant::IS_PROTECTED |
CoreReflectionClassConstant::IS_PRIVATE,
ReflectionClassConstant::IS_PUBLIC |
ReflectionClassConstant::IS_PROTECTED |
ReflectionClassConstant::IS_PRIVATE,
5,
],
];
Expand Down

0 comments on commit b4e0780

Please sign in to comment.