Closed peter279k closed 5 years ago
To avoid this issue, it seems that we use the strpos($bytes ?: '', 'Hasselblad')......
at this moment.
This code snippets present in the FR3
and PEF
image detection.
Do you see a better solutions / workaround without lowering the phpstan version and level? It thinks we can leave it as it is.
@odan, I figure out we can consider using casting string type to solve this problem.
My approach is as follows:
?php
$files = new SplFileObject('./composer.json', 'r');
strpos((string) $files->fread(4), "php");
The original approach is as follows:
?php
$files = new SplFileObject('./composer.json', 'r');
strpos($files->fread(4) ?: "", "php");
These two approaches will be passed by php7.2 vendor/bin/phpstan analyse test.php --level=max -c phpstan.neon --no-progress
command.
I think the casting string
type is more readable than using ?:
operator.
I think the casting string type is more readable than using ?: operator.
Yes, indeed. In this case, casting to string, is fine.
Just notice that these code snippets should change into casting string type style.
I think this work is about the enhancement :).
Schould be fixed now.
As title, it seems that we use the latest stable
phpstan
version, but it seems that this doesn't fix the issue currently.It's related to this
phpstan
issue.