Skip to content

Commit f1ae302

Browse files
authored
Merge pull request #5 from ergebnis/fix/rename
Fix: Rename method
2 parents cab2b33 + 836b334 commit f1ae302

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

CHANGELOG.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ For a full diff see [`1.0.0...2.0.0`][1.0.0...2.0.0].
1414

1515
## Changed
1616

17-
- Renamed named constructors and accessors of `Exception\InvalidJsonPointer`, `JsonPointer`, and `ReferenceToken` ([#4]), by [@localheinz]
17+
- Renamed named constructors and accessors of `Exception\InvalidJsonPointer`, `JsonPointer`, and `ReferenceToken` ([#4]) and ([#5]), by [@localheinz]
1818

19-
- `Exception\InvalidJsonPointer::fromString()` to `JsonPointer::fromJsonString()`
19+
- `Exception\InvalidJsonPointer::fromString()` to `Exception\InvalidJsonPointer::fromJsonString()`
2020
- `JsonPointer::fromString()` to `JsonPointer::fromJsonString()`
2121
- `JsonPointer::toString()` to `JsonPointer::toJsonString()`
2222
- `ReferenceToken::fromEscapedString()` to `ReferenceToken::fromJsonString()`
@@ -40,5 +40,6 @@ For a full diff see [`a5ba52c...1.0.0`][a5ba52c...1.0.0].
4040
[#1]: https://github.com/ergebnis/json-pointer/pull/1
4141
[#2]: https://github.com/ergebnis/json-pointer/pull/2
4242
[#4]: https://github.com/ergebnis/json-pointer/pull/4
43+
[#5]: https://github.com/ergebnis/json-pointer/pull/5
4344

4445
[@localheinz]: https://github.com/localheinz

src/Exception/InvalidReferenceToken.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
final class InvalidReferenceToken extends \InvalidArgumentException implements Exception
1717
{
18-
public static function fromString(string $value): self
18+
public static function fromJsonString(string $value): self
1919
{
2020
return new self(\sprintf(
2121
'Value "%s" does not appear to be a valid JSON Pointer reference token.',

src/ReferenceToken.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static function fromInt(int $value): self
4747
public static function fromJsonString(string $value): self
4848
{
4949
if (1 !== \preg_match('/^(?P<referenceToken>((?P<unescaped>[\x00-\x2E]|[\x30-\x7D]|[\x7F-\x{10FFFF}])|(?P<escaped>~[01]))*)$/u', $value)) {
50-
throw Exception\InvalidReferenceToken::fromString($value);
50+
throw Exception\InvalidReferenceToken::fromJsonString($value);
5151
}
5252

5353
return new self($value);

test/Unit/Exception/InvalidReferenceTokenTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ final class InvalidReferenceTokenTest extends Framework\TestCase
2626
{
2727
use Test\Util\Helper;
2828

29-
public function testFromStringReturnsInvalidReferenceToken(): void
29+
public function testFromJsonStringReturnsInvalidReferenceToken(): void
3030
{
3131
$value = self::faker()->word();
3232

33-
$exception = Exception\InvalidReferenceToken::fromString($value);
33+
$exception = Exception\InvalidReferenceToken::fromJsonString($value);
3434

3535
$message = \sprintf(
3636
'Value "%s" does not appear to be a valid JSON Pointer reference token.',

0 commit comments

Comments
 (0)