Rename `Type\IntegerValue` to `Type\Integer`. It was originally named
`IntegerValue` because static analysis sees `Integer` in docblock
annotations and treats it as the native `int` type. `Integer` is not a
reserved word in PHP, so it should be named `Integer` for consistency
with other types in this library. When using it, a class alias prevents
static analysis from complaining.
As documented in https://wiki.php.net/rfc/use_global_elements, the engine (by default) does a local namespace
lookup, then falls back to global namespace when first calling a global function referenced in namespaced code,
unless that function is referenced via fully qualified name (FQN).
By using the FQN, the actual symbol can be looked up at compile-time, both by the PHP engine and by static analysis
tooling, allowing for compiler (in particular) optimizations to replace known hot-path functions with specialized opcodes.
Sadly, no actual benchmark at hand: the improvements can be minimal or massive, depending on where this library is
used (tight loops being most relevant).
* 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