Bug report
The following code generates an error when I don't believe it should:
try {
RamseyUuid::fromString($id);
} catch (InvalidArgumentException) {
throw new InvalidArgumentException('Invalid UUID string provided: ' . $id . '.');
}
Assigning RamseyUuid::fromString($id) to a temporary variable suppresses the issue, but other things (such as SonarCloud) complain about this unused temporary variable.
This seems almost identical to #9564 which was apparently fixed, but this is for a static method.
Code snippet that reproduces the problem
I created a similar example using the DateTime class here: https://phpstan.org/r/07c8eb92-0f17-4b83-9504-657ec679da3a
Expected output
No error reported.
Did PHPStan help you today? Did it make you happy in any way?
We all love PHPStan and use it every day at Box UK :)