From 9ac7b659e7061ae94071ead766a7323669580506 Mon Sep 17 00:00:00 2001 From: Kevin Wenger Date: Fri, 14 Jun 2024 10:03:11 +0200 Subject: [PATCH] fix php convention array indentation --- examples/templates/base.php | 10 ++-- src/Pricehubble.php | 8 +-- src/Resource/AbstractResource.php | 8 +-- src/Resource/ResourceInterface.php | 4 +- .../PricehubbleAttachRequestPayloadTest.php | 2 +- tests/Unit/PricehubbleTest.php | 10 ++-- tests/Unit/Resource/PointsOfInterestTest.php | 22 ++++---- tests/Unit/Resource/ValuationTest.php | 54 +++++++++---------- 8 files changed, 59 insertions(+), 59 deletions(-) diff --git a/examples/templates/base.php b/examples/templates/base.php index e471f55..14eea52 100644 --- a/examples/templates/base.php +++ b/examples/templates/base.php @@ -3,7 +3,7 @@ include_once \dirname(__DIR__).'/../vendor/autoload.php'; if (!\class_exists('Symfony\Component\Dotenv\Dotenv')) { - throw new \RuntimeException('You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.'); + throw new RuntimeException('You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.'); } $env = \dirname(__DIR__).'/.env'; @@ -12,15 +12,15 @@ $dotenv = new Symfony\Component\Dotenv\Dotenv($env); $dotenv->load($env); } else { - throw new \RuntimeException('You need to define a .env file.'); + throw new RuntimeException('You need to define a .env file.'); } function getEnvVariables() { return [ - 'PRICEHUBBLE_USERNAME' => $_ENV['PRICEHUBBLE_USERNAME'], - 'PRICEHUBBLE_PASS' => $_ENV['PRICEHUBBLE_PASS'], - ]; + 'PRICEHUBBLE_USERNAME' => $_ENV['PRICEHUBBLE_USERNAME'], + 'PRICEHUBBLE_PASS' => $_ENV['PRICEHUBBLE_PASS'], + ]; } /* Ad hoc functions to make the examples marginally prettier. */ diff --git a/src/Pricehubble.php b/src/Pricehubble.php index 4cd8534..aace8f8 100644 --- a/src/Pricehubble.php +++ b/src/Pricehubble.php @@ -493,10 +493,10 @@ protected function prepareStateForRequest(string $http_verb, string $url, int $t ]; $this->lastRequest = $parts + [ - 'method' => $http_verb, - 'body' => '', - 'timeout' => $timeout, - ]; + 'method' => $http_verb, + 'body' => '', + 'timeout' => $timeout, + ]; return $this->lastResponse; } diff --git a/src/Resource/AbstractResource.php b/src/Resource/AbstractResource.php index 4327300..faaf820 100644 --- a/src/Resource/AbstractResource.php +++ b/src/Resource/AbstractResource.php @@ -12,15 +12,15 @@ abstract class AbstractResource implements ResourceInterface /** * The Pricehubble base API instance. * - * @var \Antistatique\Pricehubble\Pricehubble + * @var Pricehubble */ private Pricehubble $pricehubble; /** * Construct a new AbstractApi object. * - * @param \Antistatique\Pricehubble\Pricehubble $pricehubble - * The Pricehubble base API class + * @param Pricehubble $pricehubble + * The Pricehubble base API class */ public function __construct(Pricehubble $pricehubble) { @@ -30,7 +30,7 @@ public function __construct(Pricehubble $pricehubble) /** * Set the API provider. * - * @param \Antistatique\Pricehubble\Pricehubble $pricehubble the Pricehubble base API instance + * @param Pricehubble $pricehubble the Pricehubble base API instance * * @return $this */ diff --git a/src/Resource/ResourceInterface.php b/src/Resource/ResourceInterface.php index e03c4e7..f14d05c 100644 --- a/src/Resource/ResourceInterface.php +++ b/src/Resource/ResourceInterface.php @@ -12,8 +12,8 @@ interface ResourceInterface /** * Get the API provider. * - * @return \Antistatique\Pricehubble\Pricehubble - * The Pricehubble base API instance + * @return Pricehubble + * The Pricehubble base API instance */ public function getPricehubble(): Pricehubble; } diff --git a/tests/Unit/PricehubbleAttachRequestPayloadTest.php b/tests/Unit/PricehubbleAttachRequestPayloadTest.php index d76e72a..782bfac 100644 --- a/tests/Unit/PricehubbleAttachRequestPayloadTest.php +++ b/tests/Unit/PricehubbleAttachRequestPayloadTest.php @@ -23,7 +23,7 @@ final class PricehubbleAttachRequestPayloadTest extends TestCase /** * The Pricehubble base API instance. * - * @var \Antistatique\Pricehubble\Pricehubble + * @var Pricehubble */ private Pricehubble $pricehubble; diff --git a/tests/Unit/PricehubbleTest.php b/tests/Unit/PricehubbleTest.php index e2f38b3..fe212b3 100644 --- a/tests/Unit/PricehubbleTest.php +++ b/tests/Unit/PricehubbleTest.php @@ -24,7 +24,7 @@ final class PricehubbleTest extends TestCase /** * The Pricehubble base API instance. * - * @var \Antistatique\Pricehubble\Pricehubble + * @var Pricehubble */ private Pricehubble $pricehubble; @@ -450,8 +450,8 @@ public function testDetermineSuccess401MissingToken() $this->expectExceptionMessage('401 invalid_request: The access token is missing'); $this->callPrivateMethod($pricehubble_mock, 'determineSuccess', [ $response, [ - 'error_description' => 'The access token is missing', - 'error' => 'invalid_request', + 'error_description' => 'The access token is missing', + 'error' => 'invalid_request', ], 0, ]); } @@ -469,8 +469,8 @@ public function testDetermineSuccess403MissingProperty() $this->expectExceptionMessage("403 'dossierId', 'simulationId' or 'buildingId' is a required property"); $this->callPrivateMethod($pricehubble_mock, 'determineSuccess', [ $response, [ - 'message' => "'dossierId', 'simulationId' or 'buildingId' is a required property", - ], 0, + 'message' => "'dossierId', 'simulationId' or 'buildingId' is a required property", + ], 0, ]); } diff --git a/tests/Unit/Resource/PointsOfInterestTest.php b/tests/Unit/Resource/PointsOfInterestTest.php index 4bed780..7919442 100644 --- a/tests/Unit/Resource/PointsOfInterestTest.php +++ b/tests/Unit/Resource/PointsOfInterestTest.php @@ -149,20 +149,20 @@ public function testGatherReturnsExpected(): void 'category' => 'education', 'distance' => 256, 'location' => [ - 'address' => [ - 'city' => 'Lausanne', - 'houseNumber' => '26-28', - 'postCode' => '1004', - 'street' => 'Avenue de Provence', - ], + 'address' => [ + 'city' => 'Lausanne', + 'houseNumber' => '26-28', + 'postCode' => '1004', + 'street' => 'Avenue de Provence', + ], 'coordinates' => [ - 'latitude' => 46.5234680175781, - 'longitude' => 6.6108078956604, - ], + 'latitude' => 46.5234680175781, + 'longitude' => 6.6108078956604, ], - 'name' => 'Gymnase Provence', - 'subcategory' => 'university', ], + 'name' => 'Gymnase Provence', + 'subcategory' => 'university', + ], 8 => [ 'category' => 'education', 'distance' => 261, diff --git a/tests/Unit/Resource/ValuationTest.php b/tests/Unit/Resource/ValuationTest.php index f7ed3f7..88a1018 100644 --- a/tests/Unit/Resource/ValuationTest.php +++ b/tests/Unit/Resource/ValuationTest.php @@ -32,35 +32,35 @@ public function testFullReturnsExpected(): void $response = json_decode(file_get_contents(__DIR__.'/../../responses/valuation-full.json'), true, 512, JSON_THROW_ON_ERROR); $fullParams = [ - 'dealType' => 'sale', - 'valuationInputs' => [ - [ - 'property' => [ - 'location' => [ - 'address' => [ - 'postCode' => 8037, - 'city' => 'Zürich', - 'street' => 'Nordstrasse', - 'houseNumber' => '391', - ], - ], - 'buildingYear' => 1850, - 'livingArea' => 130, - 'propertyType' => [ - 'code' => 'apartment', - 'subcode' => 'apartment_normal', + 'dealType' => 'sale', + 'valuationInputs' => [ + [ + 'property' => [ + 'location' => [ + 'address' => [ + 'postCode' => 8037, + 'city' => 'Zürich', + 'street' => 'Nordstrasse', + 'houseNumber' => '391', + ], + ], + 'buildingYear' => 1850, + 'livingArea' => 130, + 'propertyType' => [ + 'code' => 'apartment', + 'subcode' => 'apartment_normal', + ], + 'numberOfRooms' => 5, + 'gardenArea' => 25, + 'balconyArea' => 5, + 'numberOfIndoorParkingSpaces' => 1, + 'numberOfOutdoorParkingSpaces' => 2, + 'numberOfBathrooms' => 2, + 'renovationYear' => 2019, + ], ], - 'numberOfRooms' => 5, - 'gardenArea' => 25, - 'balconyArea' => 5, - 'numberOfIndoorParkingSpaces' => 1, - 'numberOfOutdoorParkingSpaces' => 2, - 'numberOfBathrooms' => 2, - 'renovationYear' => 2019, - ], ], - ], - 'countryCode' => 'CH', + 'countryCode' => 'CH', ]; $pricehubble_mock = $this->getMockBuilder(Pricehubble::class) ->onlyMethods(['makeRequest'])