* Run Psalm on src as well as Static Analysis Fixture
Psalm baselining feature is used to prevent immediate build failures -
psalm will just cause failures for errors caused by future changes to
the code.
See https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file
* Fix MixedArgument issues in OrderedTimeCodec
Potentially unpack should be documented as returning string[] instead of
array to make this unecassary.
* Fix Psalm PossiblyNullPropertyAssignmentValue issues
* Add psalm-immutable annotation to Uuid class
* Fix Psalm MixedArgument issues
* Fix MissingImmutableAnnotation psalm issue
* Fix Psalm MixedAssignment issue
* Fix Psalm InvalidReturnStatement / InvalidReturnType issue
* Add ImpureMethodCall issues to baseline.
Fixing these in one place just moves them somewhere else.
* Exclude psalm-baseline.xml from exported git archives
This change is the minimum requirement to make the static analysis suite pass checks
on immutability/purity invariants of a `Uuid` and `UuidInterface`: it doesn't ensure
that internals of `Uuid` are pure. That will need deprecation of `Uuid::setFactory()`,
as well as marking any types referenced in private state as `@psalm-immutable` too.
That's out of scope for the current patch, which provides a good 80/20 split on purity
invariants for most (even advanced) UUID downstream users.
* Maintain backwards compatibility with the former Uuid::isValid() and
Uuid::VALID_PATTERN
* Remove the assert statements in favor of str_replace and preg_match
* Make the validator a featureset of the factory
* Remove old suggestion about locations of constants
* Remove argument count assertions
* Remove VALID_PATTERN from Uuid
The 6 bytes obtained from `random_bytes()` is a 48-bit integer, which
cannot be converted to decimal on a 32-bit system, without being
implicitly cast to a float by PHP. This was causing problems with
setting the multicast bit, and it led to non-random node values.
This new approach splits the 6 bytes up into two 3-byte values, each a
24-bit integer, and applies the multicast bit to the most significant
bits before re-combining the bytes as a string.
Function api is a set of simple autoloaded functions to create uuids proxying the Uuid class static methods.
They provide easy and clean ways of just creating string represented uuids instead of the class.
If passthru() is disabled in php.ini, this will force the
SystemNodeProvider to return `false` for the node. Using the default
FallbackNodeProvider, ramsey/uuid will default to the
RandomNodeProvider, in these cases.
Closes#114
* Changes location of providers in the SystemNodeProviderTest
They are now grouped at the bottom of the class.
* Adds logic to SystemNodeProviderTest.
* Changes call to `file_get_contents` SystemNodeProvider so it can be
mocked.
* Changes SystemNodeProviderTest so native PHP functions are mocked
instead of the class under test.
* Changes SystemNodeProviderTest so "\n" is used instead of PHP_EOL
As the (input or output) of the tests is not system dependant it does
not make sense to use PHP_EOL. All of these instance have been
replaced for the sake of readability and stating intent more clearly.
* Adds dataprovider to SystemNodeProvider main test for input
variations.
* Adds OS to SystemNodeProviderTest dataprovider for Linux fail
scenario.
* Adds test for SystemNodeProvider to ensure invalid values are not
accepted.
* Changes names of dataproviders in SystemNodeProviderTest for
consistency.
* Changes SystemNodeProviderTest by grouping dataproviders together.
* Changes method in SystemNodeProviderTest to use the provided mock
functions.
* Fixes PSR-2 coding conventions in SystemNodeProviderTest.
* Minor change to SystemNodeProviderTest based on review.