From 18030987d90d62ce25b89a3e6f87847b2d0d95c3 Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Mon, 16 Dec 2024 14:44:56 +0100 Subject: [PATCH 01/13] Update compatible versions to 8.0 - 8.4 also update changelog (for upcoming 1.0) --- .github/workflows/main.yml | 2 ++ CHANGELOG.md | 15 +++++++-------- composer.json | 2 +- composer.lock | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3a22dd1..a6ace84 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,8 @@ jobs: - '8.0' - '8.1' - '8.2' + - '8.3' + - '8.4' experimental: [false] include: - php-versions: nightly diff --git a/CHANGELOG.md b/CHANGELOG.md index 76abadf..e20f960 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased][] -Spring clean 2022! +## [1.0][] – 2024-12-16 + +**Note:** Support for all PHP `7` versions has been dropped. PHP `8+` only, from now on :) ### Added @@ -19,16 +21,12 @@ Spring clean 2022! - **Breaking:** Change PHP namespace to `Idoit\APIClient` - **Breaking:** Move repository to `github.com/i-doit/api-client-php` - **Breaking:** Require at least PHP version `8.0` -- Recommend PHP version `8.1` +- Recommend PHP version `8.2` - **Breaking:** Require at least i-doit `1.18.1` and its API add-on `1.12.3` -### Deprecated - -- Deprecate support of PHP version `7.4` - ### Removed -- **Breaking:** Drop support of PHP version `7.1`, `7.2`, and `7.3` +- **Breaking:** Drop support of PHP version `7.1`, `7.2`, `7.3` and `7.4` ## [0.10][] – 2020-04-07 @@ -234,7 +232,8 @@ Happy summer time ⛱️ Initial release -[Unreleased]: https://github.com/i-doit/api-client-php/compare/0.10...HEAD +[Unreleased]: https://github.com/i-doit/api-client-php/compare/1.0...HEAD +[1.0]: https://github.com/i-doit/api-client-php/compare/0.10...1.0 [0.10]: https://github.com/i-doit/api-client-php/compare/0.9...0.10 [0.9]: https://github.com/i-doit/api-client-php/compare/0.8...0.9 [0.8]: https://github.com/i-doit/api-client-php/compare/0.7...0.8 diff --git a/composer.json b/composer.json index 8bf8a45..1d95635 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "source": "https://github.com/i-doit/api-client-php" }, "require": { - "php": "^8.0 || ^8.1 || ^8.2", + "php": "^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4", "ext-curl": "*", "ext-date": "*", "ext-json": "*", diff --git a/composer.lock b/composer.lock index 83089d9..2892465 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": "f0dcc1a13f36c9edf17ddd3928f17e41", + "content-hash": "dd815391c58d12f738f4123862eb09f3", "packages": [], "packages-dev": [ { @@ -6195,7 +6195,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.0 || ^8.1 || ^8.2", + "php": "^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4", "ext-curl": "*", "ext-date": "*", "ext-json": "*", From 3e9720700ada7c234d3c3ba6591fac0925536985 Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Mon, 16 Dec 2024 14:48:35 +0100 Subject: [PATCH 02/13] Change compatibility 8.0 - 8.3 (PHP 8.4 is not possible due to dev dependency) --- .github/workflows/main.yml | 1 - CHANGELOG.md | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a6ace84..9ff0bbb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,6 @@ jobs: - '8.1' - '8.2' - '8.3' - - '8.4' experimental: [false] include: - php-versions: nightly diff --git a/CHANGELOG.md b/CHANGELOG.md index e20f960..2f7d609 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `Idoit::search()`, `Idoit::batchSearch`: Add search modes "normal" (default), "deep" and "auto-deep" +- Support for PHP `8.3` ### Changed From 7806e3114af643ea3ee32fcc0a43a75cd611a92d Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Mon, 16 Dec 2024 14:58:48 +0100 Subject: [PATCH 03/13] Make PHP 8 compatibility changes + update used endpoints --- src/API.php | 3 ++- src/CMDBCategory.php | 8 ++++---- src/CMDBObject.php | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/API.php b/src/API.php index 2feec6e..0124516 100644 --- a/src/API.php +++ b/src/API.php @@ -348,7 +348,7 @@ protected function setCURLOptions(): self { public function connect(): self { $this->resource = curl_init(); - if ($this->resource == false) { + if (!$this->resource) { throw new RuntimeException('Unable to initiate cURL session'); } @@ -371,6 +371,7 @@ public function disconnect(): self { } curl_close($this->resource); + $this->resource = null; return $this; } diff --git a/src/CMDBCategory.php b/src/CMDBCategory.php index 36eac99..dd256da 100644 --- a/src/CMDBCategory.php +++ b/src/CMDBCategory.php @@ -100,7 +100,7 @@ public function create(int $objectID, string $categoryConst, array $attributes): ]; $result = $this->api->request( - 'cmdb.category.create', + 'cmdb.category.save', $params ); @@ -217,7 +217,7 @@ public function update(int $objectID, string $categoryConst, array $attributes, } $result = $this->api->request( - 'cmdb.category.update', + 'cmdb.category.save', [ 'objID' => $objectID, 'category' => $categoryConst, @@ -382,7 +382,7 @@ public function batchCreate(array $objectIDs, string $categoryConst, array $attr ]; $requests[] = [ - 'method' => 'cmdb.category.create', + 'method' => 'cmdb.category.save', 'params' => $params ]; } @@ -493,7 +493,7 @@ public function batchUpdate(array $objectIDs, string $categoryConst, array $attr foreach ($objectIDs as $objectID) { $requests[] = [ - 'method' => 'cmdb.category.update', + 'method' => 'cmdb.category.save', 'params' => [ 'objID' => $objectID, 'category' => $categoryConst, diff --git a/src/CMDBObject.php b/src/CMDBObject.php index c4269eb..8b3ead4 100644 --- a/src/CMDBObject.php +++ b/src/CMDBObject.php @@ -59,7 +59,7 @@ public function create($type, string $title, array $attributes = []): int { $attributes['title'] = $title; $result = $this->api->request( - 'cmdb.object.create', + 'cmdb.object.save', $attributes ); @@ -147,7 +147,7 @@ public function update(int $objectID, array $attributes = []): self { } $result = $this->api->request( - 'cmdb.object.update', + 'cmdb.object.save', $params ); From 9eeaa03c55c9e2d441f3af855af36cbd97e45b30 Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Mon, 16 Dec 2024 14:59:07 +0100 Subject: [PATCH 04/13] Update composer packages and changelog --- CHANGELOG.md | 2 +- composer.json | 19 ++++++++----------- composer.lock | 26 +++++++++++++------------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f7d609..83a5a5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased][] -## [1.0][] – 2024-12-16 +## [1.0.0][] – 2024-12-16 **Note:** Support for all PHP `7` versions has been dropped. PHP `8+` only, from now on :) diff --git a/composer.json b/composer.json index 1d95635..213d70e 100644 --- a/composer.json +++ b/composer.json @@ -35,23 +35,23 @@ "require-dev": { "ext-dom": "*", "ext-xml": "*", - "brianium/paratest": "^6.4", + "brianium/paratest": "^6.11", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", "j13k/yaml-lint": "^1.1", - "phan/phan": "^5.3", + "phan/phan": "^5.4", "php-parallel-lint/php-parallel-lint": "^1.3", "phpcompatibility/php-compatibility": "^9.3", "phploc/phploc": "^7.0", - "phpmd/phpmd": "^2.12", - "phpstan/phpstan": "^1.7", - "phpunit/phpunit": "^9.5", + "phpmd/phpmd": "^2.15", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^9.6", "povils/phpmnd": "^2.5", - "psalm/phar": "^4.23", + "psalm/phar": "^5.26", "roave/security-advisories": "dev-master", "sclable/xml-lint": "^0.8.0", "sebastian/phpcpd": "^6.0", - "seld/jsonlint": "^1.9", - "squizlabs/php_codesniffer": "^3.6", + "seld/jsonlint": "^1.11", + "squizlabs/php_codesniffer": "^3.11", "symfony/dotenv": "^5.4" }, "suggest": { @@ -158,8 +158,5 @@ "phpunit-parallel": "Perform unit tests in parallel", "phpunit-unreleased": "Perform unit tests for unreleased features", "system-check": "Run some system checks" - }, - "extra": { - "version": "0.11-dev" } } diff --git a/composer.lock b/composer.lock index 2892465..47ea43d 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": "dd815391c58d12f738f4123862eb09f3", + "content-hash": "b20d33b70b702c59c335eec112291a92", "packages": [], "packages-dev": [ { @@ -1812,20 +1812,20 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.12", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0" + "reference": "46b4d3529b12178112d9008337beda0cc2a1a6b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0", - "reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46b4d3529b12178112d9008337beda0cc2a1a6b4", + "reference": "46b4d3529b12178112d9008337beda0cc2a1a6b4", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -1866,7 +1866,7 @@ "type": "github" } ], - "time": "2024-11-28T22:13:23+00:00" + "time": "2024-11-28T22:19:37+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2349,16 +2349,16 @@ }, { "name": "psalm/phar", - "version": "4.30.0", + "version": "5.26.1", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "33723713902e1345904a5c9064ef7848bee0d490" + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/33723713902e1345904a5c9064ef7848bee0d490", - "reference": "33723713902e1345904a5c9064ef7848bee0d490", + "url": "https://api.github.com/repos/psalm/phar/zipball/8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", "shasum": "" }, "require": { @@ -2378,9 +2378,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/4.30.0" + "source": "https://github.com/psalm/phar/tree/5.26.1" }, - "time": "2022-11-06T20:41:58+00:00" + "time": "2024-09-09T16:22:43+00:00" }, { "name": "psr/container", From 930c002c48612fa5ce39fb28555f60f80c9e4636 Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Mon, 16 Dec 2024 15:05:12 +0100 Subject: [PATCH 05/13] Update curl usage and psalm configuration --- psalm.xml | 2 +- src/API.php | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/psalm.xml b/psalm.xml index 7b66b9b..dfeb35a 100644 --- a/psalm.xml +++ b/psalm.xml @@ -4,7 +4,7 @@ resolveFromConfigFile="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" - phpVersion="7.4" + phpVersion="8.0" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" errorBaseline="psalm-baseline.xml" > diff --git a/src/API.php b/src/API.php index 0124516..2b47e22 100644 --- a/src/API.php +++ b/src/API.php @@ -139,9 +139,9 @@ class API { /** * cURL resource * - * @var CurlHandle|resource|false|null + * @var CurlHandle|null */ - protected $resource; + protected CurlHandle|null $resource = null; /** * Information about last client request @@ -247,7 +247,7 @@ public function __destruct() { * @return bool */ public function isConnected(): bool { - return is_resource($this->resource) || $this->resource instanceof CurlHandle; + return $this->resource instanceof CurlHandle; } /** @@ -346,12 +346,14 @@ protected function setCURLOptions(): self { * @throws RuntimeException on error */ public function connect(): self { - $this->resource = curl_init(); + $curl = curl_init(); - if (!$this->resource) { + if (!$curl instanceof CurlHandle) { throw new RuntimeException('Unable to initiate cURL session'); } + $this->resource = $curl; + return $this; } From ba05d2be482db2ecae4990975ab075f92eb40ad7 Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Mon, 16 Dec 2024 15:07:30 +0100 Subject: [PATCH 06/13] Update composer json --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 213d70e..699f591 100644 --- a/composer.json +++ b/composer.json @@ -158,5 +158,8 @@ "phpunit-parallel": "Perform unit tests in parallel", "phpunit-unreleased": "Perform unit tests for unreleased features", "system-check": "Run some system checks" + }, + "extra": { + "version": "0.11-dev" } } From 092e4f8e04fc67290a11b257581578d68595b134 Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Mon, 16 Dec 2024 15:21:02 +0100 Subject: [PATCH 07/13] Update PHPStan configuration, fix some issues --- phpstan.neon | 7 ------- src/API.php | 2 +- src/CMDBCategoryInfo.php | 8 +------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 749d469..91e6453 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,11 +1,4 @@ parameters: level: 5 - checkMissingIterableValueType: false paths: - src - - tests - ignoreErrors: - # Ignore skipped tests: - - message: "#Unreachable statement#" - paths: - - tests/Idoit/APIClient/* diff --git a/src/API.php b/src/API.php index 2b47e22..dcf6423 100644 --- a/src/API.php +++ b/src/API.php @@ -622,7 +622,7 @@ protected function execute(array $data): array { $lastResponse = json_decode(trim($body), true); if (!is_array($lastResponse)) { - if (is_string($body) && strlen($body) > 0) { + if (strlen($body) > 0) { throw new RuntimeException(sprintf( 'i-doit responded with an unknown message: %s', $body diff --git a/src/CMDBCategoryInfo.php b/src/CMDBCategoryInfo.php index aa93bfd..8c70e53 100644 --- a/src/CMDBCategoryInfo.php +++ b/src/CMDBCategoryInfo.php @@ -131,13 +131,7 @@ public function readAll(): array { $categories = $this->batchRead($cleanCategoryConstants); - $combinedArray = array_combine($cleanCategoryConstants, $categories); - - if (!is_array($combinedArray)) { - throw new RuntimeException('Unable to restructure result'); - } - - return $combinedArray; + return array_combine($cleanCategoryConstants, $categories); } /** From b9d3bebd5328d6c380e836a0ed2fbc7cbcac777f Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Mon, 16 Dec 2024 15:59:29 +0100 Subject: [PATCH 08/13] Revert 'cmdb.object.save' to 'cmdb.object.create' --- src/CMDBObject.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMDBObject.php b/src/CMDBObject.php index 8b3ead4..d1090ed 100644 --- a/src/CMDBObject.php +++ b/src/CMDBObject.php @@ -59,7 +59,7 @@ public function create($type, string $title, array $attributes = []): int { $attributes['title'] = $title; $result = $this->api->request( - 'cmdb.object.save', + 'cmdb.object.create', $attributes ); @@ -147,7 +147,7 @@ public function update(int $objectID, array $attributes = []): self { } $result = $this->api->request( - 'cmdb.object.save', + 'cmdb.object.create', $params ); From c861f6ad774909bf3f55f14b56a2b57afdbbd919 Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Mon, 16 Dec 2024 16:00:08 +0100 Subject: [PATCH 09/13] Update changelog and phpunit.xml --- CHANGELOG.md | 4 ++-- phpunit.xml | 47 ++++++++++++++++++++--------------------------- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83a5a5d..53c5cda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -233,8 +233,8 @@ Happy summer time ⛱️ Initial release -[Unreleased]: https://github.com/i-doit/api-client-php/compare/1.0...HEAD -[1.0]: https://github.com/i-doit/api-client-php/compare/0.10...1.0 +[Unreleased]: https://github.com/i-doit/api-client-php/compare/1.0.0...HEAD +[1.0.0]: https://github.com/i-doit/api-client-php/compare/0.10...1.0.0 [0.10]: https://github.com/i-doit/api-client-php/compare/0.9...0.10 [0.9]: https://github.com/i-doit/api-client-php/compare/0.8...0.9 [0.8]: https://github.com/i-doit/api-client-php/compare/0.7...0.8 diff --git a/phpunit.xml b/phpunit.xml index 8e82caf..b0915c5 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,28 +1,21 @@ - - - - ./tests/Idoit/APIClient/ - - - - - - - - ./src/ - - - - + + + + + ./src/ + + + + + + + + ./tests/Idoit/APIClient/ + + + + + From 57463e2e3708fe8e9b0da2dfdbdd29cb33b0b164 Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Mon, 16 Dec 2024 16:02:37 +0100 Subject: [PATCH 10/13] Revert 'cmdb.object.create' to 'cmdb.object.update' --- src/CMDBObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMDBObject.php b/src/CMDBObject.php index d1090ed..c4269eb 100644 --- a/src/CMDBObject.php +++ b/src/CMDBObject.php @@ -147,7 +147,7 @@ public function update(int $objectID, array $attributes = []): self { } $result = $this->api->request( - 'cmdb.object.create', + 'cmdb.object.update', $params ); From dda9179a328eb43428a8d68f56af6b3ba9b74e74 Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Tue, 17 Dec 2024 11:47:03 +0100 Subject: [PATCH 11/13] Fix tests regarding outdated error expectations --- tests/Idoit/APIClient/APITest.php | 10 +++++----- tests/Idoit/APIClient/BaseTest.php | 10 ++-------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/Idoit/APIClient/APITest.php b/tests/Idoit/APIClient/APITest.php index 2ca3aea..b9adb5c 100644 --- a/tests/Idoit/APIClient/APITest.php +++ b/tests/Idoit/APIClient/APITest.php @@ -327,7 +327,7 @@ public function testInvalidBatchRequest($request) { foreach ($response as $result) { $this->isError($result); $this->assertNull($result['id']); - $this->assertSame(-32600, $result['error']['code']); + $this->assertSame(-32604, $result['error']['code']); // <-- Previously 'Invalid request' -32600 } } @@ -347,7 +347,7 @@ public function testRequestWithMissingParameters() { $this->assertIsArray($response); $this->isError($response); $this->hasValidJSONRPCIdentifier($request, $response); - $this->assertSame(-32602, $response['error']['code']); + $this->assertSame(-32604, $response['error']['code']); // <-- Previously 'Invalid params' -32602 } /** @@ -385,7 +385,7 @@ public function testRequestWithInvalidParameters($parameters) { $this->assertIsArray($response); $this->isError($response); $this->hasValidJSONRPCIdentifier($request, $response); - $this->assertSame(-32602, $response['error']['code']); + $this->assertSame(-32604, $response['error']['code']); // <-- Previously 'Invalid params' -32602 } /** @@ -406,7 +406,7 @@ public function testRequestWithMissingApiKey() { $this->assertIsArray($response); $this->isError($response); $this->hasValidJSONRPCIdentifier($request, $response); - $this->assertSame(-32099, $response['error']['code']); + $this->assertSame(-32604, $response['error']['code']); // <-- Previously 'System error' -32099 } /** @@ -449,7 +449,7 @@ public function testRequestWithInvalidApiKeys($apiKey) { $this->assertIsArray($response); $this->isError($response); $this->hasValidJSONRPCIdentifier($request, $response); - $this->assertSame(-32099, $response['error']['code']); + $this->assertSame(-32604, $response['error']['code']); // <-- Previously 'System error' -32099 } /** diff --git a/tests/Idoit/APIClient/BaseTest.php b/tests/Idoit/APIClient/BaseTest.php index 7e52546..8e7d89f 100644 --- a/tests/Idoit/APIClient/BaseTest.php +++ b/tests/Idoit/APIClient/BaseTest.php @@ -741,14 +741,8 @@ protected function isIDAsString(string $value) { protected function isConstant(string $value) { $this->assertNotEmpty($value); - // @todo Remove this method switch if PHPunit >= v9 is in use: - if (method_exists($this, 'assertMatchesRegularExpression')) { - $this->assertMatchesRegularExpression('/([A-Z0-9_]+)/', $value); - $this->assertMatchesRegularExpression('/^([A-Z]+)/', $value); - } else { - $this->assertRegExp('/([A-Z0-9_]+)/', $value); - $this->assertRegExp('/^([A-Z]+)/', $value); - } + $this->assertMatchesRegularExpression('/([A-Z0-9_]+)/', $value); + $this->assertMatchesRegularExpression('/^([A-Z]+)/', $value); } protected function isValidResponse(array $response, array $request) { From f3a0e48ed432da5f0a9c0081401b3bffccebd96b Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Tue, 17 Dec 2024 12:44:24 +0100 Subject: [PATCH 12/13] Reduce compatibility to ^8.0 - ^8.3 --- composer.json | 2 +- composer.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 699f591..c925f77 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "source": "https://github.com/i-doit/api-client-php" }, "require": { - "php": "^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4", + "php": "^8.0 || ^8.1 || ^8.2 || ^8.3", "ext-curl": "*", "ext-date": "*", "ext-json": "*", diff --git a/composer.lock b/composer.lock index 47ea43d..fb692fc 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": "b20d33b70b702c59c335eec112291a92", + "content-hash": "2349020d74a0d1cb40b3ba5b72ac40fe", "packages": [], "packages-dev": [ { @@ -6195,7 +6195,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4", + "php": "^8.0 || ^8.1 || ^8.2 || ^8.3", "ext-curl": "*", "ext-date": "*", "ext-json": "*", From 0cccef94d2b8eb32fbbdf030908b631be443ac6e Mon Sep 17 00:00:00 2001 From: Leonard Fischer Date: Tue, 17 Dec 2024 13:03:03 +0100 Subject: [PATCH 13/13] Improve parameters for newer 'save' action --- src/CMDBCategory.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CMDBCategory.php b/src/CMDBCategory.php index dd256da..73d2518 100644 --- a/src/CMDBCategory.php +++ b/src/CMDBCategory.php @@ -94,7 +94,7 @@ public function save(int $objectID, string $categoryConstant, array $attributes, */ public function create(int $objectID, string $categoryConst, array $attributes): int { $params = [ - 'objID' => $objectID, + 'object' => $objectID, 'data' => $attributes, 'category' => $categoryConst ]; @@ -219,7 +219,7 @@ public function update(int $objectID, string $categoryConst, array $attributes, $result = $this->api->request( 'cmdb.category.save', [ - 'objID' => $objectID, + 'object' => $objectID, 'category' => $categoryConst, 'data' => $attributes ] @@ -376,7 +376,7 @@ public function batchCreate(array $objectIDs, string $categoryConst, array $attr foreach ($objectIDs as $objectID) { foreach ($attributes as $data) { $params = [ - 'objID' => $objectID, + 'object' => $objectID, 'data' => $data, 'category' => $categoryConst ]; @@ -495,7 +495,7 @@ public function batchUpdate(array $objectIDs, string $categoryConst, array $attr $requests[] = [ 'method' => 'cmdb.category.save', 'params' => [ - 'objID' => $objectID, + 'object' => $objectID, 'category' => $categoryConst, 'data' => $attributes ]