1313use function array_merge ;
1414use function array_reverse ;
1515use function array_splice ;
16+ use function assert ;
1617use function count ;
1718use function in_array ;
1819use function max ;
@@ -152,9 +153,7 @@ private function addSuiteToDefectSortOrder(TestSuite $suite): void
152153 $ max = 0 ;
153154
154155 foreach ($ suite ->tests () as $ test ) {
155- if (!$ test instanceof Reorderable) {
156- continue ;
157- }
156+ assert ($ test instanceof Reorderable);
158157
159158 if (!isset ($ this ->defectSortOrder [$ test ->sortId ()])) {
160159 $ this ->defectSortOrder [$ test ->sortId ()] = $ this ->cache ->status ($ test ->sortId ())->asInt ();
@@ -216,9 +215,8 @@ private function sortBySize(array $tests): array
216215 */
217216 private function cmpDefectPriorityAndTime (Test $ a , Test $ b ): int
218217 {
219- if (!($ a instanceof Reorderable && $ b instanceof Reorderable)) {
220- return 0 ;
221- }
218+ assert ($ a instanceof Reorderable);
219+ assert ($ b instanceof Reorderable);
222220
223221 $ priorityA = $ this ->defectSortOrder [$ a ->sortId ()] ?? 0 ;
224222 $ priorityB = $ this ->defectSortOrder [$ b ->sortId ()] ?? 0 ;
@@ -241,9 +239,8 @@ private function cmpDefectPriorityAndTime(Test $a, Test $b): int
241239 */
242240 private function cmpDuration (Test $ a , Test $ b ): int
243241 {
244- if (!($ a instanceof Reorderable && $ b instanceof Reorderable)) {
245- return 0 ;
246- }
242+ assert ($ a instanceof Reorderable);
243+ assert ($ b instanceof Reorderable);
247244
248245 return $ this ->cache ->time ($ a ->sortId ()) <=> $ this ->cache ->time ($ b ->sortId ());
249246 }
0 commit comments