Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes two oddities in the code that became visible after I introduced isEmptyArray on a previous PR.
First, on ArrayFetchAnalyzer.php we were setting two variables from_empty_array and from_mixed_array after we already stated that the array was empty. Those variables had only one possible value so I removed them
Second, on SimpleNegatedAssertionReconciler.php, the original code on line 530 was
$array_atomic_type->getId() !== 'array<never, never>'
that means that the only way not to enter the next conditional was to have an empty array but the next conditional checks$array_atomic_type instanceof TKeyedArray
which is not compatible witharray<never, never>
, making it dead code.However, I'm not sure my fixes are optimal.
On the first, the code was clearly meant for handling more than empty arrays, so maybe I should have dropped the isEmptyArray in conditional and that would have worked better
On the second, I just placed the dead condition up in the code but I didn't even read the code or tested it, so not sure it will work right.
I'm opening this not to forget about the issue and to open a discussion if someone has hints