Skip to content

Commit

Permalink
Improve and simplify codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Aug 10, 2023
1 parent 7a7fea9 commit 0b5f360
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions IPv4/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ final class Converter
'/^(?<number>\d+)$/' => 10,
];

private readonly mixed $maxIpv4Number;
private readonly mixed $maxIPv4Number;

public function __construct(
private readonly Calculator $calculator
) {
$this->maxIpv4Number = $calculator->sub($calculator->pow(2, 32), 1);
$this->maxIPv4Number = $calculator->sub($calculator->pow(2, 32), 1);
}

/**
Expand Down Expand Up @@ -170,7 +170,7 @@ public function toDecimal(Stringable|string|null $host): ?string
*
* @see https://url.spec.whatwg.org/#ipv4-number-parser
*
* @return mixed Returns null if it can not correctly convert the label
* @return mixed returns null if it can not correctly convert the label
*/
private function labelToNumber(string $label): mixed
{
Expand All @@ -185,7 +185,7 @@ private function labelToNumber(string $label): mixed
}

$number = $this->calculator->baseConvert($number, $base);
if (0 <= $this->calculator->compare($number, 0) && 0 >= $this->calculator->compare($number, $this->maxIpv4Number)) {
if (0 <= $this->calculator->compare($number, 0) && 0 >= $this->calculator->compare($number, $this->maxIPv4Number)) {
return $number;
}
}
Expand Down
2 changes: 1 addition & 1 deletion UriString.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
* @author Ignace Nyamagana Butera <[email protected]>
* @since 6.0.0
*
* @phpstan-type AuthorityMap array{user:?string, pass:?string, host:?string, port:?int}
* @phpstan-type ComponentMap array{scheme:?string, user:?string, pass:?string, host:?string, port:?int, path:string, query:?string, fragment:?string}
* @phpstan-type InputComponentMap array{scheme? : ?string, user? : ?string, pass? : ?string, host? : ?string, port? : ?int, path? : ?string, query? : ?string, fragment? : ?string}
* @phpstan-type AuthorityMap array{user:?string, pass:?string, host:?string, port:?int}
*/
final class UriString
{
Expand Down

0 comments on commit 0b5f360

Please sign in to comment.