Skip to content

Commit

Permalink
Merge pull request #1443 from kukulich/fix
Browse files Browse the repository at this point in the history
Remove unnecessary constants
  • Loading branch information
kukulich authored Aug 3, 2024
2 parents 7f16c80 + 5ea77d6 commit 8a8ca73
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 15 deletions.
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ includes:
- tools/vendor/phpstan/phpstan-phpunit/rules.neon

parameters:
phpVersion: 80100

level: 6

paths:
Expand Down
3 changes: 0 additions & 3 deletions src/Reflection/Adapter/ReflectionClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
*/
final class ReflectionClass extends CoreReflectionClass
{
/** @internal */
public const IS_READONLY_COMPATIBILITY = 65536;

public function __construct(private BetterReflectionClass|BetterReflectionEnum $betterReflectionClass)
{
unset($this->name);
Expand Down
3 changes: 0 additions & 3 deletions src/Reflection/Adapter/ReflectionClassConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
*/
final class ReflectionClassConstant extends CoreReflectionClassConstant
{
/** @internal */
public const IS_FINAL_COMPATIBILITY = 32;

public function __construct(private BetterReflectionClassConstant|BetterReflectionEnumCase $betterClassConstantOrEnumCase)
{
unset($this->name);
Expand Down
3 changes: 0 additions & 3 deletions src/Reflection/Adapter/ReflectionProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
/** @psalm-suppress PropertyNotSetInConstructor */
final class ReflectionProperty extends CoreReflectionProperty
{
/** @internal */
public const IS_READONLY_COMPATIBILITY = 128;

public function __construct(private BetterReflectionProperty $betterReflectionProperty)
{
unset($this->name);
Expand Down
4 changes: 2 additions & 2 deletions src/Reflection/ReflectionClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ public function isFinal(): bool

public function isReadOnly(): bool
{
return ($this->modifiers & ReflectionClassAdapter::IS_READONLY_COMPATIBILITY) === ReflectionClassAdapter::IS_READONLY_COMPATIBILITY;
return ($this->modifiers & CoreReflectionClass::IS_READONLY) === CoreReflectionClass::IS_READONLY;
}

/**
Expand All @@ -1223,7 +1223,7 @@ private function computeModifiers(ClassNode|InterfaceNode|TraitNode|EnumNode $no

$modifiers = $node->isAbstract() ? CoreReflectionClass::IS_EXPLICIT_ABSTRACT : 0;
$modifiers += $node->isFinal() ? CoreReflectionClass::IS_FINAL : 0;
$modifiers += $node->isReadonly() ? ReflectionClassAdapter::IS_READONLY_COMPATIBILITY : 0;
$modifiers += $node->isReadonly() ? CoreReflectionClass::IS_READONLY : 0;

return $modifiers;
}
Expand Down
3 changes: 1 addition & 2 deletions test/unit/Reflection/ReflectionClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use ReflectionClassConstant as CoreReflectionClassConstant;
use ReflectionMethod as CoreReflectionMethod;
use ReflectionProperty as CoreReflectionProperty;
use Roave\BetterReflection\Reflection\Adapter\ReflectionClass as ReflectionClassAdapter;
use Roave\BetterReflection\Reflection\Adapter\ReflectionClassConstant as ReflectionClassConstantAdapter;
use Roave\BetterReflection\Reflection\Exception\CircularReference;
use Roave\BetterReflection\Reflection\Exception\NotAClassReflection;
Expand Down Expand Up @@ -1308,7 +1307,7 @@ public static function modifierProvider(): array
['ExampleClass', 0],
['AbstractClass', CoreReflectionClass::IS_EXPLICIT_ABSTRACT],
['FinalClass', CoreReflectionClass::IS_FINAL],
['ReadOnlyClass', ReflectionClassAdapter::IS_READONLY_COMPATIBILITY],
['ReadOnlyClass', CoreReflectionClass::IS_READONLY],
['ExampleTrait', 0],
];
}
Expand Down

0 comments on commit 8a8ca73

Please sign in to comment.