File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -544,6 +544,11 @@ private static function unionWithSubtractedType(
544544 $ subtractedType = $ type ->getSubtractedType () === null
545545 ? $ subtractedType
546546 : self ::union ($ type ->getSubtractedType (), $ subtractedType );
547+
548+ $ subtractedType = self ::intersect (
549+ $ type ->getTypeWithoutSubtractedType (),
550+ $ subtractedType ,
551+ );
547552 if ($ subtractedType instanceof NeverType) {
548553 $ subtractedType = null ;
549554 }
Original file line number Diff line number Diff line change @@ -4127,6 +4127,22 @@ public static function dataIntersect(): iterable
41274127 IntersectionType::class,
41284128 'lowercase-string&uppercase-string ' ,
41294129 ],
4130+ [
4131+ [
4132+ new ObjectType (DateTime::class),
4133+ new MixedType (subtractedType: new NullType ()),
4134+ ],
4135+ ObjectType::class,
4136+ 'DateTime ' ,
4137+ ],
4138+ [
4139+ [
4140+ new ObjectWithoutClassType (),
4141+ new MixedType (subtractedType: new NullType ()),
4142+ ],
4143+ ObjectWithoutClassType::class,
4144+ 'object ' ,
4145+ ],
41304146 ];
41314147
41324148 if (PHP_VERSION_ID < 80100 ) {
You can’t perform that action at this time.
0 commit comments