mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
- Fixed ReflectionClass::isTrait() checking (to not identify abstract class as Trait)
This commit is contained in:
parent
27c2c35953
commit
2d63683ec3
@ -3999,7 +3999,7 @@ ZEND_METHOD(reflection_class, isInterface)
|
||||
Returns whether this is a trait */
|
||||
ZEND_METHOD(reflection_class, isTrait)
|
||||
{
|
||||
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_TRAIT);
|
||||
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_TRAIT & ~ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
30
ext/reflection/tests/traits003.phpt
Normal file
30
ext/reflection/tests/traits003.phpt
Normal file
@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Reflection and Traits
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
abstract class foo {
|
||||
}
|
||||
|
||||
trait bar {
|
||||
|
||||
}
|
||||
|
||||
final class baz {
|
||||
|
||||
}
|
||||
|
||||
$x = new ReflectionClass('foo');
|
||||
var_dump($x->isTrait());
|
||||
|
||||
$x = new ReflectionClass('bar');
|
||||
var_dump($x->isTrait());
|
||||
|
||||
$x = new ReflectionClass('baz');
|
||||
var_dump($x->isTrait());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
Loading…
Reference in New Issue
Block a user