Open kkmuffme opened 2 years ago
I found these snippets:
Even though in this particular case it could be replaced with array_walk()
(https://psalm.dev/r/50774895f1) the concept of conditional mutability would be interesting to explore.
I found these snippets:
The code you provided with array_walk
causes a PHP notice:
unlink() expects parameter 2 to be resource, int given
#0 [internal function] (): unlink( $filename = 'file.log', $context = 0 )
#1 \file.php (807): array_walk( $input = Array, $funcname = 'unlink' )
``
That's true. It could be easily fixed by wrapping the unlink()
into a closure with a single argument, of course: https://psalm.dev/r/8decfdf179
I found these snippets:
https://psalm.dev/r/33a00f8479
While technically unused, PHP throws notices if any of the files in the array don't exist (and therefore cannot be unlinked). Most people would not use the return value here.
Since psalm does not complain about an unused return value of "unlink" it should not complain about unused return value when "unlink" is used in array_map*
*I assume there are other similar functions, for which this should apply too - if psalm does not complain about unused return value if the function is called standalone, it should not complain about unused return value if it's used in array_map