diff --git a/clients/algoliasearch-client-php/composer.lock b/clients/algoliasearch-client-php/composer.lock index 0b10e25936..4b51a97760 100644 --- a/clients/algoliasearch-client-php/composer.lock +++ b/clients/algoliasearch-client-php/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8261da964bb108cdd9083509275bc94b", + "content-hash": "e7b0018bc5db5ae88dee804a6da3dda0", "packages": [ { "name": "guzzlehttp/psr7", - "version": "2.6.2", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", "shasum": "" }, "require": { @@ -32,8 +32,8 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -104,7 +104,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.6.2" + "source": "https://github.com/guzzle/psr7/tree/2.7.0" }, "funding": [ { @@ -120,7 +120,7 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:05:35+00:00" + "time": "2024-07-18T11:15:46+00:00" }, { "name": "psr/http-factory", @@ -232,16 +232,16 @@ }, { "name": "psr/log", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "79dff0b268932c640297f5208d6298f71855c03e" }, "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/79dff0b268932c640297f5208d6298f71855c03e", + "reference": "79dff0b268932c640297f5208d6298f71855c03e", "shasum": "" }, "require": { @@ -276,9 +276,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.1" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-08-21T13:31:24+00:00" }, { "name": "psr/simple-cache", @@ -443,30 +443,38 @@ }, { "name": "composer/pcre", - "version": "3.1.4", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "04229f163664973f68f38f6f73d917799168ef24" + "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/04229f163664973f68f38f6f73d917799168ef24", - "reference": "04229f163664973f68f38f6f73d917799168ef24", + "url": "https://api.github.com/repos/composer/pcre/zipball/63aaeac21d7e775ff9bc9d45021e1745c97521c4", + "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, "require-dev": { - "phpstan/phpstan": "^1.3", + "phpstan/phpstan": "^1.11.10", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" + "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { "branch-alias": { "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] } }, "autoload": { @@ -494,7 +502,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.4" + "source": "https://github.com/composer/pcre/tree/3.3.1" }, "funding": [ { @@ -510,20 +518,20 @@ "type": "tidelift" } ], - "time": "2024-05-27T13:40:54+00:00" + "time": "2024-08-27T18:44:43+00:00" }, { "name": "composer/semver", - "version": "3.4.0", + "version": "3.4.2", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", + "url": "https://api.github.com/repos/composer/semver/zipball/c51258e759afdb17f1fd1fe83bc12baaef6309d6", + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6", "shasum": "" }, "require": { @@ -575,7 +583,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.0" + "source": "https://github.com/composer/semver/tree/3.4.2" }, "funding": [ { @@ -591,7 +599,7 @@ "type": "tidelift" } ], - "time": "2023-08-31T09:50:34+00:00" + "time": "2024-07-12T11:35:52+00:00" }, { "name": "composer/xdebug-handler", @@ -708,16 +716,16 @@ }, { "name": "fidry/cpu-core-counter", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42" + "reference": "8520451a140d3f46ac33042715115e290cf5785f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/f92996c4d5c1a696a6a970e20f7c4216200fcc42", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/8520451a140d3f46ac33042715115e290cf5785f", + "reference": "8520451a140d3f46ac33042715115e290cf5785f", "shasum": "" }, "require": { @@ -757,7 +765,7 @@ ], "support": { "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/1.1.0" + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.2.0" }, "funding": [ { @@ -765,20 +773,20 @@ "type": "github" } ], - "time": "2024-02-07T09:43:46+00:00" + "time": "2024-08-06T10:04:20+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.59.3", + "version": "v3.64.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29" + "reference": "58dd9c931c785a79739310aef5178928305ffa67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/30ba9ecc2b0e5205e578fe29973c15653d9bfd29", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/58dd9c931c785a79739310aef5178928305ffa67", + "reference": "58dd9c931c785a79739310aef5178928305ffa67", "shasum": "" }, "require": { @@ -860,7 +868,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.59.3" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.64.0" }, "funding": [ { @@ -868,28 +876,28 @@ "type": "github" } ], - "time": "2024-06-16T14:17:03+00:00" + "time": "2024-08-30T23:09:38+00:00" }, { "name": "graham-campbell/result-type", - "version": "v1.1.2", + "version": "v1.1.3", "source": { "type": "git", "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862" + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/fbd48bce38f73f8a4ec8583362e732e4095e5862", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2" + "phpoption/phpoption": "^1.9.3" }, "require-dev": { - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" }, "type": "library", "autoload": { @@ -918,7 +926,7 @@ ], "support": { "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.2" + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3" }, "funding": [ { @@ -930,7 +938,7 @@ "type": "tidelift" } ], - "time": "2023-11-12T22:16:48+00:00" + "time": "2024-07-20T21:45:45+00:00" }, { "name": "myclabs/deep-copy", @@ -1170,16 +1178,16 @@ }, { "name": "phpoption/phpoption", - "version": "1.9.2", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820" + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/80735db690fe4fc5c76dfa7f9b770634285fa820", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", "shasum": "" }, "require": { @@ -1187,13 +1195,13 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" }, "type": "library", "extra": { "bamarni-bin": { "bin-links": true, - "forward-command": true + "forward-command": false }, "branch-alias": { "dev-master": "1.9-dev" @@ -1229,7 +1237,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.2" + "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" }, "funding": [ { @@ -1241,36 +1249,94 @@ "type": "tidelift" } ], - "time": "2023-11-12T21:59:55+00:00" + "time": "2024-07-20T21:41:07+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "1.12.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "shasum": "" + }, + "require": { + "php": "^7.2|^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": "2024-09-03T19:55:22+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "11.0.5", + "version": "11.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "19b6365ab8b59a64438c0c3f4241feeb480c9861" + "reference": "ebdffc9e09585dafa71b9bffcdb0a229d4704c45" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/19b6365ab8b59a64438c0c3f4241feeb480c9861", - "reference": "19b6365ab8b59a64438c0c3f4241feeb480c9861", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ebdffc9e09585dafa71b9bffcdb0a229d4704c45", + "reference": "ebdffc9e09585dafa71b9bffcdb0a229d4704c45", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^5.0", + "nikic/php-parser": "^5.1.0", "php": ">=8.2", - "phpunit/php-file-iterator": "^5.0", - "phpunit/php-text-template": "^4.0", - "sebastian/code-unit-reverse-lookup": "^4.0", - "sebastian/complexity": "^4.0", - "sebastian/environment": "^7.0", - "sebastian/lines-of-code": "^3.0", - "sebastian/version": "^5.0", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "sebastian/code-unit-reverse-lookup": "^4.0.1", + "sebastian/complexity": "^4.0.1", + "sebastian/environment": "^7.2.0", + "sebastian/lines-of-code": "^3.0.1", + "sebastian/version": "^5.0.1", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { "phpunit/phpunit": "^11.0" @@ -1282,7 +1348,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.0-dev" + "dev-main": "11.0.x-dev" } }, "autoload": { @@ -1311,7 +1377,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.5" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.6" }, "funding": [ { @@ -1319,20 +1385,20 @@ "type": "github" } ], - "time": "2024-07-03T05:05:37+00:00" + "time": "2024-08-22T04:37:56+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "5.0.1", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6ed896bf50bbbfe4d504a33ed5886278c78e4a26" + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6ed896bf50bbbfe4d504a33ed5886278c78e4a26", - "reference": "6ed896bf50bbbfe4d504a33ed5886278c78e4a26", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", "shasum": "" }, "require": { @@ -1372,7 +1438,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" }, "funding": [ { @@ -1380,7 +1446,7 @@ "type": "github" } ], - "time": "2024-07-03T05:06:37+00:00" + "time": "2024-08-27T05:02:59+00:00" }, { "name": "phpunit/php-invoker", @@ -1568,16 +1634,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.2.6", + "version": "11.3.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1dc0fedac703199e8704de085e47dd46bac0dde4" + "reference": "8ed08766d9a2ed979a2f5fdbb95a0671523419c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1dc0fedac703199e8704de085e47dd46bac0dde4", - "reference": "1dc0fedac703199e8704de085e47dd46bac0dde4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8ed08766d9a2ed979a2f5fdbb95a0671523419c1", + "reference": "8ed08766d9a2ed979a2f5fdbb95a0671523419c1", "shasum": "" }, "require": { @@ -1587,25 +1653,25 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=8.2", - "phpunit/php-code-coverage": "^11.0", - "phpunit/php-file-iterator": "^5.0", - "phpunit/php-invoker": "^5.0", - "phpunit/php-text-template": "^4.0", - "phpunit/php-timer": "^7.0", - "sebastian/cli-parser": "^3.0", - "sebastian/code-unit": "^3.0", - "sebastian/comparator": "^6.0", - "sebastian/diff": "^6.0", - "sebastian/environment": "^7.0", - "sebastian/exporter": "^6.1.2", - "sebastian/global-state": "^7.0", - "sebastian/object-enumerator": "^6.0", - "sebastian/type": "^5.0", - "sebastian/version": "^5.0" + "phpunit/php-code-coverage": "^11.0.6", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.1", + "sebastian/comparator": "^6.0.2", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.0", + "sebastian/exporter": "^6.1.3", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/type": "^5.0.1", + "sebastian/version": "^5.0.1" }, "suggest": { "ext-soap": "To be able to generate mocks based on WSDL files" @@ -1616,7 +1682,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.2-dev" + "dev-main": "11.3-dev" } }, "autoload": { @@ -1648,7 +1714,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.6" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.3.3" }, "funding": [ { @@ -1664,7 +1730,7 @@ "type": "tidelift" } ], - "time": "2024-07-03T05:51:49+00:00" + "time": "2024-09-04T13:34:52+00:00" }, { "name": "psr/container", @@ -2143,31 +2209,31 @@ }, { "name": "react/socket", - "version": "v1.15.0", + "version": "v1.16.0", "source": { "type": "git", "url": "https://github.com/reactphp/socket.git", - "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038" + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/socket/zipball/216d3aec0b87f04a40ca04f481e6af01bdd1d038", - "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", "shasum": "" }, "require": { "evenement/evenement": "^3.0 || ^2.0 || ^1.0", "php": ">=5.3.0", - "react/dns": "^1.11", + "react/dns": "^1.13", "react/event-loop": "^1.2", - "react/promise": "^3 || ^2.6 || ^1.2.1", - "react/stream": "^1.2" + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" }, "require-dev": { "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", - "react/async": "^4 || ^3 || ^2", + "react/async": "^4.3 || ^3.3 || ^2", "react/promise-stream": "^1.4", - "react/promise-timer": "^1.10" + "react/promise-timer": "^1.11" }, "type": "library", "autoload": { @@ -2211,7 +2277,7 @@ ], "support": { "issues": "https://github.com/reactphp/socket/issues", - "source": "https://github.com/reactphp/socket/tree/v1.15.0" + "source": "https://github.com/reactphp/socket/tree/v1.16.0" }, "funding": [ { @@ -2219,7 +2285,7 @@ "type": "open_collective" } ], - "time": "2023-12-15T11:02:10+00:00" + "time": "2024-07-26T10:38:09+00:00" }, { "name": "react/stream", @@ -2471,16 +2537,16 @@ }, { "name": "sebastian/comparator", - "version": "6.0.1", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "131942b86d3587291067a94f295498ab6ac79c20" + "reference": "450d8f237bd611c45b5acf0733ce43e6bb280f81" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/131942b86d3587291067a94f295498ab6ac79c20", - "reference": "131942b86d3587291067a94f295498ab6ac79c20", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/450d8f237bd611c45b5acf0733ce43e6bb280f81", + "reference": "450d8f237bd611c45b5acf0733ce43e6bb280f81", "shasum": "" }, "require": { @@ -2536,7 +2602,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/comparator/tree/6.0.2" }, "funding": [ { @@ -2544,7 +2610,7 @@ "type": "github" } ], - "time": "2024-07-03T04:48:07+00:00" + "time": "2024-08-12T06:07:25+00:00" }, { "name": "sebastian/complexity", @@ -3224,16 +3290,16 @@ }, { "name": "symfony/console", - "version": "v7.1.2", + "version": "v7.1.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0aa29ca177f432ab68533432db0de059f39c92ae" + "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0aa29ca177f432ab68533432db0de059f39c92ae", - "reference": "0aa29ca177f432ab68533432db0de059f39c92ae", + "url": "https://api.github.com/repos/symfony/console/zipball/1eed7af6961d763e7832e874d7f9b21c3ea9c111", + "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111", "shasum": "" }, "require": { @@ -3297,7 +3363,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.2" + "source": "https://github.com/symfony/console/tree/v7.1.4" }, "funding": [ { @@ -3313,7 +3379,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T10:03:55+00:00" + "time": "2024-08-15T22:48:53+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3606,16 +3672,16 @@ }, { "name": "symfony/finder", - "version": "v7.1.1", + "version": "v7.1.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6" + "reference": "d95bbf319f7d052082fb7af147e0f835a695e823" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/fbb0ba67688b780efbc886c1a0a0948dcf7205d6", - "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6", + "url": "https://api.github.com/repos/symfony/finder/zipball/d95bbf319f7d052082fb7af147e0f835a695e823", + "reference": "d95bbf319f7d052082fb7af147e0f835a695e823", "shasum": "" }, "require": { @@ -3650,7 +3716,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.1.1" + "source": "https://github.com/symfony/finder/tree/v7.1.4" }, "funding": [ { @@ -3666,7 +3732,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-08-13T14:28:19+00:00" }, { "name": "symfony/options-resolver", @@ -4211,16 +4277,16 @@ }, { "name": "symfony/process", - "version": "v7.1.1", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "febf90124323a093c7ee06fdb30e765ca3c20028" + "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/febf90124323a093c7ee06fdb30e765ca3c20028", - "reference": "febf90124323a093c7ee06fdb30e765ca3c20028", + "url": "https://api.github.com/repos/symfony/process/zipball/7f2f542c668ad6c313dc4a5e9c3321f733197eca", + "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca", "shasum": "" }, "require": { @@ -4252,7 +4318,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.1" + "source": "https://github.com/symfony/process/tree/v7.1.3" }, "funding": [ { @@ -4268,7 +4334,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-07-26T12:44:47+00:00" }, { "name": "symfony/service-contracts", @@ -4417,16 +4483,16 @@ }, { "name": "symfony/string", - "version": "v7.1.2", + "version": "v7.1.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8" + "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/14221089ac66cf82e3cf3d1c1da65de305587ff8", - "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8", + "url": "https://api.github.com/repos/symfony/string/zipball/6cd670a6d968eaeb1c77c2e76091c45c56bc367b", + "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b", "shasum": "" }, "require": { @@ -4484,7 +4550,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.2" + "source": "https://github.com/symfony/string/tree/v7.1.4" }, "funding": [ { @@ -4500,7 +4566,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T09:27:18+00:00" + "time": "2024-08-12T09:59:40+00:00" }, { "name": "theseer/tokenizer", @@ -4554,23 +4620,23 @@ }, { "name": "vlucas/phpdotenv", - "version": "v5.6.0", + "version": "v5.6.1", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4" + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2", "shasum": "" }, "require": { "ext-pcre": "*", - "graham-campbell/result-type": "^1.1.2", + "graham-campbell/result-type": "^1.1.3", "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2", + "phpoption/phpoption": "^1.9.3", "symfony/polyfill-ctype": "^1.24", "symfony/polyfill-mbstring": "^1.24", "symfony/polyfill-php80": "^1.24" @@ -4587,7 +4653,7 @@ "extra": { "bamarni-bin": { "bin-links": true, - "forward-command": true + "forward-command": false }, "branch-alias": { "dev-master": "5.6-dev" @@ -4622,7 +4688,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.0" + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1" }, "funding": [ { @@ -4634,7 +4700,7 @@ "type": "tidelift" } ], - "time": "2023-11-12T22:43:29+00:00" + "time": "2024-07-20T21:52:34+00:00" } ], "aliases": [], diff --git a/clients/algoliasearch-client-php/lib/ApiException.php b/clients/algoliasearch-client-php/lib/ApiException.php index bdc0e41fbc..c88c57de78 100644 --- a/clients/algoliasearch-client-php/lib/ApiException.php +++ b/clients/algoliasearch-client-php/lib/ApiException.php @@ -1,7 +1,5 @@ hwm = $hwm; } - public function __toString() + public function __toString(): string { return $this->getContents(); } - public function getContents() + public function getContents(): string { $buffer = $this->buffer; $this->buffer = ''; @@ -45,52 +45,52 @@ public function getContents() return $buffer; } - public function close() + public function close(): void { $this->buffer = ''; } - public function detach() + public function detach(): void { $this->close(); } - public function getSize() + public function getSize(): int { return mb_strlen($this->buffer); } - public function isReadable() + public function isReadable(): bool { return true; } - public function isWritable() + public function isWritable(): bool { return true; } - public function isSeekable() + public function isSeekable(): bool { return false; } - public function rewind() + public function rewind(): void { $this->seek(0); } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { throw new \RuntimeException('Cannot seek a BufferStream'); } - public function eof() + public function eof(): bool { return 0 === mb_strlen($this->buffer); } - public function tell() + public function tell(): int { throw new \RuntimeException('Cannot determine the position of a BufferStream'); } @@ -100,7 +100,7 @@ public function tell() * * @param mixed $length */ - public function read($length) + public function read($length): string { $currentLength = mb_strlen($this->buffer); @@ -122,7 +122,7 @@ public function read($length) * * @param mixed $string */ - public function write($string) + public function write($string): int { $this->buffer .= $string; diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php b/clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php index 541eec189e..c2846553e9 100644 --- a/clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php +++ b/clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php @@ -53,7 +53,7 @@ public function __construct(callable $source, array $options = []) $this->buffer = new BufferStream(); } - public function __toString() + public function __toString(): string { try { return copy_to_string($this); @@ -62,63 +62,63 @@ public function __toString() } } - public function close() + public function close(): void { $this->detach(); } - public function detach() + public function detach(): void { $this->tellPos = false; $this->source = null; } - public function getSize() + public function getSize(): ?int { return $this->size; } - public function tell() + public function tell(): int { return $this->tellPos; } - public function eof() + public function eof(): bool { return !$this->source; } - public function isSeekable() + public function isSeekable(): bool { return false; } - public function rewind() + public function rewind(): void { $this->seek(0); } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { throw new \RuntimeException('Cannot seek a PumpStream'); } - public function isWritable() + public function isWritable(): bool { return false; } - public function write($string) + public function write($string): int { throw new \RuntimeException('Cannot write to a PumpStream'); } - public function isReadable() + public function isReadable(): bool { return true; } - public function read($length) + public function read($length): string { $data = $this->buffer->read($length); $readLen = mb_strlen($data); @@ -134,7 +134,7 @@ public function read($length) return $data; } - public function getContents() + public function getContents(): string { $result = ''; while (!$this->eof()) { diff --git a/templates/php/ModelInterface.mustache b/clients/algoliasearch-client-php/lib/Model/ModelInterface.php similarity index 84% rename from templates/php/ModelInterface.mustache rename to clients/algoliasearch-client-php/lib/Model/ModelInterface.php index 5739c3b800..35eccec88e 100644 --- a/templates/php/ModelInterface.mustache +++ b/clients/algoliasearch-client-php/lib/Model/ModelInterface.php @@ -1,39 +1,35 @@ getRealPath(); - } - - return self::toString($value); - } - /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged diff --git a/clients/algoliasearch-client-php/phpstan.neon b/clients/algoliasearch-client-php/phpstan.neon new file mode 100644 index 0000000000..b1878ecde3 --- /dev/null +++ b/clients/algoliasearch-client-php/phpstan.neon @@ -0,0 +1,4 @@ +parameters: + excludePaths: + - vendor/* + level: max diff --git a/config/generation.config.mjs b/config/generation.config.mjs index c5dade82c2..f87c4052ce 100644 --- a/config/generation.config.mjs +++ b/config/generation.config.mjs @@ -99,10 +99,10 @@ export const patterns = [ 'clients/algoliasearch-client-php/lib/Api/*', 'clients/algoliasearch-client-php/lib/Model/**', '!clients/algoliasearch-client-php/lib/Model/AbstractModel.php', + '!clients/algoliasearch-client-php/lib/Model/ModelInterface.php', 'clients/algoliasearch-client-php/lib/Configuration/*', - 'clients/algoliasearch-client-php/lib/ApiException.php', - 'clients/algoliasearch-client-php/lib/ObjectSerializer.php', - 'clients/algoliasearch-client-php/lib/Algolia.php', + '!clients/algoliasearch-client-php/lib/Configuration/Configuration.php', + '!clients/algoliasearch-client-php/lib/Configuration/ConfigWithRegion.php', 'clients/algoliasearch-client-php/composer.json', // Python diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaPhpGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaPhpGenerator.java index c0e9e15831..ff25805b47 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaPhpGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaPhpGenerator.java @@ -44,9 +44,9 @@ public void processOpts() { supportingFiles.removeIf(file -> file.getTemplateFile().equals(".php-cs-fixer.dist.php")); supportingFiles.removeIf(file -> file.getTemplateFile().equals("phpunit.xml.mustache")); supportingFiles.removeIf(file -> file.getTemplateFile().equals("AbstractModel.php")); - - supportingFiles.add(new SupportingFile("Configuration.mustache", "lib/Configuration", "Configuration.php")); - supportingFiles.add(new SupportingFile("ConfigWithRegion.mustache", "lib/Configuration", "ConfigWithRegion.php")); + supportingFiles.removeIf(file -> file.getTemplateFile().equals("ApiException.mustache")); + supportingFiles.removeIf(file -> file.getTemplateFile().equals("ObjectSerializer.mustache")); + supportingFiles.removeIf(file -> file.getTemplateFile().equals("ModelInterface.mustache")); supportingFiles.add(new SupportingFile("client_config.mustache", "lib/Configuration", getClientName(client) + "Config.php")); supportingFiles.add(new SupportingFile("Algolia.mustache", "lib", "Algolia.php")); diff --git a/scripts/buildClients.ts b/scripts/buildClients.ts index e27850a342..0653d62724 100644 --- a/scripts/buildClients.ts +++ b/scripts/buildClients.ts @@ -32,6 +32,13 @@ async function buildLanguage(language: Language, gens: Generator[], buildType: B case 'kotlin': await run(`./gradle/gradlew -p ${cwd} assemble`, { language }); break; + case 'php': + // await runComposerInstall(); + // await run( + // `clients/algoliasearch-client-php/vendor/bin/phpstan analyse --memory-limit 512M -c clients/algoliasearch-client-php/phpstan.neon ${cwd}`, + // { language }, + // ); + break; case 'python': // there is no type checking for the playground or snippets if (buildType === 'client') { diff --git a/scripts/cli/index.ts b/scripts/cli/index.ts index 2e8939f3b6..3da8c8311b 100644 --- a/scripts/cli/index.ts +++ b/scripts/cli/index.ts @@ -3,6 +3,7 @@ import semver from 'semver'; import { buildClients, buildPlaygrounds, buildSnippets } from '../buildClients.js'; import { CI, CLIENTS, LANGUAGES, run, setVerbose } from '../common.js'; +import { getLanguageFolder } from '../config.js'; import { ctsGenerateMany } from '../cts/generate.js'; import { runCts } from '../cts/runCts.js'; import { startTestServer } from '../cts/testServer'; @@ -283,9 +284,10 @@ program .description('Executes a command inside the correct docker image') .addArgument(args.requiredLanguage) .argument('command...', 'The command to execute') - .action(async (language: Language, command: string[]) => { + .option('-c, --client', "Run the command in the client's folder") + .action(async (language: Language, command: string[], { client }) => { setVerbose(true); - await run(command.join(' '), { language }); + await run(command.join(' '), { language, cwd: client ? getLanguageFolder(language) : undefined }); }); program.parse(); diff --git a/templates/php/ApiException.mustache b/templates/php/ApiException.mustache deleted file mode 100644 index 1056167258..0000000000 --- a/templates/php/ApiException.mustache +++ /dev/null @@ -1,95 +0,0 @@ -responseHeaders = $responseHeaders; - $this->responseBody = $responseBody; - } - - /** - * Gets the HTTP response header - * - * @return string[]|null HTTP response header - */ - public function getResponseHeaders() - { - return $this->responseHeaders; - } - - /** - * Gets the HTTP body of the server response either as Json or string - * - * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string - */ - public function getResponseBody() - { - return $this->responseBody; - } - - /** - * Sets the deserialized response object (during deserialization) - * - * @param mixed $obj Deserialized response object - * - * @return void - */ - public function setResponseObject($obj) - { - $this->responseObject = $obj; - } - - /** - * Gets the deserialized response object (during deserialization) - * - * @return mixed the deserialized response object - */ - public function getResponseObject() - { - return $this->responseObject; - } -} diff --git a/templates/php/ConfigWithRegion.mustache b/templates/php/ConfigWithRegion.mustache deleted file mode 100644 index 238a765fb5..0000000000 --- a/templates/php/ConfigWithRegion.mustache +++ /dev/null @@ -1,26 +0,0 @@ - $appId, - 'apiKey' => $apiKey, - 'region' => $region, - ]; - - return new static($config); - } - - public function getRegion() - { - return $this->config['region']; - } -} diff --git a/templates/php/Configuration.mustache b/templates/php/Configuration.mustache deleted file mode 100644 index eede8c89e8..0000000000 --- a/templates/php/Configuration.mustache +++ /dev/null @@ -1,314 +0,0 @@ -setAlgoliaApiKey($config['apiKey']); - $this->setAuth('x-algolia-api-key', $config['apiKey']); - - $this->setAppId($config['appId']); - $this->setAuth('x-algolia-application-id', $config['appId']); - - $config += $this->getDefaultConfiguration(); - $this->config = $config; - } - - public static function create($appId, $apiKey) - { - $config = [ - 'appId' => $appId, - 'apiKey' => $apiKey, - ]; - - return new static($config); - } - - /** - * Sets Auth - * - * @param string $authIdentifier API key identifier (authentication scheme) - * @param string $key API key or token - * - * @return $this - */ - public function setAuth($authIdentifier, $key) - { - $this->auths[$authIdentifier] = $key; - return $this; - } - - /** - * Gets Auth - * - * @param string $authIdentifier Auth identifier (authentication scheme) - * - * @return null|string API key or token - */ - public function getAuth($authIdentifier) - { - return isset($this->auths[$authIdentifier]) ? $this->auths[$authIdentifier] : null; - } - - /** - * Sets debug flag - * - * @param bool $debug Debug flag - * - * @return $this - */ - public function setDebug($debug) - { - $this->debug = $debug; - return $this; - } - - /** - * Gets the debug flag - * - * @return bool - */ - public function getDebug() - { - return $this->debug; - } - - /** - * Sets the debug file - * - * @param string $debugFile Debug file - * - * @return $this - */ - public function setDebugFile($debugFile) - { - $this->debugFile = $debugFile; - return $this; - } - - /** - * Gets the debug file - * - * @return string - */ - public function getDebugFile() - { - return $this->debugFile; - } - - public function getDefaultConfiguration() - { - return [ - 'appId' => '', - 'apiKey' => '', - 'hosts' => null, - 'hasFullHosts' => false, - 'readTimeout' => $this->defaultReadTimeout, - 'writeTimeout' => $this->defaultWriteTimeout, - 'connectTimeout' => $this->defaultConnectTimeout, - 'defaultHeaders' => [], - ]; - } - - public function getAppId() - { - return $this->config['appId']; - } - - public function setAppId($appId) - { - $this->config['appId'] = $appId; - - return $this; - } - - public function getAlgoliaApiKey() - { - return $this->config['apiKey']; - } - - public function setAlgoliaApiKey($apiKey) - { - $this->config['apiKey'] = $apiKey; - - return $this; - } - - public function getHosts() - { - return $this->config['hosts']; - } - - public function setHosts($hosts) - { - $this->config['hosts'] = $hosts; - - return $this; - } - - public function setFullHosts($hosts) - { - $this->config['hasFullHosts'] = true; - - return $this->setHosts($hosts); - } - - public function getHasFullHosts() - { - return $this->config['hasFullHosts']; - } - - public function getReadTimeout() - { - return $this->config['readTimeout']; - } - - public function setReadTimeout($readTimeout) - { - $this->config['readTimeout'] = $readTimeout; - - return $this; - } - - public function getWriteTimeout() - { - return $this->config['writeTimeout']; - } - - public function setWriteTimeout($writeTimeout) - { - $this->config['writeTimeout'] = $writeTimeout; - - return $this; - } - - public function getConnectTimeout() - { - return $this->config['connectTimeout']; - } - - public function setConnectTimeout($connectTimeout) - { - $this->config['connectTimeout'] = $connectTimeout; - - return $this; - } - - public function getDefaultHeaders() - { - return $this->config['defaultHeaders']; - } - - public function setDefaultHeaders(array $defaultHeaders) - { - $this->config['defaultHeaders'] = $defaultHeaders; - - return $this; - } - - /** - * Sets the user agent of the api client - * - * @param string $algoliaAgent the user agent of the api client - * - * @throws \InvalidArgumentException - * - * @return $this - */ - public function setAlgoliaAgent($algoliaAgent) - { - if (!is_string($algoliaAgent)) { - throw new \InvalidArgumentException('User-agent must be a string.'); - } - - $this->algoliaAgent = $algoliaAgent; - - return $this; - } - - /** - * Gets the user agent of the api client - * - * @return string user agent - */ - public function getAlgoliaAgent() - { - return $this->algoliaAgent; - } - - /** - * Gets the name of the client which the config belongs to - * - * @return string client name - */ - public function getClientName() - { - return $this->clientName; - } -} diff --git a/templates/php/ObjectSerializer.mustache b/templates/php/ObjectSerializer.mustache deleted file mode 100644 index 0ef306068a..0000000000 --- a/templates/php/ObjectSerializer.mustache +++ /dev/null @@ -1,341 +0,0 @@ -format('Y-m-d') : $data->format(self::$dateTimeFormat); - } - - if (is_array($data)) { - foreach ($data as $property => $value) { - $data[$property] = self::sanitizeForSerialization($value); - } - return $data; - } - - if (is_object($data)) { - $values = []; - if ($data instanceof ModelInterface) { - $formats = $data::modelFormats(); - foreach ($data::modelTypes() as $property => $modelTypes) { - $getter = $data::getters()[$property]; - $value = $data->$getter(); - if ($value !== null && !in_array($modelTypes, [{{{primitives}}}], true)) { - $callable = [$modelTypes, 'getAllowableEnumValues']; - if (is_callable($callable)) { - /** array $callable */ - $allowedEnumTypes = $callable(); - if (!in_array($value, $allowedEnumTypes, true)) { - $imploded = implode("', '", $allowedEnumTypes); - throw new \InvalidArgumentException("Invalid value for enum '$modelTypes', must be one of: '$imploded'"); - } - } - } - if ($value !== null) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $modelTypes, $formats[$property]); - } - } - } else { - foreach($data as $property => $value) { - $values[$property] = self::sanitizeForSerialization($value); - } - } - return (object)$values; - } else { - return (string)$data; - } - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param string $filename filename to be sanitized - * - * @return string the sanitized filename - */ - public static function sanitizeFilename($filename) - { - if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { - return $match[1]; - } else { - return $filename; - } - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the path, by url-encoding. - * - * @param string $value a string which will be part of the path - * - * @return string the serialized object - */ - public static function toPathValue($value) - { - return rawurlencode(self::toString($value)); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the query, by imploding comma-separated if it's an object. - * If it's a string, pass through unchanged. It will be url-encoded - * later. - * - * @param string[]|string|\DateTime $object an object to be serialized to a string - * - * @return string the serialized object - */ - public static function toQueryValue($object) - { - if (is_array($object)) { - return implode(',', $object); - } else { - return self::toString($object); - } - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the header. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string $value a string which will be part of the header - * - * @return string the header string - */ - public static function toHeaderValue($value) - { - $callable = [$value, 'toHeaderValue']; - if (is_callable($callable)) { - return $callable(); - } - - return self::toString($value); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|\SplFileObject $value the value of the form parameter - * - * @return string the form string - */ - public static function toFormValue($value) - { - if ($value instanceof \SplFileObject) { - return $value->getRealPath(); - } else { - return self::toString($value); - } - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the parameter. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * If it's a boolean, convert it to "true" or "false". - * - * @param string|bool|\DateTime $value the value of the parameter - * - * @return string the header string - */ - public static function toString($value) - { - if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(self::$dateTimeFormat); - } elseif (is_bool($value)) { - return $value ? 'true' : 'false'; - } else { - return $value; - } - } - - /** - * Serialize an array to a string. - * - * @param array $collection collection to serialize to a string - * @param string $style the format use for serialization (csv, - * ssv, tsv, pipes, multi) - * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array - * - * @return string - */ - public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) - { - if ($allowCollectionFormatMulti && ('multi' === $style)) { - // http_build_query() almost does the job for us. We just - // need to fix the result of multidimensional arrays. - return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); - } - switch ($style) { - case 'pipeDelimited': - case 'pipes': - return implode('|', $collection); - - case 'tsv': - return implode("\t", $collection); - - case 'spaceDelimited': - case 'ssv': - return implode(' ', $collection); - - case 'simple': - case 'csv': - // Deliberate fall through. CSV is default format. - default: - return implode(',', $collection); - } - } - - /** - * Deserialize a JSON string into an object - * - * @param mixed $data object or primitive to be deserialized - * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used - * - * @return object|array|null a single or an array of $class instances - */ - public static function deserialize($data, $class, $httpHeaders = null) - { - if (null === $data) { - return null; - } - - if (strcasecmp(substr($class, -2), '[]') === 0) { - $data = is_string($data) ? json_decode($data) : $data; - - if (!is_array($data)) { - throw new \InvalidArgumentException("Invalid array '$class'"); - } - - $subClass = substr($class, 0, -2); - $values = []; - foreach ($data as $key => $value) { - $values[] = self::deserialize($value, $subClass, null); - } - return $values; - } - - if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array - $data = is_string($data) ? json_decode($data) : $data; - settype($data, 'array'); - $inner = substr($class, 4, -1); - $deserialized = []; - if (strrpos($inner, ",") !== false) { - $subClass_array = explode(',', $inner, 2); - $subClass = $subClass_array[1]; - foreach ($data as $key => $value) { - $deserialized[$key] = self::deserialize($value, $subClass, null); - } - } - return $deserialized; - } - - if ($class === 'object') { - settype($data, 'array'); - return $data; - } else if ($class === 'mixed') { - settype($data, gettype($data)); - return $data; - } - - if ($class === '\DateTime') { - // Some API's return an invalid, empty string as a - // date-time property. DateTime::__construct() will return - // the current time for empty input which is probably not - // what is meant. The invalid empty string is probably to - // be interpreted as a missing field/value. Let's handle - // this graceful. - if (!empty($data)) { - try { - return new \DateTime($data); - } catch (\Exception $exception) { - // Some API's return a date-time with too high nanosecond - // precision for php's DateTime to handle. This conversion - // (string -> unix timestamp -> DateTime) is a workaround - // for the problem. - return (new \DateTime())->setTimestamp(strtotime($data)); - } - } else { - return null; - } - } - - /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, [{{{primitives}}}], true)) { - settype($data, $class); - return $data; - } - - if (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues(), true)) { - $imploded = implode("', '", $class::getAllowableEnumValues()); - throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); - } - return $data; - } else { - $data = is_string($data) ? json_decode($data) : $data; - - /** @var ModelInterface $instance */ - $instance = new $class(); - foreach ($instance::modelTypes() as $property => $type) { - $propertySetter = $instance::setters()[$property]; - - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { - continue; - } - - if (isset($data->{$instance::attributeMap()[$property]})) { - $propertyValue = $data->{$instance::attributeMap()[$property]}; - $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); - } - } - return $instance; - } - } -} diff --git a/templates/php/composer.mustache b/templates/php/composer.mustache index 759570b216..1ea878a1d3 100644 --- a/templates/php/composer.mustache +++ b/templates/php/composer.mustache @@ -1,10 +1,6 @@ { - {{#composerPackageName}} - "name": "{{.}}", - {{/composerPackageName}} - {{#packageVersion}} - "version": "{{.}}", - {{/packageVersion}} + "name": "algolia/algoliasearch-client-php", + "version": "{{packageVersion}}", "description": "API powering the features of Algolia.", "keywords": [ "openapitools", @@ -36,17 +32,15 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^2.0 || ^3.5.0", "phpunit/phpunit": "^11.0", - "vlucas/phpdotenv": "^5.4" + "vlucas/phpdotenv": "^5.4", + "phpstan/phpstan": "^1.12" }, "autoload": { - "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" }, + "psr-4": { "Algolia\\AlgoliaSearch\\" : "lib/" }, "files": [ - "{{srcBasePath}}/Http/Psr7/functions.php" + "lib/Http/Psr7/functions.php" ] }, - "autoload-dev": { - "psr-4": { "{{escapedInvokerPackage}}\\Test\\" : "{{testBasePath}}/" } - }, "suggest": { "guzzlehttp/guzzle": "If you prefer to use Guzzle HTTP client instead of the Http Client implementation provided by the package" }, diff --git a/templates/php/model.mustache b/templates/php/model.mustache index 9e0fe1b1a2..17b93315c2 100644 --- a/templates/php/model.mustache +++ b/templates/php/model.mustache @@ -6,12 +6,10 @@ {{#model}} namespace {{modelPackage}}; -{{^isEnum}} -{{^parentSchema}} -{{/parentSchema}} -{{/isEnum}} -use \{{invokerPackage}}\ObjectSerializer; +use Algolia\AlgoliaSearch\ObjectSerializer; +use Algolia\AlgoliaSearch\Model\AbstractModel; +use Algolia\AlgoliaSearch\Model\ModelInterface; /** * {{classname}} Class Doc Comment diff --git a/templates/php/model_generic.mustache b/templates/php/model_generic.mustache index e20b3f100d..6ec9357d2e 100644 --- a/templates/php/model_generic.mustache +++ b/templates/php/model_generic.mustache @@ -1,4 +1,4 @@ -class {{classname}} extends \Algolia\AlgoliaSearch\Model\AbstractModel {{^parentSchema}}implements ModelInterface, \ArrayAccess, \JsonSerializable{{/parentSchema}} +class {{classname}} extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSerializable { /** * Array of property to type mappings. Used for (de)serialization @@ -39,7 +39,7 @@ class {{classname}} extends \Algolia\AlgoliaSearch\Model\AbstractModel {{^parent */ public static function attributeMap() { - return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap; + return self::$attributeMap; } /** @@ -49,7 +49,7 @@ class {{classname}} extends \Algolia\AlgoliaSearch\Model\AbstractModel {{^parent */ public static function modelTypes() { - return self::$modelTypes{{#parentSchema}} + parent::modelTypes(){{/parentSchema}}; + return self::$modelTypes; } /** @@ -59,7 +59,7 @@ class {{classname}} extends \Algolia\AlgoliaSearch\Model\AbstractModel {{^parent */ public static function modelFormats() { - return self::$modelFormats{{#parentSchema}} + parent::modelFormats(){{/parentSchema}}; + return self::$modelFormats; } /** @@ -89,7 +89,7 @@ class {{classname}} extends \Algolia\AlgoliaSearch\Model\AbstractModel {{^parent */ public static function setters() { - return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters; + return self::$setters; } /** @@ -99,7 +99,7 @@ class {{classname}} extends \Algolia\AlgoliaSearch\Model\AbstractModel {{^parent */ public static function getters() { - return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters; + return self::$getters; } {{#vars}} @@ -129,26 +129,20 @@ class {{classname}} extends \Algolia\AlgoliaSearch\Model\AbstractModel {{^parent {{/isEnum}} {{/vars}} - {{^parentSchema}} /** * Associative array for storing property values * * @var mixed[] */ protected $container = []; - {{/parentSchema}} /** * Constructor * * @param mixed[] $data Associated array of property values */ - public function __construct(array $data = null) + public function __construct({{#hasVars}}array $data = null{{/hasVars}}) { - {{#parentSchema}} - parent::__construct($data); - - {{/parentSchema}} {{#vars}} if (isset($data['{{name}}'])) { $this->container['{{name}}'] = $data['{{name}}']; @@ -163,12 +157,7 @@ class {{classname}} extends \Algolia\AlgoliaSearch\Model\AbstractModel {{^parent */ public function listInvalidProperties() { - {{#parentSchema}} - $invalidProperties = parent::listInvalidProperties(); - {{/parentSchema}} - {{^parentSchema}} $invalidProperties = []; - {{/parentSchema}} {{#vars}} {{#required}} diff --git a/templates/php/snippets/method.mustache b/templates/php/snippets/method.mustache index 5f41ebbe49..aba2278a51 100644 --- a/templates/php/snippets/method.mustache +++ b/templates/php/snippets/method.mustache @@ -17,7 +17,7 @@ class Snippet{{client}} * * {{{description}}} */ - public function snippetFor{{#lambda.titlecase}}{{method}}{{/lambda.titlecase}}{{testIndex}}() + public function snippetFor{{#lambda.titlecase}}{{method}}{{/lambda.titlecase}}{{testIndex}}(): void { // >SEPARATOR {{method}} {{testName}} // Initialize the client diff --git a/templates/php/tests/client/client.mustache b/templates/php/tests/client/client.mustache index 714d990d86..20ec65111a 100644 --- a/templates/php/tests/client/client.mustache +++ b/templates/php/tests/client/client.mustache @@ -29,7 +29,7 @@ class {{clientPrefix}}Test extends TestCase implements HttpClientInterface /** * @return {{client}} */ - private function createClient($appId, $apiKey{{#hasRegionalHost}}, $region = '{{{defaultRegion}}}'{{/hasRegionalHost}}) + private function createClient($appId, $apiKey{{#hasRegionalHost}}, $region = '{{{defaultRegion}}}'{{/hasRegionalHost}}): {{client}} { $config = {{clientPrefix}}Config::create($appId, $apiKey{{#hasRegionalHost}}, $region{{/hasRegionalHost}}); $clusterHosts = {{client}}::getClusterHosts($config); @@ -38,7 +38,7 @@ class {{clientPrefix}}Test extends TestCase implements HttpClientInterface return new {{client}}($api, $config); } - public function sendRequest(RequestInterface $request, $timeout, $connectTimeout) + public function sendRequest(RequestInterface $request, $timeout, $connectTimeout): Response { $this->recordedRequest = [ 'request' => $request, diff --git a/templates/php/tests/client/createClient.mustache b/templates/php/tests/client/createClient.mustache index d0aa361254..7f604abf39 100644 --- a/templates/php/tests/client/createClient.mustache +++ b/templates/php/tests/client/createClient.mustache @@ -1,8 +1,8 @@ {{#useEchoRequester}} $client = $this->createClient( {{#parametersWithDataTypeMap.appId}}"{{parametersWithDataTypeMap.appId.value}}"{{/parametersWithDataTypeMap.appId}}{{^parametersWithDataTypeMap.appId}}null{{/parametersWithDataTypeMap.appId}}, - {{#parametersWithDataTypeMap.apiKey}}"{{parametersWithDataTypeMap.apiKey.value}}"{{/parametersWithDataTypeMap.apiKey}}{{^parametersWithDataTypeMap.apiKey}}null{{/parametersWithDataTypeMap.apiKey}}, - {{#parametersWithDataTypeMap.region}}"{{parametersWithDataTypeMap.region.value}}"{{/parametersWithDataTypeMap.region}}{{^parametersWithDataTypeMap.region}}null{{/parametersWithDataTypeMap.region}} + {{#parametersWithDataTypeMap.apiKey}}"{{parametersWithDataTypeMap.apiKey.value}}"{{/parametersWithDataTypeMap.apiKey}}{{^parametersWithDataTypeMap.apiKey}}null{{/parametersWithDataTypeMap.apiKey}}{{#hasRegionalHost}}, + {{#parametersWithDataTypeMap.region}}"{{parametersWithDataTypeMap.region.value}}"{{/parametersWithDataTypeMap.region}}{{^parametersWithDataTypeMap.region}}null{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}} ); {{^isError}}$this->assertIsObject($client);{{/isError}}{{/useEchoRequester}}{{#hasCustomHosts}} $client = {{client}}::createWithConfig({{clientPrefix}}Config::create("{{parametersWithDataTypeMap.appId.value}}","{{parametersWithDataTypeMap.apiKey.value}}"{{#hasRegionalHost}}{{#parametersWithDataTypeMap.region}},"{{parametersWithDataTypeMap.region.value}}"{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}})->setFullHosts([{{#customHosts}}"http://{{host}}:{{port}}"{{^-last}},{{/-last}}{{/customHosts}}])); diff --git a/templates/php/tests/client/tests.mustache b/templates/php/tests/client/tests.mustache index 923f57352a..646b6b9013 100644 --- a/templates/php/tests/client/tests.mustache +++ b/templates/php/tests/client/tests.mustache @@ -1,6 +1,6 @@ {{#tests}} #[TestDox('{{{testName}}}')] -public function test{{testIndex}}{{testType}}() +public function test{{testIndex}}{{testType}}(): void { {{#autoCreateClient}} $client = $this->createClient(self::APP_ID, self::API_KEY); diff --git a/templates/php/tests/e2e/e2e.mustache b/templates/php/tests/e2e/e2e.mustache index 7c1433b452..b801725c77 100644 --- a/templates/php/tests/e2e/e2e.mustache +++ b/templates/php/tests/e2e/e2e.mustache @@ -27,7 +27,7 @@ if (getenv('ALGOLIA_APPLICATION_ID')) { #[CoversClass({{client}}::class)] class {{clientPrefix}}Test extends TestCase { - protected function union($expected, $received) + protected function union($expected, $received): mixed { if (is_array($expected)) { $res = []; @@ -42,7 +42,7 @@ class {{clientPrefix}}Test extends TestCase return $received; } - protected function getClient() + protected function getClient(): {{client}} { return {{client}}::create($_ENV['ALGOLIA_APPLICATION_ID'], $_ENV['{{e2eApiKey}}']{{#hasRegionalHost}},'{{defaultRegion}}' {{/hasRegionalHost}}); } @@ -50,7 +50,7 @@ class {{clientPrefix}}Test extends TestCase {{#blocksE2E}} {{#tests}} #[TestDox('{{{testName}}}')] - public function test{{#lambda.titlecase}}{{method}}{{/lambda.titlecase}}{{testIndex}}() + public function test{{#lambda.titlecase}}{{method}}{{/lambda.titlecase}}{{testIndex}}(): void { $client = $this->getClient(); $resp = {{> tests/method}}; diff --git a/templates/php/tests/requests/requests.mustache b/templates/php/tests/requests/requests.mustache index bdce4fc840..26982aa0fe 100644 --- a/templates/php/tests/requests/requests.mustache +++ b/templates/php/tests/requests/requests.mustache @@ -21,7 +21,7 @@ class {{clientPrefix}}Test extends TestCase implements HttpClientInterface { private $recordedRequests = []; - protected function assertRequests(array $requests) + protected function assertRequests(array $requests): void { $this->assertGreaterThan(0, count($requests)); $this->assertEquals(count($requests), count($this->recordedRequests)); @@ -62,14 +62,14 @@ class {{clientPrefix}}Test extends TestCase implements HttpClientInterface } } - public function sendRequest(RequestInterface $request, $timeout, $connectTimeout) + public function sendRequest(RequestInterface $request, $timeout, $connectTimeout): Response { $this->recordedRequests[] = $request; return new Response(200, [], '{}'); } - protected function getClient() + protected function getClient(): {{client}} { $config = {{clientPrefix}}Config::create('appID', 'apiKey'{{#hasRegionalHost}},'{{defaultRegion}}' {{/hasRegionalHost}}); $api = new ApiWrapper($this, $config, ClusterHosts::create('127.0.0.1')); @@ -80,7 +80,7 @@ class {{clientPrefix}}Test extends TestCase implements HttpClientInterface {{#blocksRequests}} {{#tests}} #[TestDox('{{{testName}}}')] - public function test{{#lambda.titlecase}}{{method}}{{/lambda.titlecase}}{{testIndex}}() + public function test{{#lambda.titlecase}}{{method}}{{/lambda.titlecase}}{{testIndex}}(): void { $client = $this->getClient(); {{> tests/method}};