@@ -205,6 +205,7 @@ public static function fromString(string $typeString): SimpleType
205
205
case "mixed " :
206
206
case "static " :
207
207
case "never " :
208
+ case "ref " :
208
209
return new SimpleType (strtolower ($ typeString ), true );
209
210
case "array " :
210
211
return ArrayType::createGenericArray ();
@@ -358,6 +359,8 @@ public function toOptimizerTypeMaskForArrayValue(): string {
358
359
return "MAY_BE_ARRAY_OF_RESOURCE " ;
359
360
case "mixed " :
360
361
return "MAY_BE_ARRAY_OF_ANY " ;
362
+ case "ref " :
363
+ return "MAY_BE_ARRAY_OF_REF " ;
361
364
default :
362
365
throw new Exception ("Type $ this ->name cannot be an array value " );
363
366
}
@@ -397,9 +400,6 @@ class Type {
397
400
/** @var SimpleType[] */
398
401
public $ types ;
399
402
400
- /** @var bool */
401
- public $ isReferenceSupported ;
402
-
403
403
public static function fromNode (Node $ node ): Type {
404
404
if ($ node instanceof Node \UnionType) {
405
405
return new Type (array_map (['SimpleType ' , 'fromNode ' ], $ node ->types ), false );
@@ -423,7 +423,6 @@ public static function fromString(string $typeString): self {
423
423
$ simpleTypes = [];
424
424
$ simpleTypeOffset = 0 ;
425
425
$ inArray = false ;
426
- $ referenceSupported = false ;
427
426
428
427
$ typeStringLength = strlen ($ typeString );
429
428
for ($ i = 0 ; $ i < $ typeStringLength ; $ i ++) {
@@ -446,25 +445,20 @@ public static function fromString(string $typeString): self {
446
445
if ($ char === "| " ) {
447
446
$ simpleTypeName = trim (substr ($ typeString , $ simpleTypeOffset , $ i - $ simpleTypeOffset ));
448
447
449
- if (strtolower ($ simpleTypeName ) === "ref " ) {
450
- $ referenceSupported = true ;
451
- } else {
452
- $ simpleTypes [] = SimpleType::fromString ($ simpleTypeName );
453
- }
448
+ $ simpleTypes [] = SimpleType::fromString ($ simpleTypeName );
454
449
455
450
$ simpleTypeOffset = $ i + 1 ;
456
451
}
457
452
}
458
453
459
- return new Type ($ simpleTypes, $ referenceSupported );
454
+ return new Type ($ simpleTypes );
460
455
}
461
456
462
457
/**
463
458
* @param SimpleType[] $types
464
459
*/
465
- private function __construct (array $ types, bool $ isReferenceSupported ) {
460
+ private function __construct (array $ types ) {
466
461
$ this ->types = $ types ;
467
- $ this ->isReferenceSupported = $ isReferenceSupported ;
468
462
}
469
463
470
464
public function isScalar (): bool {
@@ -547,10 +541,6 @@ public function toOptimizerTypeMaskForArrayValue(): string {
547
541
$ typeMasks [] = $ type ->toOptimizerTypeMaskForArrayValue ();
548
542
}
549
543
550
- if ($ this ->isReferenceSupported ) {
551
- $ typeMasks [] = "MAY_BE_ARRAY_OF_REF " ;
552
- }
553
-
554
544
return implode ("| " , $ typeMasks );
555
545
}
556
546
@@ -592,10 +582,6 @@ public static function equals(?Type $a, ?Type $b): bool {
592
582
}
593
583
}
594
584
595
- if ($ a ->isReferenceSupported !== $ b ->isReferenceSupported ) {
596
- return false ;
597
- }
598
-
599
585
return true ;
600
586
}
601
587
0 commit comments