From 2e48d9fdc11e92f8a9d30a437e1f12e613cf197f Mon Sep 17 00:00:00 2001 From: core23 Date: Sun, 3 Dec 2023 15:20:59 +0100 Subject: [PATCH] Fix CS --- phpstan-baseline.neon | 30 +++++++-------- psalm-baseline.xml | 8 +--- src/Builder/ArtistSearchBuilder.php | 2 +- src/Builder/CitySearchBuilder.php | 2 +- src/Builder/SetlistSearchBuilder.php | 2 +- src/Builder/VenueSearchBuilder.php | 2 +- src/Connection/AbstractConnection.php | 3 -- src/Connection/PsrClientConnection.php | 2 - src/Exception/NotFoundException.php | 4 +- tests/Builder/ArtistSearchBuilderTest.php | 16 ++++---- tests/Builder/CitySearchBuilderTest.php | 12 +++--- tests/Builder/SetlistSearchBuilderTest.php | 32 ++++++++-------- tests/Builder/VenueSearchBuilderTest.php | 16 ++++---- tests/Connection/PsrClientConnectionTest.php | 18 ++++----- tests/Exception/ApiExceptionTest.php | 2 +- tests/Fixtures/ClientException.php | 4 +- tests/Model/ArtistTest.php | 12 +++--- tests/Model/CityTest.php | 12 +++--- tests/Model/CountryTest.php | 4 +- tests/Model/GeoTest.php | 4 +- tests/Model/SetTest.php | 6 +-- tests/Model/SetlistTest.php | 40 ++++++++++---------- tests/Model/SongTest.php | 10 ++--- tests/Model/TourTest.php | 2 +- tests/Model/UserTest.php | 10 ++--- tests/Model/VenueTest.php | 8 ++-- tests/Service/ArtistServiceTest.php | 4 +- tests/Service/CityServiceTest.php | 4 +- tests/Service/CountryServiceTest.php | 2 +- tests/Service/SetlistServiceTest.php | 10 ++--- tests/Service/UserServiceTest.php | 6 +-- tests/Service/VenueServiceTest.php | 4 +- 32 files changed, 139 insertions(+), 154 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 289bc05..98a601a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -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 @@ -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 @@ -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 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 1da23fa..ecbd3ec 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,8 +1,2 @@ - - - - require_once current($files) - - - + diff --git a/src/Builder/ArtistSearchBuilder.php b/src/Builder/ArtistSearchBuilder.php index 7a76a1b..a21fa75 100644 --- a/src/Builder/ArtistSearchBuilder.php +++ b/src/Builder/ArtistSearchBuilder.php @@ -29,7 +29,7 @@ private function __construct() public static function create(): self { - return new static(); + return new self(); } public function page(int $page): self diff --git a/src/Builder/CitySearchBuilder.php b/src/Builder/CitySearchBuilder.php index 5851d69..32bb1a3 100644 --- a/src/Builder/CitySearchBuilder.php +++ b/src/Builder/CitySearchBuilder.php @@ -27,7 +27,7 @@ private function __construct() public static function create(): self { - return new static(); + return new self(); } public function page(int $page): self diff --git a/src/Builder/SetlistSearchBuilder.php b/src/Builder/SetlistSearchBuilder.php index 2daecef..ea0a5fa 100644 --- a/src/Builder/SetlistSearchBuilder.php +++ b/src/Builder/SetlistSearchBuilder.php @@ -29,7 +29,7 @@ private function __construct() public static function create(): self { - return new static(); + return new self(); } public function page(int $page): self diff --git a/src/Builder/VenueSearchBuilder.php b/src/Builder/VenueSearchBuilder.php index 35aa8dc..d19dbee 100644 --- a/src/Builder/VenueSearchBuilder.php +++ b/src/Builder/VenueSearchBuilder.php @@ -27,7 +27,7 @@ private function __construct() public static function create(): self { - return new static(); + return new self(); } public function page(int $page): self diff --git a/src/Connection/AbstractConnection.php b/src/Connection/AbstractConnection.php index 798e154..e589d3b 100644 --- a/src/Connection/AbstractConnection.php +++ b/src/Connection/AbstractConnection.php @@ -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) { diff --git a/src/Connection/PsrClientConnection.php b/src/Connection/PsrClientConnection.php index 84a058a..41e973f 100644 --- a/src/Connection/PsrClientConnection.php +++ b/src/Connection/PsrClientConnection.php @@ -34,8 +34,6 @@ final class PsrClientConnection extends AbstractConnection /** * Initialize client. - * - * @param string $uri */ public function __construct(ClientInterface $client, RequestFactoryInterface $requestFactory, string $apiKey, string $uri = null) { diff --git a/src/Exception/NotFoundException.php b/src/Exception/NotFoundException.php index 7bc902c..8eb1160 100644 --- a/src/Exception/NotFoundException.php +++ b/src/Exception/NotFoundException.php @@ -13,6 +13,4 @@ use Exception; -final class NotFoundException extends Exception -{ -} +final class NotFoundException extends Exception {} diff --git a/tests/Builder/ArtistSearchBuilderTest.php b/tests/Builder/ArtistSearchBuilderTest.php index 0effb73..41dfff5 100644 --- a/tests/Builder/ArtistSearchBuilderTest.php +++ b/tests/Builder/ArtistSearchBuilderTest.php @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -125,6 +125,6 @@ public function testPage(): void $expected = [ 'p' => 42, ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } } diff --git a/tests/Builder/CitySearchBuilderTest.php b/tests/Builder/CitySearchBuilderTest.php index 1d50404..9bf5ff4 100644 --- a/tests/Builder/CitySearchBuilderTest.php +++ b/tests/Builder/CitySearchBuilderTest.php @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -87,6 +87,6 @@ public function testPage(): void $expected = [ 'p' => 42, ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } } diff --git a/tests/Builder/SetlistSearchBuilderTest.php b/tests/Builder/SetlistSearchBuilderTest.php index a7506cf..57a956b 100644 --- a/tests/Builder/SetlistSearchBuilderTest.php +++ b/tests/Builder/SetlistSearchBuilderTest.php @@ -32,7 +32,7 @@ public function testCreate(): void $expected = [ 'p' => 1, ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithVenueName(): void @@ -45,7 +45,7 @@ public function testWithVenueName(): void 'p' => 1, 'venueName' => 'Live in New York', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithVenueId(): void @@ -58,7 +58,7 @@ public function testWithVenueId(): void 'p' => 1, 'venueId' => '13', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithLastUpdated(): void @@ -71,7 +71,7 @@ public function testWithLastUpdated(): void 'p' => 1, 'lastUpdated' => '20161012231200', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithDate(): void @@ -84,7 +84,7 @@ public function testWithDate(): void 'p' => 1, 'date' => '12-10-2016', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithYear(): void @@ -97,7 +97,7 @@ public function testWithYear(): void 'p' => 1, 'year' => 2018, ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithTourName(): void @@ -110,7 +110,7 @@ public function testWithTourName(): void 'p' => 1, 'tourName' => 'My Tour', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithArtistName(): void @@ -123,7 +123,7 @@ public function testWithArtistName(): void 'p' => 1, 'artistName' => 'Slipknot', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithArtistMbid(): void @@ -136,7 +136,7 @@ public function testWithArtistMbid(): void 'p' => 1, 'artistMbid' => 'a466c2a2-6517-42fb-a160-1087c3bafd9f', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithArtistTmbid(): void @@ -149,7 +149,7 @@ public function testWithArtistTmbid(): void 'p' => 1, 'artistTmbid' => 15515, ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithCity(): void @@ -162,7 +162,7 @@ public function testWithCity(): void 'p' => 1, 'cityName' => 'Hamburg', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithCityId(): void @@ -175,7 +175,7 @@ public function testWithCityId(): void 'p' => 1, 'cityId' => 15, ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithCountryCode(): void @@ -188,7 +188,7 @@ public function testWithCountryCode(): void 'p' => 1, 'countryCode' => 'DE', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithStateCode(): void @@ -201,7 +201,7 @@ public function testWithStateCode(): void 'p' => 1, 'stateCode' => 'NY', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithState(): void @@ -214,7 +214,7 @@ public function testWithState(): void 'p' => 1, 'state' => 'Lower Saxony', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testPage(): void @@ -226,6 +226,6 @@ public function testPage(): void $expected = [ 'p' => 42, ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } } diff --git a/tests/Builder/VenueSearchBuilderTest.php b/tests/Builder/VenueSearchBuilderTest.php index 4fc80ac..128b92d 100644 --- a/tests/Builder/VenueSearchBuilderTest.php +++ b/tests/Builder/VenueSearchBuilderTest.php @@ -23,7 +23,7 @@ public function testCreate(): void $expected = [ 'p' => 1, ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithCityId(): void @@ -36,7 +36,7 @@ public function testWithCityId(): void 'p' => 1, 'cityId' => 15, ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithName(): void @@ -49,7 +49,7 @@ public function testWithName(): void 'p' => 1, 'name' => 'Foo', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithCountry(): void @@ -62,7 +62,7 @@ public function testWithCountry(): void 'p' => 1, 'country' => 'DE', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithCity(): void @@ -75,7 +75,7 @@ public function testWithCity(): void 'p' => 1, 'cityName' => 'New York', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithStateCode(): void @@ -88,7 +88,7 @@ public function testWithStateCode(): void 'p' => 1, 'stateCode' => 'NY', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testWithState(): void @@ -101,7 +101,7 @@ public function testWithState(): void 'p' => 1, 'state' => 'Lower Saxony', ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } public function testPage(): void @@ -113,6 +113,6 @@ public function testPage(): void $expected = [ 'p' => 42, ]; - static::assertSame($expected, $builder->getQuery()); + self::assertSame($expected, $builder->getQuery()); } } diff --git a/tests/Connection/PsrClientConnectionTest.php b/tests/Connection/PsrClientConnectionTest.php index ec95c6e..60c4a90 100644 --- a/tests/Connection/PsrClientConnectionTest.php +++ b/tests/Connection/PsrClientConnectionTest.php @@ -48,7 +48,7 @@ public function testSend(): void $client = new PsrClientConnection($this->client, $this->requestFactory, 'my-key', 'http://api.url/'); $request = $this->createMock(RequestInterface::class); - $request->expects($matcher = static::exactly(2))->method('withHeader') + $request->expects($matcher = self::exactly(2))->method('withHeader') ->willReturnCallback($this->withParameter($matcher, [ ['Accept', 'application/json'], ['x-api-key', 'my-key'], @@ -66,7 +66,7 @@ public function testSend(): void ->willReturn($response) ; - static::assertSame(['data' => 'test'], $client->call('method', ['foo' => 'bar'])); + self::assertSame(['data' => 'test'], $client->call('method', ['foo' => 'bar'])); } public function testSendWithBooleanParameter(): void @@ -74,7 +74,7 @@ public function testSendWithBooleanParameter(): void $client = new PsrClientConnection($this->client, $this->requestFactory, 'my-key', 'http://api.url/'); $request = $this->createMock(RequestInterface::class); - $request->expects($matcher = static::exactly(2))->method('withHeader') + $request->expects($matcher = self::exactly(2))->method('withHeader') ->willReturnCallback($this->withParameter($matcher, [ ['Accept', 'application/json'], ['x-api-key', 'my-key'], @@ -92,7 +92,7 @@ public function testSendWithBooleanParameter(): void ->willReturn($response) ; - static::assertSame(['data' => 'test'], $client->call('method', ['active' => true, 'inactive' => false])); + self::assertSame(['data' => 'test'], $client->call('method', ['active' => true, 'inactive' => false])); } public function testSendWithArrayParameter(): void @@ -100,7 +100,7 @@ public function testSendWithArrayParameter(): void $client = new PsrClientConnection($this->client, $this->requestFactory, 'my-key', 'http://api.url/'); $request = $this->createMock(RequestInterface::class); - $request->expects($matcher = static::exactly(2))->method('withHeader') + $request->expects($matcher = self::exactly(2))->method('withHeader') ->willReturnCallback($this->withParameter($matcher, [ ['Accept', 'application/json'], ['x-api-key', 'my-key'], @@ -118,7 +118,7 @@ public function testSendWithArrayParameter(): void ->willReturn($response) ; - static::assertSame(['data' => 'test'], $client->call('method', ['foo' => ['bar', 'baz']])); + self::assertSame(['data' => 'test'], $client->call('method', ['foo' => ['bar', 'baz']])); } public function testSendWithException(): void @@ -129,7 +129,7 @@ public function testSendWithException(): void $client = new PsrClientConnection($this->client, $this->requestFactory, 'my-key', 'http://api.url/'); $request = $this->createMock(RequestInterface::class); - $request->expects($matcher = static::exactly(2))->method('withHeader') + $request->expects($matcher = self::exactly(2))->method('withHeader') ->willReturnCallback($this->withParameter($matcher, [ ['Accept', 'application/json'], ['x-api-key', 'my-key'], @@ -156,7 +156,7 @@ public function testSendWithClientException(): void $client = new PsrClientConnection($this->client, $this->requestFactory, 'my-key', 'http://api.url/'); $request = $this->createMock(RequestInterface::class); - $request->expects($matcher = static::exactly(2))->method('withHeader') + $request->expects($matcher = self::exactly(2))->method('withHeader') ->willReturnCallback($this->withParameter($matcher, [ ['Accept', 'application/json'], ['x-api-key', 'my-key'], @@ -183,7 +183,7 @@ public function testSendWithInvalidResponse(): void $client = new PsrClientConnection($this->client, $this->requestFactory, 'my-key', 'http://api.url/'); $request = $this->createMock(RequestInterface::class); - $request->expects($matcher = static::exactly(2))->method('withHeader') + $request->expects($matcher = self::exactly(2))->method('withHeader') ->willReturnCallback($this->withParameter($matcher, [ ['Accept', 'application/json'], ['x-api-key', 'my-key'], diff --git a/tests/Exception/ApiExceptionTest.php b/tests/Exception/ApiExceptionTest.php index bba0fb2..9d92f25 100644 --- a/tests/Exception/ApiExceptionTest.php +++ b/tests/Exception/ApiExceptionTest.php @@ -20,6 +20,6 @@ public function testToString(): void { $exception = new ApiException('My error', 304); - static::assertSame('304: My error', $exception->__toString()); + self::assertSame('304: My error', $exception->__toString()); } } diff --git a/tests/Fixtures/ClientException.php b/tests/Fixtures/ClientException.php index 6746034..a72b487 100644 --- a/tests/Fixtures/ClientException.php +++ b/tests/Fixtures/ClientException.php @@ -14,6 +14,4 @@ use Exception; use Psr\Http\Client\ClientExceptionInterface; -final class ClientException extends Exception implements ClientExceptionInterface -{ -} +final class ClientException extends Exception implements ClientExceptionInterface {} diff --git a/tests/Model/ArtistTest.php b/tests/Model/ArtistTest.php index 91353b5..8252db3 100644 --- a/tests/Model/ArtistTest.php +++ b/tests/Model/ArtistTest.php @@ -30,11 +30,11 @@ public function testFromApi(): void EOD; $artist = Artist::fromApi(json_decode($data, true)); - static::assertSame('The Beatles', $artist->getName()); - static::assertSame('Beatles, The', $artist->getSortName()); - static::assertSame('John, Paul, George and Ringo', $artist->getDisambiguation()); - static::assertSame('b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d', $artist->getMbid()); - static::assertSame(735610, $artist->getTmid()); - static::assertSame('https://www.setlist.fm/setlists/the-beatles-23d6a88b.html', $artist->getUrl()); + self::assertSame('The Beatles', $artist->getName()); + self::assertSame('Beatles, The', $artist->getSortName()); + self::assertSame('John, Paul, George and Ringo', $artist->getDisambiguation()); + self::assertSame('b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d', $artist->getMbid()); + self::assertSame(735610, $artist->getTmid()); + self::assertSame('https://www.setlist.fm/setlists/the-beatles-23d6a88b.html', $artist->getUrl()); } } diff --git a/tests/Model/CityTest.php b/tests/Model/CityTest.php index f8ef0e0..ac414ff 100644 --- a/tests/Model/CityTest.php +++ b/tests/Model/CityTest.php @@ -36,11 +36,11 @@ public function testFromApi(): void EOD; $city = City::fromApi(json_decode($data, true)); - static::assertSame(5357527, $city->getId()); - static::assertSame('Hollywood', $city->getName()); - static::assertSame('California', $city->getState()); - static::assertNotNull($city->getCountry()); - static::assertNotNull($city->getGeo()); - static::assertSame('CA', $city->getStateCode()); + self::assertSame(5357527, $city->getId()); + self::assertSame('Hollywood', $city->getName()); + self::assertSame('California', $city->getState()); + self::assertNotNull($city->getCountry()); + self::assertNotNull($city->getGeo()); + self::assertSame('CA', $city->getStateCode()); } } diff --git a/tests/Model/CountryTest.php b/tests/Model/CountryTest.php index c814ee5..a64800c 100644 --- a/tests/Model/CountryTest.php +++ b/tests/Model/CountryTest.php @@ -26,7 +26,7 @@ public function testFromApi(): void EOD; $country = Country::fromApi(json_decode($data, true)); - static::assertSame('US', $country->getCode()); - static::assertSame('United States', $country->getName()); + self::assertSame('US', $country->getCode()); + self::assertSame('United States', $country->getName()); } } diff --git a/tests/Model/GeoTest.php b/tests/Model/GeoTest.php index 0bab03a..1707e70 100644 --- a/tests/Model/GeoTest.php +++ b/tests/Model/GeoTest.php @@ -26,7 +26,7 @@ public function testFromApi(): void EOD; $geo = Geo::fromApi(json_decode($data, true)); - static::assertSame(34.0983425, $geo->getLatitude()); - static::assertSame(-118.3267434, $geo->getLongitude()); + self::assertSame(34.0983425, $geo->getLatitude()); + self::assertSame(-118.3267434, $geo->getLongitude()); } } diff --git a/tests/Model/SetTest.php b/tests/Model/SetTest.php index db2b445..debdd7f 100644 --- a/tests/Model/SetTest.php +++ b/tests/Model/SetTest.php @@ -83,8 +83,8 @@ public function testFromApi(): void EOD; $set = Set::fromApi(json_decode($data, true)); - static::assertSame('First set', $set->getName()); - static::assertCount(12, $set->getSongs()); - static::assertSame(3, $set->getEncore()); + self::assertSame('First set', $set->getName()); + self::assertCount(12, $set->getSongs()); + self::assertSame(3, $set->getEncore()); } } diff --git a/tests/Model/SetlistTest.php b/tests/Model/SetlistTest.php index 9b5852a..fbbf64d 100644 --- a/tests/Model/SetlistTest.php +++ b/tests/Model/SetlistTest.php @@ -122,16 +122,16 @@ public function testFromApi(): void EOD; $setlist = Setlist::fromApi(json_decode($data, true)); - static::assertSame('63de4613', $setlist->getId()); - static::assertSame('7be1aaa0', $setlist->getVersionId()); - static::assertNotNull($setlist->getVenue()); - static::assertNotNull($setlist->getArtist()); - static::assertEquals(new DateTime('23-08-1964'), $setlist->getEventDate(), '', 0); - static::assertSame('Recorded and published as \'The Beatles at the Hollywood Bowl\'', $setlist->getInfo()); - static::assertCount(1, $setlist->getSets()); - static::assertNotNull($setlist->getTour()); - static::assertEquals(new DateTime('2013-10-20T05:18:08.000+0000'), $setlist->getUpdateDate(), '', 0); - static::assertSame('https://www.setlist.fm/setlist/the-beatles/1964/hollywood-bowl-los-angeles-ca-63de4613.html', $setlist->getUrl()); + self::assertSame('63de4613', $setlist->getId()); + self::assertSame('7be1aaa0', $setlist->getVersionId()); + self::assertNotNull($setlist->getVenue()); + self::assertNotNull($setlist->getArtist()); + self::assertEquals(new DateTime('23-08-1964'), $setlist->getEventDate(), '', 0); + self::assertSame('Recorded and published as \'The Beatles at the Hollywood Bowl\'', $setlist->getInfo()); + self::assertCount(1, $setlist->getSets()); + self::assertNotNull($setlist->getTour()); + self::assertEquals(new DateTime('2013-10-20T05:18:08.000+0000'), $setlist->getUpdateDate(), '', 0); + self::assertSame('https://www.setlist.fm/setlist/the-beatles/1964/hollywood-bowl-los-angeles-ca-63de4613.html', $setlist->getUrl()); } /** @@ -237,15 +237,15 @@ public function testFromApiWithSingleSet(): void EOD; $setlist = Setlist::fromApi(json_decode($data, true)); - static::assertSame('63de4613', $setlist->getId()); - static::assertSame('7be1aaa0', $setlist->getVersionId()); - static::assertNotNull($setlist->getVenue()); - static::assertNotNull($setlist->getArtist()); - static::assertEquals(new DateTime('23-08-1964'), $setlist->getEventDate(), '', 0); - static::assertSame('Recorded and published as \'The Beatles at the Hollywood Bowl\'', $setlist->getInfo()); - static::assertCount(1, $setlist->getSets()); - static::assertNotNull($setlist->getTour()); - static::assertEquals(new DateTime('2013-10-20T05:18:08.000+0000'), $setlist->getUpdateDate(), '', 0); - static::assertSame('https://www.setlist.fm/setlist/the-beatles/1964/hollywood-bowl-los-angeles-ca-63de4613.html', $setlist->getUrl()); + self::assertSame('63de4613', $setlist->getId()); + self::assertSame('7be1aaa0', $setlist->getVersionId()); + self::assertNotNull($setlist->getVenue()); + self::assertNotNull($setlist->getArtist()); + self::assertEquals(new DateTime('23-08-1964'), $setlist->getEventDate(), '', 0); + self::assertSame('Recorded and published as \'The Beatles at the Hollywood Bowl\'', $setlist->getInfo()); + self::assertCount(1, $setlist->getSets()); + self::assertNotNull($setlist->getTour()); + self::assertEquals(new DateTime('2013-10-20T05:18:08.000+0000'), $setlist->getUpdateDate(), '', 0); + self::assertSame('https://www.setlist.fm/setlist/the-beatles/1964/hollywood-bowl-los-angeles-ca-63de4613.html', $setlist->getUrl()); } } diff --git a/tests/Model/SongTest.php b/tests/Model/SongTest.php index bc19d9c..45a0559 100644 --- a/tests/Model/SongTest.php +++ b/tests/Model/SongTest.php @@ -43,10 +43,10 @@ public function testFromApi(): void EOD; $song = Song::fromApi(json_decode($data, true)); - static::assertSame('Roll Over Beethoven', $song->getName()); - static::assertSame('This is a song', $song->getInfo()); - static::assertNotNull($song->getCover()); - static::assertCount(1, $song->getFeaturings()); - static::assertTrue($song->isTaped()); + self::assertSame('Roll Over Beethoven', $song->getName()); + self::assertSame('This is a song', $song->getInfo()); + self::assertNotNull($song->getCover()); + self::assertCount(1, $song->getFeaturings()); + self::assertTrue($song->isTaped()); } } diff --git a/tests/Model/TourTest.php b/tests/Model/TourTest.php index c2aeff2..6bff90e 100644 --- a/tests/Model/TourTest.php +++ b/tests/Model/TourTest.php @@ -25,6 +25,6 @@ public function testFromApi(): void EOD; $tour = Tour::fromApi(json_decode($data, true)); - static::assertSame('North American Tour 1964', $tour->getName()); + self::assertSame('North American Tour 1964', $tour->getName()); } } diff --git a/tests/Model/UserTest.php b/tests/Model/UserTest.php index c182a8e..c7f853f 100644 --- a/tests/Model/UserTest.php +++ b/tests/Model/UserTest.php @@ -29,10 +29,10 @@ public function testFromApi(): void EOD; $user = User::fromApi(json_decode($data, true)); - static::assertSame('Metal-42', $user->getId()); - static::assertSame('Some dummy text', $user->getAbout()); - static::assertSame('Max', $user->getFullname()); - static::assertSame('http://example.com', $user->getWebsite()); - static::assertSame('https://www.setlist.fm/user/Metal-42', $user->getUrl()); + self::assertSame('Metal-42', $user->getId()); + self::assertSame('Some dummy text', $user->getAbout()); + self::assertSame('Max', $user->getFullname()); + self::assertSame('http://example.com', $user->getWebsite()); + self::assertSame('https://www.setlist.fm/user/Metal-42', $user->getUrl()); } } diff --git a/tests/Model/VenueTest.php b/tests/Model/VenueTest.php index 78b2944..beda861 100644 --- a/tests/Model/VenueTest.php +++ b/tests/Model/VenueTest.php @@ -41,9 +41,9 @@ public function testFromApi(): void EOD; $venue = Venue::fromApi(json_decode($data, true)); - static::assertSame('6bd6ca6e', $venue->getId()); - static::assertSame('Compaq Center', $venue->getName()); - static::assertNotNull($venue->getCity()); - static::assertSame('https://www.setlist.fm/venue/compaq-center-san-jose-ca-usa-6bd6ca6e.html', $venue->getUrl()); + self::assertSame('6bd6ca6e', $venue->getId()); + self::assertSame('Compaq Center', $venue->getName()); + self::assertNotNull($venue->getCity()); + self::assertSame('https://www.setlist.fm/venue/compaq-center-san-jose-ca-usa-6bd6ca6e.html', $venue->getUrl()); } } diff --git a/tests/Service/ArtistServiceTest.php b/tests/Service/ArtistServiceTest.php index 1291976..d277a8d 100644 --- a/tests/Service/ArtistServiceTest.php +++ b/tests/Service/ArtistServiceTest.php @@ -49,7 +49,7 @@ public function testGetArtist(): void $service = new ArtistService($this->connection); $result = $service->getArtist('b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d'); - static::assertSame('b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d', $result->getMbid()); + self::assertSame('b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d', $result->getMbid()); } public function testSearch(): void @@ -78,6 +78,6 @@ public function testSearch(): void $result = $service->search(ArtistSearchBuilder::create() ->withName('The Beatles')); - static::assertCount(1, $result->getResult()); + self::assertCount(1, $result->getResult()); } } diff --git a/tests/Service/CityServiceTest.php b/tests/Service/CityServiceTest.php index 9f76144..dd2e06b 100644 --- a/tests/Service/CityServiceTest.php +++ b/tests/Service/CityServiceTest.php @@ -55,7 +55,7 @@ public function testGetCity(): void $service = new CityService($this->connection); $result = $service->getCity(5357527); - static::assertSame('Hollywood', $result->getName()); + self::assertSame('Hollywood', $result->getName()); } public function testSearch(): void @@ -90,6 +90,6 @@ public function testSearch(): void $result = $service->search(CitySearchBuilder::create() ->withName('Hollywood')); - static::assertCount(1, $result->getResult()); + self::assertCount(1, $result->getResult()); } } diff --git a/tests/Service/CountryServiceTest.php b/tests/Service/CountryServiceTest.php index e061b3e..b2aedc2 100644 --- a/tests/Service/CountryServiceTest.php +++ b/tests/Service/CountryServiceTest.php @@ -49,6 +49,6 @@ public function testSearch(): void $service = new CountryService($this->connection); $result = $service->search(); - static::assertCount(1, $result->getResult()); + self::assertCount(1, $result->getResult()); } } diff --git a/tests/Service/SetlistServiceTest.php b/tests/Service/SetlistServiceTest.php index 3a82f8e..df52297 100644 --- a/tests/Service/SetlistServiceTest.php +++ b/tests/Service/SetlistServiceTest.php @@ -73,7 +73,7 @@ public function testGetSetlist(): void $service = new SetlistService($this->connection); $result = $service->getSetlist('63de4613'); - static::assertSame('63de4613', $result->getId()); + self::assertSame('63de4613', $result->getId()); } public function testGetArtistSetlists(): void @@ -118,7 +118,7 @@ public function testGetArtistSetlists(): void $service = new SetlistService($this->connection); $result = $service->getArtistSetlists('b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d'); - static::assertCount(1, $result); + self::assertCount(1, $result); } public function testGetVenueSetlists(): void @@ -163,7 +163,7 @@ public function testGetVenueSetlists(): void $service = new SetlistService($this->connection); $result = $service->getVenueSetlists('6bd6ca6e'); - static::assertCount(1, $result); + self::assertCount(1, $result); } public function testGetSetlistByVersion(): void @@ -210,7 +210,7 @@ public function testGetSetlistByVersion(): void $service = new SetlistService($this->connection); $result = $service->getSetlistByVersion('7be1aaa0'); - static::assertSame('7be1aaa0', $result->getVersionId()); + self::assertSame('7be1aaa0', $result->getVersionId()); } public function testSearch(): void @@ -256,6 +256,6 @@ public function testSearch(): void $result = $service->search(SetlistSearchBuilder::create() ->withArtistName('The Beatles')); - static::assertCount(1, $result->getResult()); + self::assertCount(1, $result->getResult()); } } diff --git a/tests/Service/UserServiceTest.php b/tests/Service/UserServiceTest.php index 04bdbe9..bc143da 100644 --- a/tests/Service/UserServiceTest.php +++ b/tests/Service/UserServiceTest.php @@ -47,7 +47,7 @@ public function testGetUser(): void $service = new UserService($this->connection); $result = $service->getUser('Metal-42'); - static::assertSame('Metal-42', $result->getId()); + self::assertSame('Metal-42', $result->getId()); } public function testGetEdits(): void @@ -92,7 +92,7 @@ public function testGetEdits(): void $service = new UserService($this->connection); $result = $service->getEdits('42'); - static::assertCount(1, $result); + self::assertCount(1, $result); } public function testGetAttends(): void @@ -137,6 +137,6 @@ public function testGetAttends(): void $service = new UserService($this->connection); $result = $service->getAttends('42'); - static::assertCount(1, $result); + self::assertCount(1, $result); } } diff --git a/tests/Service/VenueServiceTest.php b/tests/Service/VenueServiceTest.php index 33153f4..fabdc26 100644 --- a/tests/Service/VenueServiceTest.php +++ b/tests/Service/VenueServiceTest.php @@ -60,7 +60,7 @@ public function testGetVenue(): void $service = new VenueService($this->connection); $result = $service->getVenue('6bd6ca6e'); - static::assertSame('6bd6ca6e', $result->getId()); + self::assertSame('6bd6ca6e', $result->getId()); } public function testSearch(): void @@ -94,6 +94,6 @@ public function testSearch(): void $result = $service->search(VenueSearchBuilder::create() ->withName('Compaq Center')); - static::assertCount(1, $result->getResult()); + self::assertCount(1, $result->getResult()); } }