...
Userland (src/class.php)
src/class.h
src/class.c
Userland (src/class.php)
public function sayHello(): string {
return 'Hello World!';
}
hdi.stub.php
class Hdi {
public function sayHello(): string {}
}
class_arginfo.h
/* This is a generated file, edit the .stub.php file instead. */
/* NOTE: Only relevant code below! */
ZEND_METHOD(Hdi, sayHello);
static const zend_function_entry class_Hdi_methods[] = {
ZEND_ME(Hdi, sayHello, arginfo_class_Hdi_sayHello, ZEND_ACC_PUBLIC) /* visibility: public */
ZEND_FE_END
};
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Hdi_sayHello, 0, 0, IS_STRING, 0) /* return type: string */
ZEND_END_ARG_INFO()
Macros and Functions:
Visibility options:
Type options:
- IS_LONG
- IS_DOUBLE
- IS_STRING
- IS_ARRAY
- IS_OBJECT
- IS_RESOURCE
- IS_REFERENCE
- IS_CALLABLE
- IS_ITERABLE
- IS_VOID
- IS_STATIC
- IS_MIXED
- IS_NEVER
- _IS_BOOL
src/class.c
/* {{{ Hdi: function sayHello(): string */
PHP_METHOD(Hdi, sayHello) {
ZEND_PARSE_PARAMETERS_NONE();
RETURN_STR("Hello World!");
}
/* }}} */
Macros and Functions:
Userland (src/class.php)
private string $name;
src/class.c
zval propDefaultValue;
zend_string *propName;
/* default property value (undefined) */
ZVAL_UNDEF(&propDefaultValue);
propName = zend_string_init("name", sizeof("name") - 1, false); /* $name */
zend_declare_typed_property(
classEntry,
propName,
&propDefaultValue,
ZEND_ACC_PRIVATE, /* visibility: private */
NULL,
(zend_type)ZEND_TYPE_INIT_MASK(MAY_BE_STRING) /* type: string */
);
zend_string_release(propName);
Macros and Functions:
Visibility options:
Type options:
- MAY_BE_NULL
- MAY_BE_BOOL
- MAY_BE_LONG
- MAY_BE_DOUBLE
- MAY_BE_STRING
- MAY_BE_ARRAY
- MAY_BE_OBJECT
- MAY_BE_RESOURCE
- MAY_BE_ANY
- MAY_BE_REF
Language Reference
Core Reference
src/class.c
zend_update_property_string(classEntry, Z_OBJ_P(ZEND_THIS), "name", sizeof("name") - 1, "name");
Macros and Functions:
src/class.c
zval rv;
zval *name = zend_read_property(classEntry, Z_OBJ_P(ZEND_THIS), "name", sizeof("name") - 1, true, &rv);
Macros and Functions:
Language Reference
Language Reference
Language Reference
Language Reference