Remove unnecessary assertion

zend_class_implements_interface works fine if the "class" is an
interface, so simply drop this assertion. This avoids the need to
special case this situation.
This commit is contained in:
Nikita Popov 2021-11-04 16:58:24 +01:00
parent 4c171ed5eb
commit 7e67366a9b
2 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,18 @@
--TEST--
Interface with __toString() method
--FILE--
<?php
interface MyStringable {
public function __toString(): string;
}
$rc = new ReflectionClass(MyStringable::class);
var_dump($rc->getInterfaceNames());
?>
--EXPECT--
array(1) {
[0]=>
string(10) "Stringable"
}

View file

@ -2276,7 +2276,6 @@ ZEND_API zend_result ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zv
ZEND_API zend_bool ZEND_FASTCALL zend_class_implements_interface(const zend_class_entry *class_ce, const zend_class_entry *interface_ce) /* {{{ */
{
uint32_t i;
ZEND_ASSERT(!(class_ce->ce_flags & ZEND_ACC_INTERFACE));
ZEND_ASSERT(interface_ce->ce_flags & ZEND_ACC_INTERFACE);
if (class_ce->num_interfaces) {