From 5a76c48c818834aef02dea95895c01209d8073a9 Mon Sep 17 00:00:00 2001 From: Yinci Date: Mon, 19 May 2025 08:47:26 +0200 Subject: [PATCH 1/2] Utilize new V5 API --- changelog.md | 6 ++ composer.json | 46 ++++++----- composer.lock | 125 +++++++++++++++-------------- readme.md | 13 +-- src/Client.php | 9 +-- src/EpOnline.php | 4 +- src/Resources/PandEnergielabel.php | 15 ++-- upgrading.md | 9 +++ 8 files changed, 124 insertions(+), 103 deletions(-) create mode 100644 changelog.md create mode 100644 upgrading.md diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..485bd0a --- /dev/null +++ b/changelog.md @@ -0,0 +1,6 @@ +# v5.0.0 +- Changed PHP requirements to `^8.2` +- Minimum version for "guzzlehttp/guzzle" is now `^7.9` +- Minimum version for "psr/log" is now `^3.0` +- Removed the `info` endpoint +- Added the `ping` endpoint diff --git a/composer.json b/composer.json index 2b47200..131481d 100644 --- a/composer.json +++ b/composer.json @@ -1,23 +1,29 @@ { - "name": "ecodenl/ep-online-php-wrapper", - "description": "PHP Wrapper for the EP Online Public REST API ", - "type": "library", - "license": "OSL-3.0", - "authors": [ - { - "name": "Bodhi Looij", - "email": "b.looij@wedesignit.nl", - "role": "Developer" + "name": "ecodenl/ep-online-php-wrapper", + "description": "PHP Wrapper for the EP Online Public REST API", + "type": "library", + "license": "OSL-3.0", + "authors": [ + { + "name": "Bodhi Looij", + "email": "b.looij@wedesignit.nl", + "role": "Developer" + }, + { + "name": "Yannick Schrijvers", + "email": "y.schrijvers@wedesignit.nl", + "role": "Developer" + } + ], + "require": { + "php": "^8.2", + "guzzlehttp/guzzle": "^7.9", + "psr/log": "^3.0", + "ext-json": "*" + }, + "autoload": { + "psr-4": { + "Ecodenl\\EpOnlinePhpWrapper\\": "src" + } } - ], - "require": { - "php": "^7.4.0|^8.0", - "guzzlehttp/guzzle": "^6.3.1|^7.4.5", - "psr/log": "^1.1.4|^3.0" - }, - "autoload": { - "psr-4": { - "Ecodenl\\EpOnlinePhpWrapper\\": "src" - } - } } diff --git a/composer.lock b/composer.lock index 3929c83..cbd9905 100644 --- a/composer.lock +++ b/composer.lock @@ -4,26 +4,26 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a5512183fb4c08944766a1ef3e311d83", + "content-hash": "08dd815fedb32a35f5dfc2e2dc22e365", "packages": [ { "name": "guzzlehttp/guzzle", - "version": "7.7.0", + "version": "7.9.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5" + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/fb7566caccf22d74d1ab270de3551f72a58399f5", - "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0", - "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -32,11 +32,11 @@ "psr/http-client-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", + "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", - "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "guzzle/client-integration-tests": "3.0.2", "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.29 || ^9.5.23", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -114,7 +114,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.7.0" + "source": "https://github.com/guzzle/guzzle/tree/7.9.3" }, "funding": [ { @@ -130,28 +130,28 @@ "type": "tidelift" } ], - "time": "2023-05-21T14:04:53+00:00" + "time": "2025-03-27T13:37:11+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6" + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/3a494dc7dc1d7d12e511890177ae2d0e6c107da6", - "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6", + "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "type": "library", "extra": { @@ -197,7 +197,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.0" + "source": "https://github.com/guzzle/promises/tree/2.2.0" }, "funding": [ { @@ -213,20 +213,20 @@ "type": "tidelift" } ], - "time": "2023-05-21T13:50:22+00:00" + "time": "2025-03-27T13:27:01+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.5.0", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6" + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/b635f279edd83fc275f822a1188157ffea568ff6", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", "shasum": "" }, "require": { @@ -240,9 +240,9 @@ "psr/http-message-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -313,7 +313,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.5.0" + "source": "https://github.com/guzzle/psr7/tree/2.7.1" }, "funding": [ { @@ -329,20 +329,20 @@ "type": "tidelift" } ], - "time": "2023-04-17T16:11:26+00:00" + "time": "2025-03-27T12:30:47+00:00" }, { "name": "psr/http-client", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", "shasum": "" }, "require": { @@ -379,26 +379,26 @@ "psr-18" ], "support": { - "source": "https://github.com/php-fig/http-client/tree/1.0.2" + "source": "https://github.com/php-fig/http-client" }, - "time": "2023-04-10T20:12:12+00:00" + "time": "2023-09-23T14:17:50+00:00" }, { "name": "psr/http-factory", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "e616d01114759c4c489f93b099585439f795fe35" + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", - "reference": "e616d01114759c4c489f93b099585439f795fe35", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=7.0.0", + "php": ">=7.1", "psr/http-message": "^1.0 || ^2.0" }, "type": "library", @@ -422,7 +422,7 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interfaces for PSR-7 HTTP message factories", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ "factory", "http", @@ -434,9 +434,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2023-04-10T20:10:41+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { "name": "psr/http-message", @@ -493,16 +493,16 @@ }, { "name": "psr/log", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -537,9 +537,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "ralouphie/getallheaders", @@ -587,29 +587,29 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.0.2", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.5-dev" } }, "autoload": { @@ -634,7 +634,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" }, "funding": [ { @@ -650,7 +650,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2024-09-25T14:20:29+00:00" } ], "packages-dev": [], @@ -660,7 +660,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.4.0|^8.0" + "php": "^8.2", + "ext-json": "*" }, "platform-dev": [], "plugin-api-version": "2.3.0" diff --git a/readme.md b/readme.md index c437e9e..7abf545 100644 --- a/readme.md +++ b/readme.md @@ -4,9 +4,12 @@ A simple PHP wrapper for EP Online API. ## Version Information -| Package version | API Version | Status | PHP Version | -|:----------------|:------------|:------------------------|:------------| -| 3.x.x | 3.x.x | Active support :rocket: | ^7.4.0 \| ^8.0 | +To keep versioning simple, the package version is aligned with the EP-Online API version. + +| Package version | API Version | Status | PHP Version | +|:----------------|:------------|:------------------------|:---------------| +| 5.x.x | 5.x.x | Active support :rocket: | ^8.0 | +| 3.x.x | 3.x.x | No active support :x: | ^7.4.0 \| ^8.0 | ## Installing @@ -48,7 +51,7 @@ $epOnline = EpOnline::init($client); ### PandEnergielabel ```php -// Get the available energylabel from the given address (see +// Get the available energy label for the given address (see // the official api docs (https://public.ep-online.nl/swagger/index.html) for all possible parameters $label = $epOnline->pandEnergielabel() ->byAddress([ @@ -56,7 +59,7 @@ $label = $epOnline->pandEnergielabel() 'huisnummer' => 13, ]); -// Search on a ID from the bag ("adresseerbaarObjectId") +// Search on a ID from the BAG ("adresseerbaarObjectId") $address = $epOnline->pandEnergielabel() ->byId('1924010000030064'); ``` diff --git a/src/Client.php b/src/Client.php index 4e1bea4..9d56984 100644 --- a/src/Client.php +++ b/src/Client.php @@ -15,7 +15,7 @@ class Client { use FluentCaller; - protected string $baseUrl = "https://public.ep-online.nl/api/v3/"; + protected string $baseUrl = "https://public.ep-online.nl/api/v5/"; private array $config; @@ -39,7 +39,7 @@ public function __construct( ]; } - public function getClient() + public function getClient(): ?GuzzleClient { if (is_null($this->client)) { if ($this->logger instanceof LoggerInterface) { @@ -63,7 +63,7 @@ public function getClient() return $this->client; } - public function request(string $method, string $uri, array $options = []): array + public function request(string $method, string $uri, array $options = []): array|string { $response = $this->getClient()->request($method, $uri, $options); @@ -74,9 +74,8 @@ public function request(string $method, string $uri, array $options = []): array return json_decode($contents, true); } - public function get(string $uri, array $options = []): array + public function get(string $uri, array $options = []): array|string { return $this->request('GET', $uri, $options); } - } diff --git a/src/EpOnline.php b/src/EpOnline.php index 881b6ad..b3f7d7c 100644 --- a/src/EpOnline.php +++ b/src/EpOnline.php @@ -16,9 +16,9 @@ public function __construct(Client $client) $this->client = $client; } - public function info(): array + public function ping(): string { - return $this->client->get('info'); + return $this->client->get('Ping'); } public function pandEnergielabel(): PandEnergielabel diff --git a/src/Resources/PandEnergielabel.php b/src/Resources/PandEnergielabel.php index 9f4d5b4..917be02 100644 --- a/src/Resources/PandEnergielabel.php +++ b/src/Resources/PandEnergielabel.php @@ -5,21 +5,18 @@ class PandEnergielabel extends Resource { /** - * Returns specific data about the given identification. - * - * @param string $adresseerbaarObjectId - * - * @return array + * Returns the energy label for a specific BAG "verblijfsobject" ID. */ public function byId(string $adresseerbaarObjectId): array { return $this->client->get($this->uri("AdresseerbaarObject/{$adresseerbaarObjectId}")); } - public function byAddress($attributes): array + /** + * Returns the energy label for an address. + */ + public function byAddress(array $attributes): array { - $response = $this->client->get($this->uri('Adres'), static::buildQuery($attributes)); - - return $response; + return $this->client->get($this->uri('Adres'), static::buildQuery($attributes)); } } diff --git a/upgrading.md b/upgrading.md new file mode 100644 index 0000000..b7a65e9 --- /dev/null +++ b/upgrading.md @@ -0,0 +1,9 @@ +# From V3 to V5 +Upgrading from the old V3 to V5 is a requirement considering the V3 API is no longer online. The upgrade +is very minor, and most likely you won't have to do anything. + +## PHP +The minimum PHP version is now 8.2. Ensure your PHP version is up to date. + +## Info endpoint +The `info` endpoint has been removed since it doesn't exist. If you were using this, you should remove it. From 339d8024eaaf1f990083eb3197c3ef142de14dad Mon Sep 17 00:00:00 2001 From: Yinci Date: Mon, 19 May 2025 09:56:02 +0200 Subject: [PATCH 2/2] Code analyse --- .env.actions | 48 +++++++++ .github/workflows/static-analysis.yml | 68 ++++++++++++ composer.json | 4 + composer.lock | 147 +++++++++++++++++++++++++- phpcs.xml | 107 +++++++++++++++++++ phpstan.neon | 22 ++++ src/Client.php | 5 +- src/Traits/FluentCaller.php | 3 +- 8 files changed, 399 insertions(+), 5 deletions(-) create mode 100644 .env.actions create mode 100644 .github/workflows/static-analysis.yml create mode 100644 phpcs.xml create mode 100644 phpstan.neon diff --git a/.env.actions b/.env.actions new file mode 100644 index 0000000..556c7ce --- /dev/null +++ b/.env.actions @@ -0,0 +1,48 @@ +APP_NAME="EP-Online PHP Wrapper" +APP_ENV=testing +APP_KEY=arandomkeythatdoesnotrealymatter +APP_DEBUG=true +APP_LOG_LEVEL=debug +DEBUGBAR_ENABLED=false +LOG_CHANNEL=daily +APP_DOMAIN=localhost +APP_URL=http://localhost + +APP_TIMEZONE=Europe/Amsterdam +APP_LOCALE=nl +APP_FALLBACK_LOCALE=en +APP_FAKER_LOCALE=en_US +APP_MAINTENANCE_DRIVER=file +APP_MAINTENANCE_STORE=database +BCRYPT_ROUNDS=12 + +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=ep_online_test +DB_USERNAME=root +DB_PASSWORD= + +BROADCAST_CONNECTION=log +CACHE_STORE=file +SESSION_DRIVER=file +QUEUE_CONNECTION=sync + +MAIL_MAILER=log +MAIL_HOST=host.docker.internal +MAIL_PORT=2525 +MAIL_USERNAME=EP-Online-Local +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null + +MAIL_FROM_ADDRESS=noreply@hoomdossier.nl +MAIL_FROM_ADDRESS_NOREPLY=noreply@hoomdossier.nl +MAIL_FROM_NAME=Hoomdossier + +PUSHER_APP_ID= +PUSHER_APP_KEY= +PUSHER_APP_SECRET= + +SESSION_ENCRYPT=false +SESSION_PATH=/ +SESSION_DOMAIN=null diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 0000000..5e730ae --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,68 @@ +name: Static analysis +on: + push: + branches: [ "develop" ] + pull_request: + branches: [ "develop" ] + +jobs: + phpstan: + name: PHPStan code analysis [PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}] + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + php: [8.2, 8.3, 8.4] + #dependency-version: [ prefer-lowest, prefer-stable ] + dependency-version: [ prefer-stable ] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl + coverage: none + + - name: Copy .env + run: php -r "copy('.env.actions', '.env');" + - name: Run composer install + run: composer install --prefer-dist + - name: Run larastan (PHPStan) - Static code analysis + run: ./vendor/bin/phpstan analyse --memory-limit=2G + + phpcs: + name: PHPcs PSR check [PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}] + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + php: [8.2, 8.3, 8.4] + #dependency-version: [ prefer-lowest, prefer-stable ] + dependency-version: [ prefer-stable ] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl + coverage: none + + - name: Copy .env + run: php -r "copy('.env.actions', '.env');" + - name: Run composer install + run: composer install --prefer-dist + + - name: Run phpcs - PSR2 check +# run: ./vendor/bin/phpcs --standard=phpcs.xml src # Run with warnings > This will still trigger failure + run: ./vendor/bin/phpcs --standard=phpcs.xml src -n # To run errors only +# run: ./vendor/bin/phpcs --standard=PSR2 src diff --git a/composer.json b/composer.json index 131481d..8bb398d 100644 --- a/composer.json +++ b/composer.json @@ -25,5 +25,9 @@ "psr-4": { "Ecodenl\\EpOnlinePhpWrapper\\": "src" } + }, + "require-dev": { + "phpstan/phpstan": "^2.0", + "squizlabs/php_codesniffer": "^3.11" } } diff --git a/composer.lock b/composer.lock index cbd9905..885a037 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "08dd815fedb32a35f5dfc2e2dc22e365", + "content-hash": "7891fac161291af5270a99825971c81c", "packages": [ { "name": "guzzlehttp/guzzle", @@ -653,7 +653,150 @@ "time": "2024-09-25T14:20:29+00:00" } ], - "packages-dev": [], + "packages-dev": [ + { + "name": "phpstan/phpstan", + "version": "2.1.16", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "b8c1cf533cba0c305d91c6ccd23f3dd0566ba5f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b8c1cf533cba0c305d91c6ccd23f3dd0566ba5f9", + "reference": "b8c1cf533cba0c305d91c6ccd23f3dd0566ba5f9", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2025-05-16T09:40:10+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.13.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "65ff2489553b83b4597e89c3b8b721487011d186" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/65ff2489553b83b4597e89c3b8b721487011d186", + "reference": "65ff2489553b83b4597e89c3b8b721487011d186", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-05-11T03:36:00+00:00" + } + ], "aliases": [], "minimum-stability": "stable", "stability-flags": [], diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..d6a12f5 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,107 @@ + + + The coding standard for our project. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vendor/* + storage/* + bootstrap/* + public/* + */migrations/* + */seeds/* + *.blade.php + *.js + diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..ae349ea --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,22 @@ +#includes: + # Example: + #- vendor/nesbot/carbon/extension.neon + +parameters: + + paths: + - src/ + + # Level 10 is the highest level, see https://phpstan.org/user-guide/rule-levels + level: 5 + + #excludePaths: + # Example: + #- ./src/Traits/FluentCaller.php + + ignoreErrors: + # These errors are ignored because we are 100% certain it's not actually an issue + - '#Unsafe usage of new static(.*)#' + + #tips: + #treatPhpDocTypesAsCertain: false diff --git a/src/Client.php b/src/Client.php index 9d56984..9281f87 100644 --- a/src/Client.php +++ b/src/Client.php @@ -25,8 +25,9 @@ class Client public function __construct( string $secret, - LoggerInterface $logger = null - ) { + ?LoggerInterface $logger = null + ) + { $this->logger = $logger; $this->config = [ diff --git a/src/Traits/FluentCaller.php b/src/Traits/FluentCaller.php index b7e790d..50891be 100644 --- a/src/Traits/FluentCaller.php +++ b/src/Traits/FluentCaller.php @@ -2,7 +2,8 @@ namespace Ecodenl\EpOnlinePhpWrapper\Traits; -trait FluentCaller { +trait FluentCaller +{ public static function init() {