diff --git a/CHANGELOG.md b/CHANGELOG.md index 909a0192..099c7b43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,9 +14,9 @@ For a full diff see [`1.0.0...2.0.0`][1.0.0...2.0.0]. ## Changed -- Renamed named constructors and accessors of `Exception\InvalidJsonPointer`, `JsonPointer`, and `ReferenceToken` ([#4]), by [@localheinz] +- Renamed named constructors and accessors of `Exception\InvalidJsonPointer`, `JsonPointer`, and `ReferenceToken` ([#4]) and ([#5]), by [@localheinz] - - `Exception\InvalidJsonPointer::fromString()` to `JsonPointer::fromJsonString()` + - `Exception\InvalidJsonPointer::fromString()` to `Exception\InvalidJsonPointer::fromJsonString()` - `JsonPointer::fromString()` to `JsonPointer::fromJsonString()` - `JsonPointer::toString()` to `JsonPointer::toJsonString()` - `ReferenceToken::fromEscapedString()` to `ReferenceToken::fromJsonString()` @@ -40,5 +40,6 @@ For a full diff see [`a5ba52c...1.0.0`][a5ba52c...1.0.0]. [#1]: https://github.com/ergebnis/json-pointer/pull/1 [#2]: https://github.com/ergebnis/json-pointer/pull/2 [#4]: https://github.com/ergebnis/json-pointer/pull/4 +[#5]: https://github.com/ergebnis/json-pointer/pull/5 [@localheinz]: https://github.com/localheinz diff --git a/src/Exception/InvalidReferenceToken.php b/src/Exception/InvalidReferenceToken.php index 85b7e7aa..ab990b5d 100644 --- a/src/Exception/InvalidReferenceToken.php +++ b/src/Exception/InvalidReferenceToken.php @@ -15,7 +15,7 @@ final class InvalidReferenceToken extends \InvalidArgumentException implements Exception { - public static function fromString(string $value): self + public static function fromJsonString(string $value): self { return new self(\sprintf( 'Value "%s" does not appear to be a valid JSON Pointer reference token.', diff --git a/src/ReferenceToken.php b/src/ReferenceToken.php index 5f6ebb05..82c2aec8 100644 --- a/src/ReferenceToken.php +++ b/src/ReferenceToken.php @@ -47,7 +47,7 @@ public static function fromInt(int $value): self public static function fromJsonString(string $value): self { if (1 !== \preg_match('/^(?P((?P[\x00-\x2E]|[\x30-\x7D]|[\x7F-\x{10FFFF}])|(?P~[01]))*)$/u', $value)) { - throw Exception\InvalidReferenceToken::fromString($value); + throw Exception\InvalidReferenceToken::fromJsonString($value); } return new self($value); diff --git a/test/Unit/Exception/InvalidReferenceTokenTest.php b/test/Unit/Exception/InvalidReferenceTokenTest.php index 746c3f28..136f5232 100644 --- a/test/Unit/Exception/InvalidReferenceTokenTest.php +++ b/test/Unit/Exception/InvalidReferenceTokenTest.php @@ -26,11 +26,11 @@ final class InvalidReferenceTokenTest extends Framework\TestCase { use Test\Util\Helper; - public function testFromStringReturnsInvalidReferenceToken(): void + public function testFromJsonStringReturnsInvalidReferenceToken(): void { $value = self::faker()->word(); - $exception = Exception\InvalidReferenceToken::fromString($value); + $exception = Exception\InvalidReferenceToken::fromJsonString($value); $message = \sprintf( 'Value "%s" does not appear to be a valid JSON Pointer reference token.',