You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
results in [EA] New value type (array) is not matching the resolved parameter type and might introduce types-related false-positives. on line 3.
Adding is_string check for $_POST['avatar'] before this does not help, either (now on line 4)
Which suggests that $_POST['avatar'] is interpreted as array regardless, even though, technically, it should be mixed.
Expected behaviour
While it may be a valid point to mark the first example as potential issue, second example with type check should not be marked, at all. This may be related to #1930, but creating as a new bug, since description seem to suggest a different set of expectations, which may be specific to example there.
Environment details
PhpStorm 2023.3.6
Build #PS-233.15026.12, built on March 21, 2024
Licensed to simbiat.ru / Dmitry Kustov
Subscription is active until May 11, 2024.
For non-commercial open source development only.
Runtime version: 17.0.10+1-b1087.23 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
GC: G1 Young Generation, G1 Old Generation
Memory: 5120M
Cores: 16
Registry:
debugger.new.tool.window.layout=true
run.processes.with.pty=TRUE
ide.experimental.ui=true
Non-Bundled Plugins:
com.jetbrains.space (233.15026.16)
com.kalessil.phpStorm.phpInspectionsEA (5.0.0.0)
The text was updated successfully, but these errors were encountered:
i wonder where the inspection is getting array as a possible assignment type... Is it because you're returning [], which is never assigned to the variable in the first place?
What happens if you change the return type to string and return '';?
This is not related to return type (and changing it will not do anything), but to the fact, that function defines type for $fileid, and I am then assigning to it something, that can be not a string. $_POST['avatar'] is treated as mixed, but array is probably taken from $_POST, which is, indeed, an array.
Current behaviour
Code like
results in
[EA] New value type (array) is not matching the resolved parameter type and might introduce types-related false-positives.
on line 3.Adding
is_string
check for $_POST['avatar'] before this does not help, either (now on line 4)The only way to "fix" this is to change type of
$fileid
by allowing array:Which suggests that
$_POST['avatar']
is interpreted as array regardless, even though, technically, it should bemixed
.Expected behaviour
While it may be a valid point to mark the first example as potential issue, second example with type check should not be marked, at all. This may be related to #1930, but creating as a new bug, since description seem to suggest a different set of expectations, which may be specific to example there.
Environment details
The text was updated successfully, but these errors were encountered: