Fix/issue 7144#1299
Conversation
|
I think that somehow, you need to handle multidimensional arrays too. The new error in CI is a false-positive: https://github.com/composer/composer/blob/3ae111140facdba8ae82adcd1085e4adfc7d715c/src/Composer/Util/Http/CurlDownloader.php#L230-L236 |
|
@ondrejmirtes To solve this case we need to implement type specification of Maybe I should solve these issues before this PR to avoid these kind of regressions (I'm looking into these issues but not easy to solve...) |
There was a problem hiding this comment.
The goal for #1299 (comment) is to make $options[$type] specified by isset and also from $type === 'ssl' the array type can be array{http: array, ssl: array} (which looks not that easy to solve, because it is a result of multiple conditional expressions)
|
I'm happy with the improved type inference of this PR, I just don't want this code https://github.com/composer/composer/blob/3ae111140facdba8ae82adcd1085e4adfc7d715c/src/Composer/Util/Http/CurlDownloader.php#L230-L236 to report these errors: Because the code involves expressions like |
|
I had investigated this issue in #1187.
this part is not true due to phpstan-src/src/Analyser/MutatingScope.php Lines 4358 to 4365 in 6f1535a I tried to remove this line, but was not sure how to solve the failing tests. I'll look into it again!:+1: |
|
The linked lines are supposed to be just an optimization that we might be able to remove I think. (But it's a long time since I touched these parts last time). |
fixes phpstan/phpstan#7144
The root cause of this issue is expressed in this test dc5e865.
When specifying
ArrayDimFetchtype, it was relying only on$dimType, which can be any type as seen in the test.The type to be specified should be only be a key existing in array`.