Coming from https://github.com/ramsey/uuid/pull/603, this is an attempt
to fix the errors raised by the current phpstan settings.
I went through each of the errors raised by phpstan with the following
approach.
- If a method is part of an `@immutable` class, we can consider it pure,
assuming it only affects internal variables.
- If a potentially pure method is calling a class's method that is only
swapped during testing (and not during normal usage), then we can
consider the calling method pure.
- If a class is marked deprecated, don't bother with attempting to mark
it pure or immutable.
The following are deprecated:
* `Ramsey\Uuid\Codec\OrderedTimeCodec`
* `Ramsey\Uuid\Codec\TimestampFirstCombCodec`
* `Ramsey\Uuid\Codec\TimestampLastCombCodec`
* `Ramsey\Uuid\Generator\CombGenerator`
Similarly to UUIDs, a hexadecimal can never be empty, this PR documents
it as such.
More and more libraries are starting to enforce stricter typing, I was
dealing with a library that required a `non-empty-string` which
hexadecimal isn't (is, but isn't documented that it is) which requires
either baselining false positives are adding redundant assertions.
Fixed deprecation warning for str_getcsv in php 8.4, since the default
parameter will change, by providing the parameter explicitly.
Sidenote: some of the vendor packages still have the same issue with
deprecation warnings when running code maintenance tools. They should be
updated as well.
Closes#587
Even tho, the `Stringable` interface is implicit on all objects containing the method `__toString`, it is recommended by PHP to explicitly setting that interface.
From php.net documentation:
> [...] Unlike most interfaces, **Stringable** is implicitly present on any class that has the magic `__toString()` method defined, although it can and should be declared explicitly.
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
* Assert, for psalm, the string is non-empty if validation passes
* Adds a test for SA asserting that valid string are also non-empty
* Suppress PHPStan error for unsupported conditional type assertion
* Check SA tools don't complain about non-empty-string as input parameter to `Uuid::isValid()`