Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tools #403

Merged
merged 2 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
parameters:
ignoreErrors:
-
message: "#^Property Nucleos\\\\SetlistFm\\\\Builder\\\\ArtistSearchBuilder\\:\\:\\$query type has no value type specified in iterable type array\\.$#"
message: "#^Method Nucleos\\\\SetlistFm\\\\Builder\\\\ArtistSearchBuilder\\:\\:getQuery\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Builder/ArtistSearchBuilder.php

-
message: "#^Method Nucleos\\\\SetlistFm\\\\Builder\\\\ArtistSearchBuilder\\:\\:getQuery\\(\\) return type has no value type specified in iterable type array\\.$#"
message: "#^Property Nucleos\\\\SetlistFm\\\\Builder\\\\ArtistSearchBuilder\\:\\:\\$query type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Builder/ArtistSearchBuilder.php

-
message: "#^Property Nucleos\\\\SetlistFm\\\\Builder\\\\CitySearchBuilder\\:\\:\\$query type has no value type specified in iterable type array\\.$#"
message: "#^Method Nucleos\\\\SetlistFm\\\\Builder\\\\CitySearchBuilder\\:\\:getQuery\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Builder/CitySearchBuilder.php

-
message: "#^Method Nucleos\\\\SetlistFm\\\\Builder\\\\CitySearchBuilder\\:\\:getQuery\\(\\) return type has no value type specified in iterable type array\\.$#"
message: "#^Property Nucleos\\\\SetlistFm\\\\Builder\\\\CitySearchBuilder\\:\\:\\$query type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Builder/CitySearchBuilder.php

-
message: "#^Property Nucleos\\\\SetlistFm\\\\Builder\\\\SetlistSearchBuilder\\:\\:\\$query type has no value type specified in iterable type array\\.$#"
message: "#^Method Nucleos\\\\SetlistFm\\\\Builder\\\\SetlistSearchBuilder\\:\\:getQuery\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Builder/SetlistSearchBuilder.php

-
message: "#^Method Nucleos\\\\SetlistFm\\\\Builder\\\\SetlistSearchBuilder\\:\\:getQuery\\(\\) return type has no value type specified in iterable type array\\.$#"
message: "#^Property Nucleos\\\\SetlistFm\\\\Builder\\\\SetlistSearchBuilder\\:\\:\\$query type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Builder/SetlistSearchBuilder.php

-
message: "#^Property Nucleos\\\\SetlistFm\\\\Builder\\\\VenueSearchBuilder\\:\\:\\$query type has no value type specified in iterable type array\\.$#"
message: "#^Method Nucleos\\\\SetlistFm\\\\Builder\\\\VenueSearchBuilder\\:\\:getQuery\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Builder/VenueSearchBuilder.php

-
message: "#^Method Nucleos\\\\SetlistFm\\\\Builder\\\\VenueSearchBuilder\\:\\:getQuery\\(\\) return type has no value type specified in iterable type array\\.$#"
message: "#^Property Nucleos\\\\SetlistFm\\\\Builder\\\\VenueSearchBuilder\\:\\:\\$query type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Builder/VenueSearchBuilder.php

Expand All @@ -51,22 +51,22 @@ parameters:
path: src/Connection/ConnectionInterface.php

-
message: "#^Method Nucleos\\\\SetlistFm\\\\Connection\\\\PsrClientConnection\\:\\:call\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
message: "#^Method Nucleos\\\\SetlistFm\\\\Connection\\\\PsrClientConnection\\:\\:buildRequest\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
count: 1
path: src/Connection/PsrClientConnection.php

-
message: "#^Method Nucleos\\\\SetlistFm\\\\Connection\\\\PsrClientConnection\\:\\:call\\(\\) return type has no value type specified in iterable type array\\.$#"
message: "#^Method Nucleos\\\\SetlistFm\\\\Connection\\\\PsrClientConnection\\:\\:call\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
count: 1
path: src/Connection/PsrClientConnection.php

-
message: "#^Method Nucleos\\\\SetlistFm\\\\Connection\\\\PsrClientConnection\\:\\:parseResponse\\(\\) return type has no value type specified in iterable type array\\.$#"
message: "#^Method Nucleos\\\\SetlistFm\\\\Connection\\\\PsrClientConnection\\:\\:call\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Connection/PsrClientConnection.php

-
message: "#^Method Nucleos\\\\SetlistFm\\\\Connection\\\\PsrClientConnection\\:\\:buildRequest\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
message: "#^Method Nucleos\\\\SetlistFm\\\\Connection\\\\PsrClientConnection\\:\\:parseResponse\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Connection/PsrClientConnection.php

Expand Down Expand Up @@ -111,17 +111,17 @@ parameters:
path: src/Model/Set.php

-
message: "#^Method Nucleos\\\\SetlistFm\\\\Model\\\\Setlist\\:\\:fromApi\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
message: "#^Method Nucleos\\\\SetlistFm\\\\Model\\\\Setlist\\:\\:createSetsFromApi\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/Model/Setlist.php

-
message: "#^Method Nucleos\\\\SetlistFm\\\\Model\\\\Setlist\\:\\:createSetsFromApi\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
message: "#^Method Nucleos\\\\SetlistFm\\\\Model\\\\Setlist\\:\\:createSetsFromApi\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Model/Setlist.php

-
message: "#^Method Nucleos\\\\SetlistFm\\\\Model\\\\Setlist\\:\\:createSetsFromApi\\(\\) return type has no value type specified in iterable type array\\.$#"
message: "#^Method Nucleos\\\\SetlistFm\\\\Model\\\\Setlist\\:\\:fromApi\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/Model/Setlist.php

Expand Down
8 changes: 1 addition & 7 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.12.1@9b860214d58c48b5cbe99bdb17914d0eb723c9cd">
<file src="tests/bootstrap.php">
<UnresolvableInclude occurrences="1">
<code>require_once current($files)</code>
</UnresolvableInclude>
</file>
</files>
<files psalm-version="5.16.0@2897ba636551a8cb61601cc26f6ccfbba6c36591"/>
2 changes: 1 addition & 1 deletion src/Builder/ArtistSearchBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private function __construct()

public static function create(): self
{
return new static();
return new self();
}

public function page(int $page): self
Expand Down
2 changes: 1 addition & 1 deletion src/Builder/CitySearchBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private function __construct()

public static function create(): self
{
return new static();
return new self();
}

public function page(int $page): self
Expand Down
2 changes: 1 addition & 1 deletion src/Builder/SetlistSearchBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private function __construct()

public static function create(): self
{
return new static();
return new self();
}

public function page(int $page): self
Expand Down
2 changes: 1 addition & 1 deletion src/Builder/VenueSearchBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private function __construct()

public static function create(): self
{
return new static();
return new self();
}

public function page(int $page): self
Expand Down
3 changes: 0 additions & 3 deletions src/Connection/AbstractConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ abstract class AbstractConnection implements ConnectionInterface
*/
private $uri;

/**
* @param string $uri
*/
public function __construct(string $apikey, string $uri = null)
{
if (null === $uri) {
Expand Down
2 changes: 0 additions & 2 deletions src/Connection/PsrClientConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

/**
* Initialize client.
*
* @param string $uri
*/
public function __construct(ClientInterface $client, RequestFactoryInterface $requestFactory, string $apiKey, string $uri = null)
{
Expand All @@ -49,14 +47,14 @@
{
$request = $this->buildRequest($method, $params, $requestMethod);

try {

Check warning on line 50 in src/Connection/PsrClientConnection.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "CatchBlockRemoval": --- Original +++ New @@ @@ throw $e; } catch (Exception $e) { throw new ApiException('Technical error occurred.', 500, $e); - } catch (ClientExceptionInterface $e) { - throw new ApiException('Technical error occurred.', 500, $e); } } /**
$response = $this->client->sendRequest($request);

return $this->parseResponse($response);
} catch (ApiException|NotFoundException $e) {

Check warning on line 54 in src/Connection/PsrClientConnection.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "Catch_": --- Original +++ New @@ @@ try { $response = $this->client->sendRequest($request); return $this->parseResponse($response); - } catch (ApiException|NotFoundException $e) { + } catch (ApiException $e) { throw $e; } catch (Exception $e) { throw new ApiException('Technical error occurred.', 500, $e);
throw $e;
} catch (Exception $e) {
throw new ApiException('Technical error occurred.', 500, $e);

Check warning on line 57 in src/Connection/PsrClientConnection.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ } catch (ApiException|NotFoundException $e) { throw $e; } catch (Exception $e) { - throw new ApiException('Technical error occurred.', 500, $e); + throw new ApiException('Technical error occurred.', 499, $e); } catch (ClientExceptionInterface $e) { throw new ApiException('Technical error occurred.', 500, $e); }

Check warning on line 57 in src/Connection/PsrClientConnection.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ } catch (ApiException|NotFoundException $e) { throw $e; } catch (Exception $e) { - throw new ApiException('Technical error occurred.', 500, $e); + throw new ApiException('Technical error occurred.', 501, $e); } catch (ClientExceptionInterface $e) { throw new ApiException('Technical error occurred.', 500, $e); }
} catch (ClientExceptionInterface $e) {
throw new ApiException('Technical error occurred.', 500, $e);
}
Expand All @@ -75,15 +73,15 @@
throw new ApiException('Server did not reply with a valid response.', $response->getStatusCode());
}

if (404 === $response->getStatusCode()) {

Check warning on line 76 in src/Connection/PsrClientConnection.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ if (JSON_ERROR_NONE !== json_last_error()) { throw new ApiException('Server did not reply with a valid response.', $response->getStatusCode()); } - if (404 === $response->getStatusCode()) { + if (403 === $response->getStatusCode()) { throw new NotFoundException('Server did not find any entity for the request.'); } if ($response->getStatusCode() >= 400) {

Check warning on line 76 in src/Connection/PsrClientConnection.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ if (JSON_ERROR_NONE !== json_last_error()) { throw new ApiException('Server did not reply with a valid response.', $response->getStatusCode()); } - if (404 === $response->getStatusCode()) { + if (405 === $response->getStatusCode()) { throw new NotFoundException('Server did not find any entity for the request.'); } if ($response->getStatusCode() >= 400) {
throw new NotFoundException('Server did not find any entity for the request.');
}

if ($response->getStatusCode() >= 400) {

Check warning on line 80 in src/Connection/PsrClientConnection.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "GreaterThanOrEqualTo": --- Original +++ New @@ @@ if (404 === $response->getStatusCode()) { throw new NotFoundException('Server did not find any entity for the request.'); } - if ($response->getStatusCode() >= 400) { + if ($response->getStatusCode() > 400) { throw new ApiException('Technical error occurred.', $response->getStatusCode()); } return $array;
throw new ApiException('Technical error occurred.', $response->getStatusCode());
}

return $array;

Check warning on line 84 in src/Connection/PsrClientConnection.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "ArrayOneItem": --- Original +++ New @@ @@ if ($response->getStatusCode() >= 400) { throw new ApiException('Technical error occurred.', $response->getStatusCode()); } - return $array; + return count($array) > 1 ? array_slice($array, 0, 1, true) : $array; } private function buildRequest(string $method, array $params, string $requestMethod) : RequestInterface {
}

private function buildRequest(string $method, array $params, string $requestMethod): RequestInterface
Expand Down
4 changes: 1 addition & 3 deletions src/Exception/NotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@

use Exception;

final class NotFoundException extends Exception
{
}
final class NotFoundException extends Exception {}
16 changes: 8 additions & 8 deletions tests/Builder/ArtistSearchBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testCreate(): void
$expected = [
'p' => 1,
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testWithTmbid(): void
Expand All @@ -37,7 +37,7 @@ public function testWithTmbid(): void
'p' => 1,
'artistTmid' => 123,
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testWithMbid(): void
Expand All @@ -50,7 +50,7 @@ public function testWithMbid(): void
'p' => 1,
'artistMbid' => 'a466c2a2-6517-42fb-a160-1087c3bafd9f',
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testWithName(): void
Expand All @@ -63,7 +63,7 @@ public function testWithName(): void
'p' => 1,
'artistName' => 'FooBar',
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testWithNameOverride(): void
Expand All @@ -77,7 +77,7 @@ public function testWithNameOverride(): void
'p' => 1,
'artistName' => 'BarBaz',
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testSortByRelevance(): void
Expand All @@ -90,7 +90,7 @@ public function testSortByRelevance(): void
'p' => 1,
'sort' => 'relevance',
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testSortWithInvalidType(): void
Expand All @@ -113,7 +113,7 @@ public function testSortByName(): void
'p' => 1,
'sort' => 'sortName',
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testPage(): void
Expand All @@ -125,6 +125,6 @@ public function testPage(): void
$expected = [
'p' => 42,
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}
}
12 changes: 6 additions & 6 deletions tests/Builder/CitySearchBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testCreate(): void
$expected = [
'p' => 1,
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testWithState(): void
Expand All @@ -36,7 +36,7 @@ public function testWithState(): void
'p' => 1,
'state' => 'Lower Saxony',
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testWithName(): void
Expand All @@ -49,7 +49,7 @@ public function testWithName(): void
'p' => 1,
'name' => 'Hamburg',
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testWithCountry(): void
Expand All @@ -62,7 +62,7 @@ public function testWithCountry(): void
'p' => 1,
'country' => 'DE',
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testWithStateCode(): void
Expand All @@ -75,7 +75,7 @@ public function testWithStateCode(): void
'p' => 1,
'stateCode' => 'NY',
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}

public function testPage(): void
Expand All @@ -87,6 +87,6 @@ public function testPage(): void
$expected = [
'p' => 42,
];
static::assertSame($expected, $builder->getQuery());
self::assertSame($expected, $builder->getQuery());
}
}
Loading
Loading