@@ -1033,21 +1033,16 @@ function (Expr $expr) use (&$defaultValueConstant) {
1033
1033
}
1034
1034
1035
1035
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 ()) {
1043
1038
$ simpleType = $ this ->type ->tryToSimpleType ();
1044
1039
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) " ;
1046
1041
} else {
1047
1042
throw new Exception ("Property $ this ->name has an unsupported union type " );
1048
1043
}
1049
1044
} else {
1050
- $ typeCode = "(zend_type) ZEND_TYPE_INIT_MASK( " . $ typeFlags ->toTypeMask () . ") " ;
1045
+ $ typeCode = "(zend_type) ZEND_TYPE_INIT_MASK( " . $ arginfoType ->toTypeMask () . ") " ;
1051
1046
}
1052
1047
1053
1048
$ code .= $ this ->initializeValue ($ defaultValueType , $ defaultValue );
@@ -1261,9 +1256,9 @@ public function getRegistration(): string
1261
1256
continue ;
1262
1257
}
1263
1258
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 );
1267
1262
}
1268
1263
}
1269
1264
$ params = array_unique ($ params );
0 commit comments