forked from phper-framework/phper
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Class Create thru generated register_class*
Signed-off-by: Dusan Malusev <dusan@dusanmalusev.dev>
- Loading branch information
1 parent
03f3412
commit e15940e
Showing
18 changed files
with
263 additions
and
219 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<?php | ||
/** @generate-class-entries */ | ||
/** @generate-function-entries */ | ||
|
||
function hello(string $name): string {} |
30 changes: 30 additions & 0 deletions
30
phper-build/tests/test_extract_content_and_header/expected_c_file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Complex_say_hello, 0, 1, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) | ||
ZEND_END_ARG_INFO() | ||
|
||
|
||
|
||
|
||
zend_class_entry *register_class_Complex_Foo(void) | ||
{ | ||
zend_class_entry ce, *class_entry; | ||
|
||
INIT_NS_CLASS_ENTRY(ce, "Complex", "Foo", NULL); | ||
class_entry = zend_register_internal_class_ex(&ce, NULL); | ||
class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES; | ||
|
||
zval property_foo_default_value; | ||
ZVAL_LONG(&property_foo_default_value, 100); | ||
zend_string *property_foo_name = zend_string_init("foo", sizeof("foo") - 1, 1); | ||
zend_string *property_foo_class_JsonSerializable = zend_string_init("JsonSerializable", sizeof("JsonSerializable") - 1, 1); | ||
zend_string *property_foo_class_ArrayAccess = zend_string_init("ArrayAccess", sizeof("ArrayAccess") - 1, 1); | ||
zend_type_list *property_foo_type_list = malloc(ZEND_TYPE_LIST_SIZE(2)); | ||
property_foo_type_list->num_types = 2; | ||
property_foo_type_list->types[0] = (zend_type) ZEND_TYPE_INIT_CLASS(property_foo_class_JsonSerializable, 0, 0); | ||
property_foo_type_list->types[1] = (zend_type) ZEND_TYPE_INIT_CLASS(property_foo_class_ArrayAccess, 0, 0); | ||
zend_type property_foo_type = ZEND_TYPE_INIT_UNION(property_foo_type_list, MAY_BE_LONG); | ||
zend_declare_typed_property(class_entry, property_foo_name, &property_foo_default_value, ZEND_ACC_PRIVATE, NULL, property_foo_type); | ||
zend_string_release(property_foo_name); | ||
|
||
return class_entry; | ||
} |
2 changes: 2 additions & 0 deletions
2
phper-build/tests/test_extract_content_and_header/expected_header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
extern zend_class_entry *register_class_Complex_Foo(void); | ||
extern const zend_internal_arg_info arginfo_Complex_say_hello[2]; |
Oops, something went wrong.