[php-src] PR #18069: Rfc: inner classes

From: Date: Fri, 14 Mar 2025 18:50:40 +0000
Subject: [php-src] PR #18069: Rfc: inner classes
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-31076@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/18069 Author: withinboredom This is the implementation for inner classes as defined in https://wiki.php.net/rfc/short-and-inner-classes There is quite a lot going on here, so here's an overview of the changes (thanks AI): ## Changes | File(s) | Change Summary | |---------|----------------| | Zend/{zend.h, zend_ast.h, zend_compile.c, zend_compile.h, zend_execute.c, zend_language_parser.y, zend_language_scanner.l, zend_object_handlers.c, zend_opcode.c, zend_vm_def.h, zend_vm_execute.h, zend_vm_handlers.h, zend_vm_opcodes.c, zend_vm_opcodes.h} | Added support for inner (nested) classes including a new AST node (ZEND_AST_INNER_CLASS), additional structure members (required_scope, lexical_scope, required_scope_absolute), updated compile functions (zend_compile_inner_class_ref, zend_resolve_nested_class_name), new token (T_INNER_REF) handling, opcode definitions, and enhanced visibility checks. | | ext/reflection/{php_reflection.c, php_reflection.stub.php, php_reflection_arginfo.h} | Extended the ReflectionClass API with new methods: isInnerClass, isPrivate, isProtected, and isPublic to determine inner class status and visibility. | | ext/opcache/zend_persist.c | Introduced zend_update_required_scope to update the required_scope and lexical_scope properties during class table persistence, ensuring proper reference management. | | ext/tokenizer/{tokenizer_data.c, tokenizer_data.stub.php, tokenizer_data_arginfo.h} | Added support for a new token (T_INNER_REF) for inner class references by updating token recognition rules and constant definitions. | | Zend/tests/errmsg/errmsg_027.phpt, ext/reflection/tests/bug74454.phpt | Updated expected error messages to clarify the syntax and parsing errors related to nested class declarations. | | tests/classes/inner_classes/*.phpt | Added numerous test cases covering inner class declarations, access modifiers (including public, private, protected, and specialized modifiers), autoloading, inheritance, readonly properties, return types, static variables, and visibility rules. |

« previous php.git-pulls (#31076) next »