Rename isPublicUse() to isGloballyReachable() - #107
Conversation
Greptile SummaryThis PR renames
Confidence Score: 5/5Safe to merge — the rename is a straightforward delegation refactor with no logic changes; the deprecated alias correctly calls through to the new method in all three concrete classes. Every concrete class delegates docs/10-api.md — the deprecated Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant IpInterface
participant IPv4/IPv6/Multi
Note over IpInterface: isPublicUse() @deprecated<br/>isGloballyReachable()
Caller->>IPv4/IPv6/Multi: isPublicUse()
IPv4/IPv6/Multi->>IPv4/IPv6/Multi: isGloballyReachable()
IPv4/IPv6/Multi-->>Caller: bool
Caller->>IPv4/IPv6/Multi: isGloballyReachable()
IPv4/IPv6/Multi-->>Caller: bool
Note over IPv4/IPv6/Multi: Multi: embedded → IPv4::isGloballyReachable()<br/>non-embedded → IPv6::isGloballyReachable()
Reviews (2): Last reviewed commit: "feature: ✨ rename isPublicUse() to isGlo..." | Re-trigger Greptile |
|
|
||
| /** | ||
| * @test | ||
| * @dataProvider \Darsyn\IP\Tests\DataProvider\IPv4::getPublicUseIpAddresses() | ||
| * @dataProvider \Darsyn\IP\Tests\DataProvider\IPv4::getGloballyReachableIpAddresses() | ||
| */ | ||
| #[PHPUnit\Test] | ||
| #[PHPUnit\DataProviderExternal(IPv4DataProvider::class, 'getPublicUseIpAddresses')] | ||
| public function testIsPublicUse(string $value, bool $isPublicUse): void | ||
| #[PHPUnit\DataProviderExternal(IPv4DataProvider::class, 'getGloballyReachableIpAddresses')] | ||
| public function testIsGloballyReachable(string $value, bool $isGloballyReachable): void | ||
| { | ||
| $ip = IP::factory($value); | ||
| $this->assertSame($isPublicUse, $ip->isPublicUse()); | ||
| $this->assertSame($isGloballyReachable, $ip->isGloballyReachable()); | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
No test coverage for the deprecated
isPublicUse() alias
All three test classes (IPv4Test, IPv6Test, MultiTest) had their testIsPublicUse methods renamed to testIsGloballyReachable, which now only exercises the new method. The deprecated isPublicUse() delegate is completely untested — a future refactor that accidentally breaks the delegation (e.g., returning a hardcoded value) would go undetected. A minimal parameterised test that calls isPublicUse() and asserts it matches isGloballyReachable() would guard the alias.
Conform to official wording from the IANA special-purpose address registries; "Public Use" does not appear in them. Keep isPublicUse() as a deprecated alias.
4eda87d to
a194240
Compare
Conform to official wording from the IANA special-purpose address registries; Public Use does not appear in them. Keep
isPublicUse()as a deprecated alias.