Commit Graph

831 Commits

Author SHA1 Message Date
Ben Ramsey 5d1f106882 Rename Validator\Validator to Validator\GenericValidator 2020-01-18 12:14:00 -06:00
Ben Ramsey 2ad77d9ca7 Remove CalculatorInterface as a Uuid constructor parameter 2020-01-18 12:14:00 -06:00
Ben Ramsey 52f764c284 Change first constructor param in Uuid to Rfc4122\FieldsInterface 2020-01-18 12:14:00 -06:00
Ben Ramsey 360261d617 Deprecate all the fields methods on UuidInterface and Uuid 2020-01-18 12:14:00 -06:00
Ben Ramsey 1c7db1adbd Update descriptions of suggested packages in composer.json 2020-01-18 12:14:00 -06:00
Ben Ramsey 5dc4afb4f7 Remove out-of-date suggestions from composer.json 2020-01-18 12:14:00 -06:00
Ben Ramsey fb812d4564 Add draft upgrade section to the README and remove old requirements 2020-01-18 12:14:00 -06:00
Ben Ramsey 5face57baa Add psalm.xml to the export-ignores 2020-01-18 12:14:00 -06:00
Ben Ramsey 10624f64a1 Change return type of Uuid::getFields() to FieldsInterface 2020-01-18 12:14:00 -06:00
Ben Ramsey e5c45c70f5 Remove the unused docs/ directory 2020-01-18 12:13:59 -06:00
Ben Ramsey c11c023796 Address static analysis issues and add additional tests 2020-01-18 12:13:59 -06:00
Ben Ramsey 26a02a93db Restore ExpectedBehaviorTest as close to 3.x version as possible 2020-01-18 12:13:59 -06:00
Ben Ramsey d7c6f28761 Clean up test names in FeatureSetTest 2020-01-18 12:13:59 -06:00
Ben Ramsey f5cfb5f57d Split known v3 and v5 UUID tests into providers 2020-01-18 12:13:59 -06:00
Ben Ramsey deb888c4a3 Set floating-point precision for tests to "14" 2020-01-18 12:13:59 -06:00
Ben Ramsey 0259a99365 Remove CHANGELOG note about GMP converters 2020-01-18 12:13:59 -06:00
Ben Ramsey 37f72746a7 Remove checks that are no longer necessary 2020-01-18 12:13:59 -06:00
Ben Ramsey c80ad2606f Deprecate degraded UUIDs; they are no longer necessary 2020-01-18 12:13:59 -06:00
Ben Ramsey d543895369 Return string integers instead of int integers 2020-01-18 12:13:58 -06:00
Ben Ramsey 4125885862 Add getTime() to TimeProviderInterface and mark currentTime() deprecated 2020-01-18 12:13:58 -06:00
Ben Ramsey 1e26916bf6 Add getTimestamp() and getClockSeq() to FieldsInterface 2020-01-18 12:13:58 -06:00
Ben Ramsey d665ec8e88 Provide a fallback time converter in case of integers too big 2020-01-18 12:13:58 -06:00
Ben Ramsey 63942c393d Remove Gmp converters; the generic converters are preferred 2020-01-18 12:13:58 -06:00
Ben Ramsey 3546a86f7d Deprecate BigNumberConverter and BigNumberTimeConverter 2020-01-18 12:13:58 -06:00
Ben Ramsey 9b2c93c5b5 Add generic converters for numbers and time 2020-01-18 12:13:58 -06:00
Ben Ramsey cd03f39e9c Depend on brick/math for arbitrary-precision math 2020-01-18 12:13:58 -06:00
Ben Ramsey 07fc6b8f6f Add Hexadecimal, IntegerValue, and Time types 2020-01-18 12:13:57 -06:00
Massimiliano Arione 776e472808 add typehints and return types 2020-01-18 12:13:57 -06:00
Ben Ramsey 668b6ab9a2 Use the codec to encode to binary when using Uuid::getBytes() 2020-01-18 12:13:57 -06:00
Ben Ramsey 4d1db4d090 Clean up class naming conventions 2020-01-18 12:13:57 -06:00
Ben Ramsey ebaa04a6b2 Improve coverage and unit tests for fields, GUIDs, and nonstandard UUIDs 2020-01-18 12:13:57 -06:00
Ben Ramsey aa02825d96 Update CHANGELOG for fields, GUID, and nonstandard UUID support 2020-01-18 12:13:57 -06:00
Ben Ramsey 70eace9086 Introduce separate classes to handle nonstandard UUIDs 2020-01-18 12:13:57 -06:00
Ben Ramsey d6ed9b3832 Introduce separate class support for GUIDs 2020-01-18 12:13:57 -06:00
Ben Ramsey d4dd45e908 Apply fields functionality to Uuid class 2020-01-18 12:13:57 -06:00
Ben Ramsey 24311f2925 Introduce FieldsInterface and base classes for fields support 2020-01-18 12:13:56 -06:00
Ben Ramsey ef999c2b2c Update coding style to include PSR-12, among other options
This also includes heavy use of slevomat/coding-standard to apply
various checks to the code, based on maintainer (me) preference.
2020-01-18 12:13:56 -06:00
Massimiliano Arione 0e7cdfe620 add typehints and return types 2020-01-18 12:13:56 -06:00
Ben Ramsey 3e81dad348 Fix static analysis issues with tests 2020-01-18 12:13:56 -06:00
Ben Ramsey 8e79ff851a Address Psalm errors 2020-01-18 12:13:56 -06:00
Ben Ramsey c0a2ef7d15 Use correct phpcs configuration when running from Travis CI 2020-01-18 12:13:56 -06:00
Ben Ramsey ffc400e009 Change UuidInterface::getInteger() to always return a string value 2020-01-18 12:13:56 -06:00
Ben Ramsey b7f9dc5010 Check for RFC 4122, version 1 UUIDs with OrderedTimeCodec 2020-01-18 12:13:56 -06:00
Barney Laurance bdc9170edc Run Psalm on src as well as Static Analysis Fixture (#282)
* 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
2020-01-18 12:13:56 -06:00
Marco Pivetta 27e1c4e073 Added psalm checks to CI integration configuration
This ensures that the added type annotations are enforced as the library
changes over time.
2020-01-18 12:13:55 -06:00
Marco Pivetta d01922dd14 Marked minimal parts of UuidInterface and Uuid named constructors as pure/immutable
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.
2020-01-18 12:13:55 -06:00
Marco Pivetta c935fbb0d9 Added minimal static analysis test suite to ensure purity/immutability of UUID API
This covers most of the commonly used `Uuid` and `UuidInterface` API, and allows us
to pass around `UuidInterface` references as if they were pure.

Note that this only verifies the *contract* of a `UuidInterface`: it is still very
much possible to write mutable `UuidInterface` implementations (and `Uuid` itself
has such an edge-case, allowing for replacement of the static `UuidFactory` reference),
but if you really do mutate UUIDs at runtime, then your code is very much hurting your
project, and you should get rid of that detail.
2020-01-18 12:13:55 -06:00
Marco Pivetta 17b390cc9c Disabled CS rule enforcing native type declarations where @param or @return are used instead
We can't use this rule for now, since changing interface type declarations is a major
BC break that is not worth introducing for now.
2020-01-18 12:13:55 -06:00
Marco Pivetta ba419f9715 Added vimeo/psalm dependency
`vimeo/psalm` won't be (for now) used to
scan the internals of the library, but just
the public API to be exposed to third parties
2020-01-18 12:13:55 -06:00
Marco Pivetta 667d42b5ce UuidInterface#getInteger() should return a string as per pre-existing declaration 2020-01-18 12:13:55 -06:00