Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Rename method #5

Merged
merged 1 commit into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand All @@ -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
2 changes: 1 addition & 1 deletion src/Exception/InvalidReferenceToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
2 changes: 1 addition & 1 deletion src/ReferenceToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function fromInt(int $value): self
public static function fromJsonString(string $value): self
{
if (1 !== \preg_match('/^(?P<referenceToken>((?P<unescaped>[\x00-\x2E]|[\x30-\x7D]|[\x7F-\x{10FFFF}])|(?P<escaped>~[01]))*)$/u', $value)) {
throw Exception\InvalidReferenceToken::fromString($value);
throw Exception\InvalidReferenceToken::fromJsonString($value);
}

return new self($value);
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/Exception/InvalidReferenceTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down