Skip to content
This repository was archived by the owner on Sep 1, 2023. It is now read-only.

Commit 8dc010a

Browse files
committed
3.21 compat: less clever ?? operator
1 parent c53822d commit 8dc010a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/TypeSpec/__Private/from_type_structure.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,24 +156,22 @@ function from_type_structure<T>(TypeStructure<T> $ts): TypeSpec<T> {
156156
return new KeyedTraversableSpec(
157157
$classname,
158158
from_type_structure(
159-
TypeAssert\not_null($ts['generic_types'][0] ?? null),
159+
TypeAssert\not_null($ts['generic_types'] ?? null)[0],
160160
),
161161
from_type_structure(
162-
TypeAssert\not_null($ts['generic_types'][1] ?? null),
162+
TypeAssert\not_null($ts['generic_types'] ?? null)[1],
163163
),
164164
);
165165
}
166-
if (
167-
is_a($classname, Traversable::class, /* strings = */ true)
168-
) {
166+
if (is_a($classname, Traversable::class, /* strings = */ true)) {
169167
return new TraversableSpec(
170168
$classname,
171169
from_type_structure(
172-
TypeAssert\not_null($ts['generic_types'][0] ?? null),
170+
TypeAssert\not_null($ts['generic_types'] ?? null)[0],
173171
),
174172
);
175173
}
176-
return new InstanceOfSpec(TypeAssert\not_null($ts['classname']));
174+
return new InstanceOfSpec($classname);
177175
}
178176
case TypeStructureKind::OF_TRAIT:
179177
throw new UnsupportedTypeException('OF_TRAIT');

0 commit comments

Comments
 (0)