mirror of
https://github.com/php/php-src.git
synced 2024-11-23 09:54:15 +08:00
Use virtual annotation in XMLReader
All properties of XMLReader are virtual and therefore don't need backing storage.
This commit is contained in:
parent
f78d5cfcd2
commit
6c63c48a7e
@ -99,32 +99,46 @@ class XMLReader
|
||||
public const int SUBST_ENTITIES = UNKNOWN;
|
||||
|
||||
|
||||
/** @virtual */
|
||||
public int $attributeCount;
|
||||
|
||||
/** @virtual */
|
||||
public string $baseURI;
|
||||
|
||||
/** @virtual */
|
||||
public int $depth;
|
||||
|
||||
/** @virtual */
|
||||
public bool $hasAttributes;
|
||||
|
||||
/** @virtual */
|
||||
public bool $hasValue;
|
||||
|
||||
/** @virtual */
|
||||
public bool $isDefault;
|
||||
|
||||
/** @virtual */
|
||||
public bool $isEmptyElement;
|
||||
|
||||
/** @virtual */
|
||||
public string $localName;
|
||||
|
||||
/** @virtual */
|
||||
public string $name;
|
||||
|
||||
/** @virtual */
|
||||
public string $namespaceURI;
|
||||
|
||||
/** @virtual */
|
||||
public int $nodeType;
|
||||
|
||||
/** @virtual */
|
||||
public string $prefix;
|
||||
|
||||
/** @virtual */
|
||||
public string $value;
|
||||
|
||||
/** @virtual */
|
||||
public string $xmlLang;
|
||||
|
||||
/** @tentative-return-type */
|
||||
|
30
ext/xmlreader/php_xmlreader_arginfo.h
generated
30
ext/xmlreader/php_xmlreader_arginfo.h
generated
@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 551324d130f9755c4c61cebb5084953fb6f539c4 */
|
||||
* Stub hash: 80288a0f40eabc7802a928963386616ea31e448d */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_close, 0, 0, IS_TRUE, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@ -313,85 +313,85 @@ static zend_class_entry *register_class_XMLReader(void)
|
||||
zval property_attributeCount_default_value;
|
||||
ZVAL_UNDEF(&property_attributeCount_default_value);
|
||||
zend_string *property_attributeCount_name = zend_string_init("attributeCount", sizeof("attributeCount") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_attributeCount_name, &property_attributeCount_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_declare_typed_property(class_entry, property_attributeCount_name, &property_attributeCount_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_string_release(property_attributeCount_name);
|
||||
|
||||
zval property_baseURI_default_value;
|
||||
ZVAL_UNDEF(&property_baseURI_default_value);
|
||||
zend_string *property_baseURI_name = zend_string_init("baseURI", sizeof("baseURI") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_baseURI_name, &property_baseURI_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_declare_typed_property(class_entry, property_baseURI_name, &property_baseURI_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_string_release(property_baseURI_name);
|
||||
|
||||
zval property_depth_default_value;
|
||||
ZVAL_UNDEF(&property_depth_default_value);
|
||||
zend_string *property_depth_name = zend_string_init("depth", sizeof("depth") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_depth_name, &property_depth_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_declare_typed_property(class_entry, property_depth_name, &property_depth_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_string_release(property_depth_name);
|
||||
|
||||
zval property_hasAttributes_default_value;
|
||||
ZVAL_UNDEF(&property_hasAttributes_default_value);
|
||||
zend_string *property_hasAttributes_name = zend_string_init("hasAttributes", sizeof("hasAttributes") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_hasAttributes_name, &property_hasAttributes_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL));
|
||||
zend_declare_typed_property(class_entry, property_hasAttributes_name, &property_hasAttributes_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL));
|
||||
zend_string_release(property_hasAttributes_name);
|
||||
|
||||
zval property_hasValue_default_value;
|
||||
ZVAL_UNDEF(&property_hasValue_default_value);
|
||||
zend_string *property_hasValue_name = zend_string_init("hasValue", sizeof("hasValue") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_hasValue_name, &property_hasValue_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL));
|
||||
zend_declare_typed_property(class_entry, property_hasValue_name, &property_hasValue_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL));
|
||||
zend_string_release(property_hasValue_name);
|
||||
|
||||
zval property_isDefault_default_value;
|
||||
ZVAL_UNDEF(&property_isDefault_default_value);
|
||||
zend_string *property_isDefault_name = zend_string_init("isDefault", sizeof("isDefault") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_isDefault_name, &property_isDefault_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL));
|
||||
zend_declare_typed_property(class_entry, property_isDefault_name, &property_isDefault_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL));
|
||||
zend_string_release(property_isDefault_name);
|
||||
|
||||
zval property_isEmptyElement_default_value;
|
||||
ZVAL_UNDEF(&property_isEmptyElement_default_value);
|
||||
zend_string *property_isEmptyElement_name = zend_string_init("isEmptyElement", sizeof("isEmptyElement") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_isEmptyElement_name, &property_isEmptyElement_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL));
|
||||
zend_declare_typed_property(class_entry, property_isEmptyElement_name, &property_isEmptyElement_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL));
|
||||
zend_string_release(property_isEmptyElement_name);
|
||||
|
||||
zval property_localName_default_value;
|
||||
ZVAL_UNDEF(&property_localName_default_value);
|
||||
zend_string *property_localName_name = zend_string_init("localName", sizeof("localName") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_localName_name, &property_localName_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_declare_typed_property(class_entry, property_localName_name, &property_localName_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_string_release(property_localName_name);
|
||||
|
||||
zval property_name_default_value;
|
||||
ZVAL_UNDEF(&property_name_default_value);
|
||||
zend_string *property_name_name = zend_string_init("name", sizeof("name") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_name_name, &property_name_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_declare_typed_property(class_entry, property_name_name, &property_name_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_string_release(property_name_name);
|
||||
|
||||
zval property_namespaceURI_default_value;
|
||||
ZVAL_UNDEF(&property_namespaceURI_default_value);
|
||||
zend_string *property_namespaceURI_name = zend_string_init("namespaceURI", sizeof("namespaceURI") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_namespaceURI_name, &property_namespaceURI_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_declare_typed_property(class_entry, property_namespaceURI_name, &property_namespaceURI_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_string_release(property_namespaceURI_name);
|
||||
|
||||
zval property_nodeType_default_value;
|
||||
ZVAL_UNDEF(&property_nodeType_default_value);
|
||||
zend_string *property_nodeType_name = zend_string_init("nodeType", sizeof("nodeType") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_nodeType_name, &property_nodeType_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_declare_typed_property(class_entry, property_nodeType_name, &property_nodeType_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_string_release(property_nodeType_name);
|
||||
|
||||
zval property_prefix_default_value;
|
||||
ZVAL_UNDEF(&property_prefix_default_value);
|
||||
zend_string *property_prefix_name = zend_string_init("prefix", sizeof("prefix") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_prefix_name, &property_prefix_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_declare_typed_property(class_entry, property_prefix_name, &property_prefix_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_string_release(property_prefix_name);
|
||||
|
||||
zval property_value_default_value;
|
||||
ZVAL_UNDEF(&property_value_default_value);
|
||||
zend_string *property_value_name = zend_string_init("value", sizeof("value") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_value_name, &property_value_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_declare_typed_property(class_entry, property_value_name, &property_value_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_string_release(property_value_name);
|
||||
|
||||
zval property_xmlLang_default_value;
|
||||
ZVAL_UNDEF(&property_xmlLang_default_value);
|
||||
zend_string *property_xmlLang_name = zend_string_init("xmlLang", sizeof("xmlLang") - 1, 1);
|
||||
zend_declare_typed_property(class_entry, property_xmlLang_name, &property_xmlLang_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_declare_typed_property(class_entry, property_xmlLang_name, &property_xmlLang_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_VIRTUAL, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
|
||||
zend_string_release(property_xmlLang_name);
|
||||
|
||||
return class_entry;
|
||||
|
34
ext/xmlreader/tests/virtual_properties.phpt
Normal file
34
ext/xmlreader/tests/virtual_properties.phpt
Normal file
@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
Virtual property tests
|
||||
--EXTENSIONS--
|
||||
xmlreader
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$rc = new ReflectionClass(XMLReader::class);
|
||||
$prop = $rc->getProperty("nodeType");
|
||||
var_dump($prop->isVirtual());
|
||||
var_dump($prop->getSettableType());
|
||||
var_dump($prop->getHooks());
|
||||
var_dump($prop->getRawValue(new XMLReader));
|
||||
var_dump($prop->getValue(new XMLReader));
|
||||
|
||||
$reader = XMLReader::XML("<root>hi</root>");
|
||||
var_dump(json_encode($reader));
|
||||
var_export($reader); echo "\n";
|
||||
var_dump(get_object_vars($reader));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
object(ReflectionNamedType)#%d (0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
int(0)
|
||||
int(0)
|
||||
string(2) "{}"
|
||||
\XMLReader::__set_state(array(
|
||||
))
|
||||
array(0) {
|
||||
}
|
Loading…
Reference in New Issue
Block a user