Skip to content

Commit 6497cd7

Browse files
Merge pull request #3 from phpviet/analysis-XlOVnQ
Apply fixes from StyleCI
2 parents 4f917ed + 967511f commit 6497cd7

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/Rules/IpVN.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
namespace PHPViet\Validation\Rules;
1010

11-
use IPLib\Address\AddressInterface as IpInterface;
12-
use IPLib\Address\Type as IpType;
1311
use IPLib\Factory as IpFactory;
14-
use Respect\Validation\Exceptions\ComponentException;
12+
use IPLib\Address\Type as IpType;
1513
use Respect\Validation\Rules\AbstractRule;
14+
use IPLib\Address\AddressInterface as IpInterface;
15+
use Respect\Validation\Exceptions\ComponentException;
1616

1717
/**
1818
* @author Vuong Minh <[email protected]>
@@ -28,7 +28,7 @@ class IpVN extends AbstractRule
2828

2929
public function __construct(?int $version = null)
3030
{
31-
if (null !== $version && !$this->isSupportedVersion($version)) {
31+
if (null !== $version && ! $this->isSupportedVersion($version)) {
3232
throw new ComponentException(sprintf('Only versions %d, %d are supported: %d given', self::IPV4, self::IPV6, $version));
3333
}
3434

@@ -37,15 +37,15 @@ public function __construct(?int $version = null)
3737

3838
public function validate($input): bool
3939
{
40-
if (!$ip = IpFactory::addressFromString($input)) {
40+
if (! $ip = IpFactory::addressFromString($input)) {
4141
return false;
4242
}
4343

4444
if (($version = $ip->getAddressType()) !== $this->version && null !== $this->version) {
4545
return false;
4646
}
4747

48-
if (!$ranges = $this->getIpRanges($input, $version)) {
48+
if (! $ranges = $this->getIpRanges($input, $version)) {
4949
return false;
5050
}
5151

@@ -62,7 +62,7 @@ protected function getIpRanges(string $ip, int $version): ?array
6262
$map = static::getIpV6Range();
6363
}
6464

65-
while (!is_null($key = array_shift($keys))) {
65+
while (! is_null($key = array_shift($keys))) {
6666
if (isset($map[$key])) {
6767
$map = $map[$key];
6868

@@ -93,7 +93,7 @@ protected static function getIpV4Range(): array
9393
static $range = null;
9494

9595
if (null === $range) {
96-
$range = require __DIR__ . '/../../resources/ip-v4-range.php';
96+
$range = require __DIR__.'/../../resources/ip-v4-range.php';
9797
}
9898

9999
return $range;
@@ -104,7 +104,7 @@ protected static function getIpV6Range(): array
104104
static $range = null;
105105

106106
if (null === $range) {
107-
$range = require __DIR__ . '/../../resources/ip-v6-range.php';
107+
$range = require __DIR__.'/../../resources/ip-v6-range.php';
108108
}
109109

110110
return $range;

src/Validator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Validator extends BaseValidator
2727
*/
2828
protected static function getFactory()
2929
{
30-
if (!static::$factory instanceof Factory) {
30+
if (! static::$factory instanceof Factory) {
3131
$factory = static::$factory = new Factory();
3232
$factory->prependRulePrefix('\\PHPViet\\Validation\\Rules\\');
3333
}

tests/ValidatorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
namespace PHPViet\Validation\Tests;
1010

1111
use PHPUnit\Framework\TestCase;
12-
use PHPViet\Validation\Validator;
1312
use Respect\Validation\Factory;
13+
use PHPViet\Validation\Validator;
1414

1515
/**
1616
* @author Vuong Minh <[email protected]>

0 commit comments

Comments
 (0)