@@ -361,79 +361,51 @@ public function isMixed(): bool {
361361 return $ this ->isBuiltin && $ this ->name === 'mixed ' ;
362362 }
363363
364- public function toTypeCode (): string {
365- assert ($ this ->isBuiltin );
366- switch ($ this ->name ) {
367- case "bool " :
368- return "_IS_BOOL " ;
369- case "int " :
370- return "IS_LONG " ;
371- case "float " :
372- return "IS_DOUBLE " ;
373- case "string " :
374- return "IS_STRING " ;
375- case "array " :
376- return "IS_ARRAY " ;
377- case "object " :
378- return "IS_OBJECT " ;
379- case "void " :
380- return "IS_VOID " ;
381- case "callable " :
382- return "IS_CALLABLE " ;
383- case "mixed " :
384- return "IS_MIXED " ;
385- case "static " :
386- return "IS_STATIC " ;
387- case "never " :
388- return "IS_NEVER " ;
389- case "null " :
390- return "IS_NULL " ;
391- case "false " :
392- return "IS_FALSE " ;
393- case "true " :
394- return "IS_TRUE " ;
395- default :
396- throw new Exception ("Not implemented: $ this ->name " );
397- }
398- }
399-
400- public function toTypeMask (): string {
364+ private function toTypeInfo (): array {
401365 assert ($ this ->isBuiltin );
402366
403367 switch ($ this ->name ) {
404368 case "null " :
405- return " MAY_BE_NULL " ;
369+ return [ " IS_NULL " , " MAY_BE_NULL "] ;
406370 case "false " :
407- return " MAY_BE_FALSE " ;
371+ return [ " IS_FALSE " , " MAY_BE_FALSE "] ;
408372 case "true " :
409- return " MAY_BE_TRUE " ;
373+ return [ " IS_TRUE " , " MAY_BE_TRUE "] ;
410374 case "bool " :
411- return " MAY_BE_BOOL " ;
375+ return [ " _IS_BOOL " , " MAY_BE_BOOL "] ;
412376 case "int " :
413- return " MAY_BE_LONG " ;
377+ return [ " IS_LONG " , " MAY_BE_LONG "] ;
414378 case "float " :
415- return " MAY_BE_DOUBLE " ;
379+ return [ " IS_DOUBLE " , " MAY_BE_DOUBLE "] ;
416380 case "string " :
417- return " MAY_BE_STRING " ;
381+ return [ " IS_STRING " , " MAY_BE_STRING "] ;
418382 case "array " :
419- return " MAY_BE_ARRAY " ;
383+ return [ " IS_ARRAY " , " MAY_BE_ARRAY "] ;
420384 case "object " :
421- return " MAY_BE_OBJECT " ;
385+ return [ " IS_OBJECT " , " MAY_BE_OBJECT "] ;
422386 case "callable " :
423- return " MAY_BE_CALLABLE " ;
387+ return [ " IS_CALLABLE " , " MAY_BE_CALLABLE "] ;
424388 case "mixed " :
425- return " MAY_BE_ANY " ;
389+ return [ " IS_MIXED " , " MAY_BE_ANY "] ;
426390 case "void " :
427- return " MAY_BE_VOID " ;
391+ return [ " IS_VOID " , " MAY_BE_VOID "] ;
428392 case "static " :
429- return " MAY_BE_STATIC " ;
393+ return [ " IS_STATIC " , " MAY_BE_STATIC "] ;
430394 case "never " :
431- return " MAY_BE_NEVER " ;
395+ return [ " IS_NEVER " , " MAY_BE_NEVER "] ;
432396 default :
433397 throw new Exception ("Not implemented: $ this ->name " );
434398 }
435399 }
436400
401+ public function toTypeCode (): string {
402+ return $ this ->toTypeInfo ()[0 ];
403+ }
404+
405+ public function toTypeMask (): string {
406+ return $ this ->toTypeInfo ()[1 ];
407+ }
408+
437409 public function toOptimizerTypeMaskForArrayKey (): string {
438410 assert ($ this ->isBuiltin );
439411
0 commit comments