@@ -1033,21 +1033,16 @@ function (Expr $expr) use (&$defaultValueConstant) {
10331033 }
10341034
10351035 if ($ this ->type ) {
1036- $ typeFlags = $ this ->type ->tryToRepresentableType ();
1037- if ($ typeFlags === null ) {
1038- echo "Skipping code generation for property $ this ->name , because it has an unimplemented type \n" ;
1039- return "" ;
1040- }
1041-
1042- if ($ typeFlags ->classType ) {
1036+ $ arginfoType = $ this ->type ->toArginfoType ();
1037+ if ($ arginfoType ->hasClassType ()) {
10431038 $ simpleType = $ this ->type ->tryToSimpleType ();
10441039 if ($ simpleType ) {
1045- $ typeCode = "(zend_type) ZEND_TYPE_INIT_CE(class_entry_ " . str_replace ("\\" , "_ " , $ typeFlags -> classType ->name ) . ", " . ((int ) $ this ->type ->isNullable ()) . ", 0) " ;
1040+ $ typeCode = "(zend_type) ZEND_TYPE_INIT_CE(class_entry_ " . str_replace ("\\" , "_ " , $ arginfoType -> classTypes [ 0 ] ->name ) . ", " . ((int ) $ this ->type ->isNullable ()) . ", 0) " ;
10461041 } else {
10471042 throw new Exception ("Property $ this ->name has an unsupported union type " );
10481043 }
10491044 } else {
1050- $ typeCode = "(zend_type) ZEND_TYPE_INIT_MASK( " . $ typeFlags ->toTypeMask () . ") " ;
1045+ $ typeCode = "(zend_type) ZEND_TYPE_INIT_MASK( " . $ arginfoType ->toTypeMask () . ") " ;
10511046 }
10521047
10531048 $ code .= $ this ->initializeValue ($ defaultValueType , $ defaultValue );
@@ -1261,9 +1256,9 @@ public function getRegistration(): string
12611256 continue ;
12621257 }
12631258
1264- $ representableType = $ type ->tryToRepresentableType ();
1265- if ($ representableType && $ representableType -> classType ) {
1266- $ params [] = "zend_class_entry *class_entry_ " . str_replace ("\\" , "_ " , $ representableType -> classType ->name );
1259+ $ arginfoType = $ type ->toArginfoType ();
1260+ if (count ( $ arginfoType -> classTypes ) == 1 ) {
1261+ $ params [] = "zend_class_entry *class_entry_ " . str_replace ("\\" , "_ " , $ arginfoType -> classTypes [ 0 ] ->name );
12671262 }
12681263 }
12691264 $ params = array_unique ($ params );
0 commit comments