Skip to content

Commit 3f105d9

Browse files
committed
ReflectionClass::isEnum()
1 parent 89c16a6 commit 3f105d9

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

build/baseline-8.1.neon

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ parameters:
66
path: ../src/Reflection/ClassConstantReflection.php
77

88
-
9-
message: "#^Call to function method_exists\\(\\) with ReflectionProperty and 'isReadOnly' will always evaluate to true\\.$#"
9+
message: "#^Call to function method_exists\\(\\) with ReflectionClass and 'isEnum' will always evaluate to true\\.$#"
1010
count: 1
11-
path: ../src/Reflection/Php/PhpPropertyReflection.php
11+
path: ../src/Reflection/ClassReflection.php
1212

1313
-
1414
message: "#^Call to function method_exists\\(\\) with ReflectionMethod and 'getTentativeReturnT…' will always evaluate to true\\.$#"
1515
count: 1
1616
path: ../src/Reflection/Php/NativeBuiltinMethodReflection.php
1717

18+
-
19+
message: "#^Call to function method_exists\\(\\) with ReflectionProperty and 'isReadOnly' will always evaluate to true\\.$#"
20+
count: 1
21+
path: ../src/Reflection/Php/PhpPropertyReflection.php
22+

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"nette/utils": "^3.2.5",
2424
"nikic/php-parser": "4.13.1",
2525
"ondram/ci-detector": "^3.4.0",
26-
"ondrejmirtes/better-reflection": "4.3.80",
26+
"ondrejmirtes/better-reflection": "4.3.81",
2727
"phpstan/php-8-stubs": "0.1.36",
2828
"phpstan/phpdoc-parser": "^1.2.0",
2929
"react/child-process": "^0.6.4",

composer.lock

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Reflection/ClassReflection.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,18 @@ public function isTrait(): bool
521521
return $this->reflection->isTrait();
522522
}
523523

524+
public function isEnum(): bool
525+
{
526+
if (method_exists($this->reflection, 'isEnum')) {
527+
return $this->reflection->isEnum();
528+
}
529+
530+
return false;
531+
}
532+
524533
public function isClass(): bool
525534
{
526-
return !$this->isInterface() && !$this->isTrait();
535+
return !$this->isInterface() && !$this->isTrait() && !$this->isEnum();
527536
}
528537

529538
public function isAnonymous(): bool

0 commit comments

Comments
 (0)