Skip to content

Commit 3f35e3f

Browse files
Merge pull request #13 from jkowalleck/php-cs-fixer3_risky
applied php-cs-fixer "@symfony:risky"
2 parents 211c341 + 83a51d4 commit 3f35e3f

File tree

10 files changed

+32
-16
lines changed

10 files changed

+32
-16
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
->setRules([
4444
'@PHP73Migration' => true,
4545
'@Symfony' => true,
46+
'@Symfony:risky' => true,
4647
'declare_strict_types' => true,
4748
'phpdoc_order' => true,
4849
'header_comment' => ['header' => $header],

HISTORY.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changes
22

3+
## 1.0.2
4+
5+
Maintenance release:
6+
* Misc
7+
* Applied QA tool `php-cs-fixer` rule `@Symfony:risky`.
8+
9+
## 1.0.1
10+
11+
Maintenance release:
12+
* Docs
13+
* Upgraded install instructions in the `README.md`.
14+
* Misc
15+
* Upgraded the internally used QA tools in development processes,
16+
Update `php-cs-fixer` to v3.
17+
318
## 1.0.0
419

520
* First implementation

src/BuildParseTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private function isNotEmpty(string $data): bool
5151
*/
5252
private function isUsefulSubpathSegment(string $segment): bool
5353
{
54-
return false === in_array($segment, ['', '.', '..'], true);
54+
return false === \in_array($segment, ['', '.', '..'], true);
5555
}
5656

5757
/**
@@ -62,7 +62,7 @@ private function getNormalizerForNamespace(?string $type): Closure
6262
if (null !== $type) {
6363
$type = strtolower($type);
6464
}
65-
if (in_array($type, ['bitbucket', 'deb', 'github', 'golang', 'hex', 'rpm'], true)) {
65+
if (\in_array($type, ['bitbucket', 'deb', 'github', 'golang', 'hex', 'rpm'], true)) {
6666
return static function (string $data): string {
6767
return strtolower($data);
6868
};
@@ -92,7 +92,7 @@ private function normalizeNameForType(string $name, ?string $type): string
9292
$name = str_replace('_', '-', $name);
9393
}
9494

95-
if (in_array($type, ['bitbucket', 'deb', 'github', 'golang', 'hex', 'npm', 'pypi'], true)) {
95+
if (\in_array($type, ['bitbucket', 'deb', 'github', 'golang', 'hex', 'npm', 'pypi'], true)) {
9696
$name = strtolower($name);
9797
}
9898

src/PackageUrl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function getQualifiers(): ?array
186186
*/
187187
public function setQualifiers(?array $qualifiers): self
188188
{
189-
if ($qualifiers && array_key_exists(self::CHECKSUM_QUALIFIER, $qualifiers)) {
189+
if ($qualifiers && \array_key_exists(self::CHECKSUM_QUALIFIER, $qualifiers)) {
190190
throw new DomainException('Checksums must not be part of the qualifiers. Use setChecksums().');
191191
}
192192
$this->qualifiers = $qualifiers;

src/PackageUrlBuilder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function normalizeQualifiers(?array $data): ?string
168168

169169
$segments = [];
170170

171-
$data = array_change_key_case($data, CASE_LOWER);
171+
$data = array_change_key_case($data, \CASE_LOWER);
172172

173173
$checksum = $this->normalizeChecksum($data[PackageUrl::CHECKSUM_QUALIFIER] ?? null);
174174
unset($data[PackageUrl::CHECKSUM_QUALIFIER]);
@@ -190,7 +190,7 @@ public function normalizeQualifiers(?array $data): ?string
190190
$segments[] = PackageUrl::CHECKSUM_QUALIFIER.'='.$checksum;
191191
}
192192

193-
sort($segments, SORT_STRING);
193+
sort($segments, \SORT_STRING);
194194
$qualifiers = implode('&', $segments);
195195

196196
return '' === $qualifiers
@@ -207,9 +207,9 @@ private function normalizeChecksum($data): ?string
207207
if (null === $data) {
208208
return null;
209209
}
210-
if (is_string($data)) {
210+
if (\is_string($data)) {
211211
$data = explode(',', $data);
212-
} elseif (!is_array($data)) {
212+
} elseif (!\is_array($data)) {
213213
return null;
214214
}
215215

@@ -276,7 +276,7 @@ private function encode(string $data): string
276276
rawurlencode($data),
277277
self::RAWURLENCODE_REVERT
278278
);
279-
assert('' !== $encoded);
279+
\assert('' !== $encoded);
280280

281281
return $encoded;
282282
}

src/PackageUrlParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public function normalizeQualifiers(?string $data): array
233233
continue;
234234
}
235235
$key = strtolower(substr($dataKeyValue, 0, $eqPos));
236-
assert('' !== $key);
236+
\assert('' !== $key);
237237
$qualifiers[$key] = $value;
238238
}
239239

tests/PackageUrlBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class PackageUrlBuilderTest extends TestCase
4747
/** @var PackageUrlBuilder */
4848
private $sut;
4949

50-
public function setUp(): void
50+
protected function setUp(): void
5151
{
5252
$this->sut = new PackageUrlBuilder();
5353
}

tests/PackageUrlParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class PackageUrlParserTest extends TestCase
4545
/** @var PackageUrlParser */
4646
private $sut;
4747

48-
public function setUp(): void
48+
protected function setUp(): void
4949
{
5050
$this->sut = new PackageUrlParser();
5151
}

tests/PackageUrlTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class PackageUrlTest extends TestCase
4343
/** @var PackageUrl */
4444
private $sut;
4545

46-
public function setUp(): void
46+
protected function setUp(): void
4747
{
4848
$randomString = bin2hex(random_bytes(255));
4949
$this->sut = (new PackageUrl($randomString, $randomString))
@@ -282,7 +282,7 @@ public function testFromString(): void
282282
// act
283283
$purl = $this->sut::fromString($purlString, $parser);
284284
// assert
285-
self::assertInstanceOf(get_class($this->sut), $purl);
285+
self::assertInstanceOf(\get_class($this->sut), $purl);
286286
self::assertEquals($purlNormalized['type'], $purl->getType());
287287
self::assertEquals($purlNormalized['namespace'], $purl->getNamespace());
288288
self::assertEquals($purlNormalized['name'], $purl->getName());
@@ -311,7 +311,7 @@ private static function parsedToNulls(): array
311311
public function testAsString(): void
312312
{
313313
$expected = bin2hex(random_bytes(32));
314-
$sut = $this->createPartialMock(get_class($this->sut), ['toString']);
314+
$sut = $this->createPartialMock(\get_class($this->sut), ['toString']);
315315
$sut->expects(self::once())->method('toString')->willReturn($expected);
316316
$toString = (string) $sut;
317317
self::assertEquals($expected, $toString);

tests/_data/TestSuiteData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ abstract class TestSuiteData
6565
*/
6666
public static function data(): Generator
6767
{
68-
$testSuite = json_decode(file_get_contents(__DIR__.'/../_examples/test-suite-data.json'), true, 521, JSON_THROW_ON_ERROR);
68+
$testSuite = json_decode(file_get_contents(__DIR__.'/../_examples/test-suite-data.json'), true, 521, \JSON_THROW_ON_ERROR);
6969
foreach ($testSuite as $data) {
7070
yield $data['description'] => [$data];
7171
}

0 commit comments

Comments
 (0)