Skip to content

Commit 20f9f4a

Browse files
committed
Update PHP CS Fixer settings
1 parent 410b218 commit 20f9f4a

12 files changed

+54
-52
lines changed

.php_cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ return PhpCsFixer\Config::create()
3333
'no_empty_comment' => true,
3434
'no_leading_import_slash' => true,
3535
'no_trailing_comma_in_singleline_array' => true,
36+
'no_trailing_whitespace' => true,
37+
'no_whitespace_in_blank_line' => true,
3638
'no_unused_imports' => true,
3739
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
3840
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],

src/Domain.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,22 @@ final class Domain implements DomainInterface, JsonSerializable
8383
* @var string|null
8484
*/
8585
private $subDomain;
86-
86+
8787
/**
8888
* @var int
8989
*/
9090
private $asciiIDNAOption = IDNA_DEFAULT;
91-
91+
9292
/**
9393
* @var int
9494
*/
9595
private $unicodeIDNAOption = IDNA_DEFAULT;
96-
96+
9797
/**
9898
* @var bool
9999
*/
100100
private $isTransitionalDifferent;
101-
101+
102102
/**
103103
* New instance.
104104
* @param null|mixed $domain
@@ -126,7 +126,7 @@ public function __construct(
126126
$this->registrableDomain = $this->setRegistrableDomain();
127127
$this->subDomain = $this->setSubDomain();
128128
}
129-
129+
130130
/**
131131
* {@inheritdoc}
132132
*/
@@ -139,7 +139,7 @@ public static function __set_state(array $properties): self
139139
$properties['unicodeIDNAOption'] ?? IDNA_DEFAULT
140140
);
141141
}
142-
142+
143143
/**
144144
* Sets the public suffix domain part.
145145
*
@@ -349,7 +349,7 @@ public function getAsciiIDNAOption(): int
349349
{
350350
return $this->asciiIDNAOption;
351351
}
352-
352+
353353
/**
354354
* Gets conversion options for idn_to_utf8.
355355
*
@@ -363,7 +363,7 @@ public function getUnicodeIDNAOption(): int
363363
{
364364
return $this->unicodeIDNAOption;
365365
}
366-
366+
367367
/**
368368
* Returns true if domain contains deviation characters.
369369
*

src/IDNAConverterTrait.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,22 +136,22 @@ private function transformToAscii(string $domain, int $option): array
136136
if (1 !== preg_match($pattern, $domain)) {
137137
return [strtolower($domain), ['isTransitionalDifferent' => false]];
138138
}
139-
139+
140140
$output = idn_to_ascii($domain, $option, INTL_IDNA_VARIANT_UTS46, $infos);
141141
if (0 !== $infos['errors']) {
142142
throw new InvalidDomain(sprintf('The host `%s` is invalid : %s', $domain, self::getIdnErrors($infos['errors'])));
143143
}
144-
144+
145145
// @codeCoverageIgnoreStart
146146
if (false === $output) {
147147
throw new UnexpectedValueException(sprintf('The Intl extension is misconfigured for %s, please correct this issue before proceeding.', PHP_OS));
148148
}
149149
// @codeCoverageIgnoreEnd
150-
150+
151151
if (false === strpos($output, '%')) {
152152
return [$output, $infos];
153153
}
154-
154+
155155
throw new InvalidDomain(sprintf('The host `%s` is invalid: it contains invalid characters', $domain));
156156
}
157157
/**
@@ -272,7 +272,7 @@ private function parse($domain = null, int $asciiOption = 0, int $unicodeOption
272272
if (1 !== preg_match($pattern, $formatted_domain)) {
273273
throw new InvalidDomain(sprintf('The domain `%s` is invalid: the labels are malformed', $domain));
274274
}
275-
275+
276276
list($ascii_domain, $infos) = $this->transformToAscii($domain, $asciiOption);
277277
$infos['labels'] = array_reverse(explode('.', $this->idnToUnicode($ascii_domain, $unicodeOption)));
278278

src/Manager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ public function getTLDs(
166166
if (null === $data && !$this->refreshTLDs($url, $ttl)) {
167167
throw new CouldNotLoadTLDs(sprintf('Unable to load the root zone database from %s', $url));
168168
}
169-
169+
170170
$data = json_decode($data ?? $this->cache->get($key), true);
171171
if (JSON_ERROR_NONE !== json_last_error()) {
172172
throw new CouldNotLoadTLDs(
173173
sprintf('The root zone database cache is corrupted: %s', json_last_error_msg()),
174174
json_last_error()
175175
);
176176
}
177-
177+
178178
if (!isset($data['records'], $data['version'], $data['modifiedDate'])) {
179179
throw new CouldNotLoadTLDs('The root zone database cache content is corrupted');
180180
}

src/PublicSuffix.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ final class PublicSuffix implements DomainInterface, JsonSerializable, PublicSuf
6363
* @var string[]
6464
*/
6565
private $labels;
66-
66+
6767
/**
6868
* @var int
6969
*/
7070
private $asciiIDNAOption = IDNA_DEFAULT;
71-
71+
7272
/**
7373
* @var int
7474
*/
7575
private $unicodeIDNAOption = IDNA_DEFAULT;
76-
76+
7777
/**
7878
* @var bool
7979
*/
@@ -129,7 +129,7 @@ public static function createFromDomain(Domain $domain): self
129129
} elseif ($domain->isPrivate()) {
130130
$section = self::PRIVATE_DOMAINS;
131131
}
132-
132+
133133
return new self(
134134
$domain->getPublicSuffix(),
135135
$section,
@@ -277,7 +277,7 @@ public function getAsciiIDNAOption(): int
277277
{
278278
return $this->asciiIDNAOption;
279279
}
280-
280+
281281
/**
282282
* Gets conversion options for idn_to_utf8.
283283
*
@@ -291,7 +291,7 @@ public function getUnicodeIDNAOption(): int
291291
{
292292
return $this->unicodeIDNAOption;
293293
}
294-
294+
295295
/**
296296
* Returns true if domain contains deviation characters.
297297
*

src/Rules.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ final class Rules implements PublicSuffixListSection
5151
* @var array
5252
*/
5353
private $rules;
54-
54+
5555
/**
5656
* @var int
5757
*/
5858
private $asciiIDNAOption;
59-
59+
6060
/**
6161
* @var int
6262
*/
@@ -78,7 +78,7 @@ public function __construct(
7878
$this->asciiIDNAOption = $asciiIDNAOption;
7979
$this->unicodeIDNAOption = $unicodeIDNAOption;
8080
}
81-
81+
8282
/**
8383
* Returns a new instance from a file path.
8484
*
@@ -158,7 +158,7 @@ public function getAsciiIDNAOption(): int
158158
{
159159
return $this->asciiIDNAOption;
160160
}
161-
161+
162162
/**
163163
* Gets conversion options for idn_to_utf8.
164164
*
@@ -172,7 +172,7 @@ public function getUnicodeIDNAOption(): int
172172
{
173173
return $this->unicodeIDNAOption;
174174
}
175-
175+
176176
/**
177177
* Determines the public suffix for a given domain.
178178
*
@@ -189,7 +189,7 @@ public function getPublicSuffix($domain, string $section = self::ALL_DOMAINS): P
189189
if (!$domain instanceof Domain) {
190190
$domain = new Domain($domain, null, $this->asciiIDNAOption, $this->unicodeIDNAOption);
191191
}
192-
192+
193193
if (!$domain->isResolvable()) {
194194
throw new CouldNotResolvePublicSuffix(sprintf('The domain `%s` can not contain a public suffix', $domain->getContent()));
195195
}
@@ -215,7 +215,7 @@ public function resolve($domain, string $section = self::ALL_DOMAINS): Domain
215215
if (!$domain->isResolvable()) {
216216
return $domain;
217217
}
218-
218+
219219
return $domain->resolve($this->findPublicSuffix($domain, $section));
220220
} catch (Exception $e) {
221221
return new Domain(null, null, $this->asciiIDNAOption, $this->unicodeIDNAOption);

src/TLDConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ final class TLDConverter
3737
* @internal
3838
*/
3939
const IANA_DATE_FORMAT = 'D M d H:i:s Y e';
40-
40+
4141
/**
4242
* Converts the IANA Root Zone Database into a TopLevelDomains associative array.
4343
*

src/TopLevelDomains.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ final class TopLevelDomains implements Countable, IteratorAggregate
4949
* @var array
5050
*/
5151
private $records;
52-
52+
5353
/**
5454
* @var int
5555
*/
5656
private $asciiIDNAOption;
57-
57+
5858
/**
5959
* @var int
6060
*/
6161
private $unicodeIDNAOption;
62-
62+
6363
/**
6464
* New instance.
6565
* @param array $records
@@ -104,17 +104,17 @@ public static function createFromPath(
104104
if (null !== $context) {
105105
$args[] = $context;
106106
}
107-
107+
108108
if (!($resource = @fopen(...$args))) {
109109
throw new CouldNotLoadTLDs(sprintf('`%s`: failed to open stream: No such file or directory', $path));
110110
}
111-
111+
112112
$content = stream_get_contents($resource);
113113
fclose($resource);
114-
114+
115115
return self::createFromString($content, $asciiIDNAOption, $unicodeIDNAOption);
116116
}
117-
117+
118118
/**
119119
* Returns a new instance from a string.
120120
*
@@ -191,7 +191,7 @@ public function getAsciiIDNAOption(): int
191191
{
192192
return $this->asciiIDNAOption;
193193
}
194-
194+
195195
/**
196196
* Gets conversion options for idn_to_utf8.
197197
*
@@ -205,7 +205,7 @@ public function getUnicodeIDNAOption(): int
205205
{
206206
return $this->unicodeIDNAOption;
207207
}
208-
208+
209209
/**
210210
* {@inheritdoc}
211211
*/

tests/DomainTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ public function testWithSubDomainFailsWithOneLabelDomain()
576576
self::expectException(CouldNotResolveSubDomain::class);
577577
(new Domain('localhost'))->withSubDomain('www');
578578
}
579-
579+
580580
/**
581581
* @covers ::withSubDomain
582582
* @covers ::normalizeContent
@@ -1014,7 +1014,7 @@ public function testwithoutLabelWorksWithMultipleKeys()
10141014
{
10151015
self::assertNull((new Domain('www.example.com'))->withoutLabel(0, 1, 2)->getContent());
10161016
}
1017-
1017+
10181018
/**
10191019
* @covers ::__construct
10201020
*/
@@ -1026,7 +1026,7 @@ public function testConstructWithCustomIDNAOptions()
10261026
[$domain->getAsciiIDNAOption(), $domain->getUnicodeIDNAOption()]
10271027
);
10281028
}
1029-
1029+
10301030
/**
10311031
* @dataProvider resolveCustomIDNAOptionsProvider
10321032
* @param string $domainName
@@ -1063,7 +1063,7 @@ public function testResolveWorksWithCustomIDNAOptions(
10631063
self::assertSame($expectedSubDomain, $domain->getSubDomain());
10641064
self::assertSame($expectedWithLabel, $domain->withLabel(-1, $withLabel)->getContent());
10651065
}
1066-
1066+
10671067
public function resolveCustomIDNAOptionsProvider()
10681068
{
10691069
return [
@@ -1113,7 +1113,7 @@ public function resolveCustomIDNAOptionsProvider()
11131113
],
11141114
];
11151115
}
1116-
1116+
11171117
public function testInstanceCreationWithCustomIDNAOptions()
11181118
{
11191119
$domain = new Domain(
@@ -1122,7 +1122,7 @@ public function testInstanceCreationWithCustomIDNAOptions()
11221122
IDNA_NONTRANSITIONAL_TO_ASCII,
11231123
IDNA_NONTRANSITIONAL_TO_UNICODE
11241124
);
1125-
1125+
11261126
$instance = $domain->toAscii();
11271127
self::assertSame(
11281128
[$domain->getAsciiIDNAOption(), $domain->getUnicodeIDNAOption()],
@@ -1169,7 +1169,7 @@ public function testInstanceCreationWithCustomIDNAOptions()
11691169
[$instance->getAsciiIDNAOption(), $instance->getUnicodeIDNAOption()]
11701170
);
11711171
}
1172-
1172+
11731173
/**
11741174
* @covers ::isTransitionalDifferent
11751175
* @dataProvider transitionalProvider
@@ -1180,7 +1180,7 @@ public function testIsTransitionalDifference(Domain $domain, bool $expected)
11801180
{
11811181
self::assertSame($expected, $domain->isTransitionalDifferent());
11821182
}
1183-
1183+
11841184
public function transitionalProvider()
11851185
{
11861186
return [

0 commit comments

Comments
 (0)