Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/gen_stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2375,8 +2375,8 @@ protected function getTypeCode(string $variableLikeName, string &$code): string
$code .= "\t{$variableLikeType}_{$variableLikeName}_type_list->num_types = $classTypeCount;\n";

foreach ($arginfoType->classTypes as $k => $classType) {
$escapedClassName = $classType->toEscapedName();
$code .= "\t{$variableLikeType}_{$variableLikeName}_type_list->types[$k] = (zend_type) ZEND_TYPE_INIT_CLASS({$variableLikeType}_{$variableLikeName}_class_{$escapedClassName}, 0, 0);\n";
$varEscapedClassName = $classType->toVarEscapedName();
$code .= "\t{$variableLikeType}_{$variableLikeName}_type_list->types[$k] = (zend_type) ZEND_TYPE_INIT_CLASS({$variableLikeType}_{$variableLikeName}_class_{$varEscapedClassName}, 0, 0);\n";
}

$typeMaskCode = $this->type->toArginfoType()->toTypeMask();
Expand Down
2 changes: 2 additions & 0 deletions ext/zend_test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static zend_class_entry *zend_test_forbid_dynamic_call;
static zend_class_entry *zend_test_ns_foo_class;
static zend_class_entry *zend_test_ns_unlikely_compile_error_class;
static zend_class_entry *zend_test_ns_not_unlikely_compile_error_class;
static zend_class_entry *zend_test_ns_bar_class;
static zend_class_entry *zend_test_ns2_foo_class;
static zend_class_entry *zend_test_ns2_ns_foo_class;
static zend_class_entry *zend_test_unit_enum;
Expand Down Expand Up @@ -1571,6 +1572,7 @@ PHP_MINIT_FUNCTION(zend_test)
zend_test_ns_foo_class = register_class_ZendTestNS_Foo();
zend_test_ns_unlikely_compile_error_class = register_class_ZendTestNS_UnlikelyCompileError();
zend_test_ns_not_unlikely_compile_error_class = register_class_ZendTestNS_NotUnlikelyCompileError();
zend_test_ns_bar_class = register_class_ZendTestNS_Bar();
zend_test_ns2_foo_class = register_class_ZendTestNS2_Foo();
zend_test_ns2_ns_foo_class = register_class_ZendTestNS2_ZendSubNS_Foo();

Expand Down
4 changes: 4 additions & 0 deletions ext/zend_test/test.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ class Foo {
public function method(): int {}
}

interface Bar {}

class UnlikelyCompileError {
/* This method signature would create a compile error due to the string
* "ZendTestNS\UnlikelyCompileError" in the generated macro call */
Expand All @@ -383,6 +385,8 @@ public function method(): ?NotUnlikelyCompileError {}

class Foo {
public ZendSubNS\Foo $foo;
public ZendSubNS\Foo&\ZendTestNS\Bar $intersectionProp;
public ZendSubNS\Foo|\ZendTestNS\Bar $unionProp;

public function method(): void {}
}
Expand Down
38 changes: 37 additions & 1 deletion ext/zend_test/test_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ext/zend_test/test_decl.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 23 additions & 1 deletion ext/zend_test/test_legacy_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions ext/zend_test/tests/gen_stub_test_01.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@ var_dump($foo);
object(ZendTestNS2\Foo)#%d (%d) {
["foo"]=>
uninitialized(ZendTestNS2\ZendSubNS\Foo)
["intersectionProp"]=>
uninitialized(ZendTestNS2\ZendSubNS\Foo&ZendTestNS\Bar)
["unionProp"]=>
uninitialized(ZendTestNS2\ZendSubNS\Foo|ZendTestNS\Bar)
}
object(ZendTestNS2\Foo)#%d (%d) {
["foo"]=>
object(ZendTestNS2\ZendSubNS\Foo)#%d (%d) {
}
["intersectionProp"]=>
uninitialized(ZendTestNS2\ZendSubNS\Foo&ZendTestNS\Bar)
["unionProp"]=>
uninitialized(ZendTestNS2\ZendSubNS\Foo|ZendTestNS\Bar)
}
object(ZendTestNS\UnlikelyCompileError)#%d (%d) {
}
Expand Down
Loading