[php-src] master: Implement `ReflectionClass::isAnonymous()` using `_class_check_flag()`

Daniel Scherzer <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Daniel Scherzer (DanielEScherzer)
Date: 2026-07-07T10:33:21-07:00

Commit: https://github.com/php/php-src/commit/dd86a8ab58c32a563047861496b420f87277e9b8
Raw diff: https://github.com/php/php-src/commit/dd86a8ab58c32a563047861496b420f87277e9b8.diff

Implement `ReflectionClass::isAnonymous()` using `_class_check_flag()`

Changed paths:
  M  ext/reflection/php_reflection.c


Diff:

diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 37c45cb02168..d611b5d6bc11 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -4362,15 +4362,22 @@ ZEND_METHOD(ReflectionClass, isUserDefined)
 }
 /* }}} */
 
-/* {{{ Returns whether this class is anonymous */
-ZEND_METHOD(ReflectionClass, isAnonymous)
+/* {{{ _class_check_flag */
+static void _class_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
 {
 	reflection_object *intern;
 	zend_class_entry *ce;
 
 	ZEND_PARSE_PARAMETERS_NONE();
 	GET_REFLECTION_OBJECT_PTR(ce);
-	RETURN_BOOL(ce->ce_flags & ZEND_ACC_ANON_CLASS);
+	RETVAL_BOOL(ce->ce_flags & mask);
+}
+/* }}} */
+
+/* {{{ Returns whether this class is anonymous */
+ZEND_METHOD(ReflectionClass, isAnonymous)
+{
+	_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_ANON_CLASS);
 }
 /* }}} */
 
@@ -4880,18 +4887,6 @@ ZEND_METHOD(ReflectionClass, getReflectionConstant)
 }
 /* }}} */
 
-/* {{{ _class_check_flag */
-static void _class_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
-{
-	reflection_object *intern;
-	zend_class_entry *ce;
-
-	ZEND_PARSE_PARAMETERS_NONE();
-	GET_REFLECTION_OBJECT_PTR(ce);
-	RETVAL_BOOL(ce->ce_flags & mask);
-}
-/* }}} */
-
 /* {{{ Returns whether this class is instantiable */
 ZEND_METHOD(ReflectionClass, isInstantiable)
 {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.