diff --git a/composer.json b/composer.json index 6856e34..51a8fb1 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "config": { "sort-packages": true, "platform": { - "php": "7.4.99" + "php": "8.0.99" }, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true @@ -33,7 +33,7 @@ } }, "require": { - "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0", "enlightn/security-checker": "^1.10" }, "require-dev": { @@ -47,7 +47,7 @@ "psalm/plugin-phpunit": "^0.18.0", "predis/predis": "^2.0.3", "symfony/yaml": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0", - "vimeo/psalm": "^4.29.0" + "vimeo/psalm": "^5.0.0" }, "conflict": { "guzzlehttp/ringphp": "<1.1.1", diff --git a/composer.lock b/composer.lock index 648fff1..2d1b41e 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": "0b79e0e60b53a7b235491a70a430e0d7", + "content-hash": "34f690d350986cf48cfe8c64d5715ef9", "packages": [ { "name": "enlightn/security-checker", @@ -405,22 +405,27 @@ }, { "name": "psr/container", - "version": "1.1.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -447,9 +452,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/http-client", @@ -657,46 +662,42 @@ }, { "name": "symfony/console", - "version": "v5.4.16", + "version": "v6.0.16", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8e9b9c8dfb33af6057c94e1b44846bee700dc5ef" + "reference": "be294423f337dda97c810733138c0caec1bb0575" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8e9b9c8dfb33af6057c94e1b44846bee700dc5ef", - "reference": "8e9b9c8dfb33af6057c94e1b44846bee700dc5ef", + "url": "https://api.github.com/repos/symfony/console/zipball/be294423f337dda97c810733138c0caec1bb0575", + "reference": "be294423f337dda97c810733138c0caec1bb0575", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.0.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.1|^2|^3", - "symfony/string": "^5.1|^6.0" + "symfony/string": "^5.4|^6.0" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/lock": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -736,7 +737,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.16" + "source": "https://github.com/symfony/console/tree/v6.0.16" }, "funding": [ { @@ -752,29 +753,29 @@ "type": "tidelift" } ], - "time": "2022-11-25T14:09:27+00:00" + "time": "2022-11-25T18:58:46+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -803,7 +804,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" }, "funding": [ { @@ -819,26 +820,24 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/finder", - "version": "v5.4.11", + "version": "v6.0.11", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "7872a66f57caffa2916a584db1aa7f12adc76f8c" + "reference": "09cb683ba5720385ea6966e5e06be2a34f2568b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/7872a66f57caffa2916a584db1aa7f12adc76f8c", - "reference": "7872a66f57caffa2916a584db1aa7f12adc76f8c", + "url": "https://api.github.com/repos/symfony/finder/zipball/09cb683ba5720385ea6966e5e06be2a34f2568b1", + "reference": "09cb683ba5720385ea6966e5e06be2a34f2568b1", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2" }, "type": "library", "autoload": { @@ -866,7 +865,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.11" + "source": "https://github.com/symfony/finder/tree/v6.0.11" }, "funding": [ { @@ -882,7 +881,7 @@ "type": "tidelift" } ], - "time": "2022-07-29T07:37:50+00:00" + "time": "2022-07-29T07:39:48+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1214,185 +1213,22 @@ ], "time": "2022-11-03T14:55:06+00:00" }, - { - "name": "symfony/polyfill-php73", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-03T14:55:06+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-03T14:55:06+00:00" - }, { "name": "symfony/process", - "version": "v5.4.11", + "version": "v6.0.11", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1" + "reference": "44270a08ccb664143dede554ff1c00aaa2247a43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/6e75fe6874cbc7e4773d049616ab450eff537bf1", - "reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1", + "url": "https://api.github.com/repos/symfony/process/zipball/44270a08ccb664143dede554ff1c00aaa2247a43", + "reference": "44270a08ccb664143dede554ff1c00aaa2247a43", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2" }, "type": "library", "autoload": { @@ -1420,7 +1256,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.11" + "source": "https://github.com/symfony/process/tree/v6.0.11" }, "funding": [ { @@ -1436,26 +1272,25 @@ "type": "tidelift" } ], - "time": "2022-06-27T16:58:25+00:00" + "time": "2022-06-27T17:10:44+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d78d39c1599bd1188b8e26bb341da52c3c6d8a66", + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.0.2", + "psr/container": "^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" @@ -1466,7 +1301,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -1503,7 +1338,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.2" }, "funding": [ { @@ -1519,38 +1354,37 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2022-05-30T19:17:58+00:00" }, { "name": "symfony/string", - "version": "v5.4.15", + "version": "v6.0.15", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed" + "reference": "51ac0fa0ccf132a00519b87c97e8f775fa14e771" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", - "reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", + "url": "https://api.github.com/repos/symfony/string/zipball/51ac0fa0ccf132a00519b87c97e8f775fa14e771", + "reference": "51ac0fa0ccf132a00519b87c97e8f775fa14e771", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -1589,7 +1423,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.15" + "source": "https://github.com/symfony/string/tree/v6.0.15" }, "funding": [ { @@ -1605,32 +1439,31 @@ "type": "tidelift" } ], - "time": "2022-10-05T15:16:54+00:00" + "time": "2022-10-10T09:34:08+00:00" }, { "name": "symfony/yaml", - "version": "v5.4.16", + "version": "v6.0.16", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "ebd37c71f62d5ec5f6e27de3e06fee492d4c6298" + "reference": "eb85bd1b0b297e976f3ada52ad239ef80b4dbd0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/ebd37c71f62d5ec5f6e27de3e06fee492d4c6298", - "reference": "ebd37c71f62d5ec5f6e27de3e06fee492d4c6298", + "url": "https://api.github.com/repos/symfony/yaml/zipball/eb85bd1b0b297e976f3ada52ad239ef80b4dbd0b", + "reference": "eb85bd1b0b297e976f3ada52ad239ef80b4dbd0b", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.0.2", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<5.3" + "symfony/console": "<5.4" }, "require-dev": { - "symfony/console": "^5.3|^6.0" + "symfony/console": "^5.4|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -1664,7 +1497,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.16" + "source": "https://github.com/symfony/yaml/tree/v6.0.16" }, "funding": [ { @@ -1680,7 +1513,7 @@ "type": "tidelift" } ], - "time": "2022-11-25T16:04:03+00:00" + "time": "2022-11-25T18:58:46+00:00" } ], "packages-dev": [ @@ -2872,6 +2705,67 @@ }, "time": "2022-03-02T22:36:06+00:00" }, + { + "name": "fidry/cpu-core-counter", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "666cb04a02f2801f3b19955fc23c824f9018bf64" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/666cb04a02f2801f3b19955fc23c824f9018bf64", + "reference": "666cb04a02f2801f3b19955fc23c824f9018bf64", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^1.9.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^9.5.26 || ^8.5.31", + "theofidry/php-cs-fixer-config": "^1.0", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/0.4.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2022-12-10T21:26:31+00:00" + }, { "name": "friendsofphp/proxy-manager-lts", "version": "v1.0.13", @@ -3078,27 +2972,27 @@ }, { "name": "laminas/laminas-loader", - "version": "2.8.0", + "version": "2.9.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-loader.git", - "reference": "d0589ec9dd48365fd95ad10d1c906efd7711c16b" + "reference": "51ed9c3fa42d1098a9997571730c0cbf42d078d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-loader/zipball/d0589ec9dd48365fd95ad10d1c906efd7711c16b", - "reference": "d0589ec9dd48365fd95ad10d1c906efd7711c16b", + "url": "https://api.github.com/repos/laminas/laminas-loader/zipball/51ed9c3fa42d1098a9997571730c0cbf42d078d3", + "reference": "51ed9c3fa42d1098a9997571730c0cbf42d078d3", "shasum": "" }, "require": { - "php": "^7.3 || ~8.0.0 || ~8.1.0" + "php": "~8.0.0 || ~8.1.0 || ~8.2.0" }, "conflict": { "zendframework/zend-loader": "*" }, "require-dev": { - "laminas/laminas-coding-standard": "~2.2.1", - "phpunit/phpunit": "^9.3" + "laminas/laminas-coding-standard": "~2.4.0", + "phpunit/phpunit": "~9.5.25" }, "type": "library", "autoload": { @@ -3130,7 +3024,7 @@ "type": "community_bridge" } ], - "time": "2021-09-02T18:30:53+00:00" + "time": "2022-10-16T12:50:49+00:00" }, { "name": "mikey179/vfsstream", @@ -4032,16 +3926,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.19", + "version": "9.2.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559" + "reference": "af7463c955007de36db0c5e26d03e2f933c2e980" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/af7463c955007de36db0c5e26d03e2f933c2e980", + "reference": "af7463c955007de36db0c5e26d03e2f933c2e980", "shasum": "" }, "require": { @@ -4097,7 +3991,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.20" }, "funding": [ { @@ -4105,7 +3999,7 @@ "type": "github" } ], - "time": "2022-11-18T07:47:47+00:00" + "time": "2022-12-13T07:49:28+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4350,16 +4244,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.26", + "version": "9.5.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2" + "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/851867efcbb6a1b992ec515c71cdcf20d895e9d2", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", + "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", "shasum": "" }, "require": { @@ -4432,7 +4326,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.26" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" }, "funding": [ { @@ -4448,7 +4342,7 @@ "type": "tidelift" } ], - "time": "2022-10-28T06:00:21+00:00" + "time": "2022-12-09T07:31:23+00:00" }, { "name": "predis/predis", @@ -4583,20 +4477,20 @@ }, { "name": "psr/cache", - "version": "1.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { @@ -4616,7 +4510,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for caching libraries", @@ -4626,36 +4520,36 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/master" + "source": "https://github.com/php-fig/cache/tree/3.0.0" }, - "time": "2016-08-06T20:24:11+00:00" + "time": "2021-02-03T23:26:27+00:00" }, { "name": "psr/log", - "version": "1.1.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -4676,9 +4570,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/3.0.0" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2021-07-14T16:46:02+00:00" }, { "name": "sebastian/cli-parser", @@ -5763,23 +5657,22 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.13", + "version": "v6.0.13", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "ac09569844a9109a5966b9438fc29113ce77cf51" + "reference": "3adca49133bd055ebe6011ed1e012be3c908af79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/ac09569844a9109a5966b9438fc29113ce77cf51", - "reference": "ac09569844a9109a5966b9438fc29113ce77cf51", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3adca49133bd055ebe6011ed1e012be3c908af79", + "reference": "3adca49133bd055ebe6011ed1e012be3c908af79", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.8" }, "type": "library", "autoload": { @@ -5807,7 +5700,90 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.13" + "source": "https://github.com/symfony/filesystem/tree/v6.0.13" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-09-21T20:25:27+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -5823,24 +5799,24 @@ "type": "tidelift" } ], - "time": "2022-09-21T19:53:16+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.4.13", + "version": "v6.0.13", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "6df7a3effde34d81717bbef4591e5ffe32226d69" + "reference": "7554fde6848af5ef1178f8ccbdbdb8ae1092c70a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/6df7a3effde34d81717bbef4591e5ffe32226d69", - "reference": "6df7a3effde34d81717bbef4591e5ffe32226d69", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/7554fde6848af5ef1178f8ccbdbdb8ae1092c70a", + "reference": "7554fde6848af5ef1178f8ccbdbdb8ae1092c70a", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/service-contracts": "^1|^2|^3" }, "type": "library", @@ -5869,7 +5845,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.4.13" + "source": "https://github.com/symfony/stopwatch/tree/v6.0.13" }, "funding": [ { @@ -5885,7 +5861,7 @@ "type": "tidelift" } ], - "time": "2022-09-28T13:19:49+00:00" + "time": "2022-09-28T15:52:47+00:00" }, { "name": "theseer/tokenizer", @@ -5939,24 +5915,24 @@ }, { "name": "vimeo/psalm", - "version": "4.30.0", + "version": "5.2.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69" + "reference": "fb685a16df3050d4c18d8a4100fe83abe6458cba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/d0bc6e25d89f649e4f36a534f330f8bb4643dd69", - "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/fb685a16df3050d4c18d8a4100fe83abe6458cba", + "reference": "fb685a16df3050d4c18d8a4100fe83abe6458cba", "shasum": "" }, "require": { "amphp/amp": "^2.4.2", "amphp/byte-stream": "^1.5", - "composer/package-versions-deprecated": "^1.8.0", + "composer/package-versions-deprecated": "^1.10.0", "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0", + "composer/xdebug-handler": "^2.0 || ^3.0", "dnoegel/php-xdg-base-dir": "^0.1.1", "ext-ctype": "*", "ext-dom": "*", @@ -5965,35 +5941,35 @@ "ext-mbstring": "*", "ext-simplexml": "*", "ext-tokenizer": "*", - "felixfbecker/advanced-json-rpc": "^3.0.3", - "felixfbecker/language-server-protocol": "^1.5", + "felixfbecker/advanced-json-rpc": "^3.1", + "felixfbecker/language-server-protocol": "^1.5.2", + "fidry/cpu-core-counter": "^0.4.0", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "nikic/php-parser": "^4.13", "openlss/lib-array2xml": "^1.0", - "php": "^7.1|^8", - "sebastian/diff": "^3.0 || ^4.0", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0", - "symfony/polyfill-php80": "^1.25", - "webmozart/path-util": "^2.3" + "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", + "sebastian/diff": "^4.0", + "symfony/console": "^4.1.6 || ^5.0 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0", + "symfony/polyfill-php80": "^1.25" }, "provide": { "psalm/psalm": "self.version" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.2", - "brianium/paratest": "^4.0||^6.0", + "bamarni/composer-bin-plugin": "^1.4", + "brianium/paratest": "^6.0", "ext-curl": "*", + "mockery/mockery": "^1.5", + "nunomaduro/mock-final-classes": "^1.1", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpdocumentor/reflection-docblock": "^5", - "phpmyadmin/sql-parser": "5.1.0||dev-master", - "phpspec/prophecy": ">=1.9.0", - "phpstan/phpdoc-parser": "1.2.* || 1.6.4", - "phpunit/phpunit": "^9.0", - "psalm/plugin-phpunit": "^0.16", - "slevomat/coding-standard": "^7.0", - "squizlabs/php_codesniffer": "^3.5", - "symfony/process": "^4.3 || ^5.0 || ^6.0", - "weirdan/prophecy-shim": "^1.0 || ^2.0" + "phpstan/phpdoc-parser": "^1.6", + "phpunit/phpunit": "^9.5", + "psalm/plugin-mockery": "^1.1", + "psalm/plugin-phpunit": "^0.18", + "slevomat/coding-standard": "^8.4", + "squizlabs/php_codesniffer": "^3.6", + "symfony/process": "^4.4 || ^5.0 || ^6.0" }, "suggest": { "ext-curl": "In order to send data to shepherd", @@ -6009,17 +5985,14 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev", + "dev-master": "5.x-dev", + "dev-4.x": "4.x-dev", "dev-3.x": "3.x-dev", "dev-2.x": "2.x-dev", "dev-1.x": "1.x-dev" } }, "autoload": { - "files": [ - "src/functions.php", - "src/spl_object_id.php" - ], "psr-4": { "Psalm\\": "src/Psalm/" } @@ -6041,9 +6014,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.30.0" + "source": "https://github.com/vimeo/psalm/tree/5.2.0" }, - "time": "2022-11-06T20:37:08+00:00" + "time": "2022-12-12T08:18:56+00:00" }, { "name": "webimpress/coding-standard", @@ -6157,57 +6130,6 @@ "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, "time": "2022-06-03T18:03:27+00:00" - }, - { - "name": "webmozart/path-util", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/path-util.git", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "webmozart/assert": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\PathUtil\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", - "support": { - "issues": "https://github.com/webmozart/path-util/issues", - "source": "https://github.com/webmozart/path-util/tree/2.3.0" - }, - "abandoned": "symfony/filesystem", - "time": "2015-12-17T08:42:14+00:00" } ], "aliases": [], @@ -6216,11 +6138,11 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0" + "php": "~8.0.0 || ~8.1.0 || ~8.2.0" }, "platform-dev": [], "platform-overrides": { - "php": "7.4.99" + "php": "8.0.99" }, "plugin-api-version": "2.3.0" } diff --git a/psalm-baseline.xml b/psalm-baseline.xml index a0a1ca2..6c6b731 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + $label @@ -18,18 +18,6 @@ - - $files - - - $file - $file - $file - $file - - - $file - AbstractFileCheck @@ -42,10 +30,6 @@ AbstractMemoryCheck - - (int) $criticalThreshold - (int) $warningThreshold - @@ -83,10 +67,6 @@ ApcFragmentation - - (int) $criticalThreshold - (int) $warningThreshold - $nseg $nseg @@ -119,22 +99,6 @@ - - $classNames - - - $class - - - $missing - - - $class - $missing[] - - - current($missing) - ClassExists @@ -159,10 +123,7 @@ - - string - - + $a $a $a @@ -171,8 +132,6 @@ $p $t $t - 1 - 2 2 2 2 @@ -183,14 +142,11 @@ null null - - bcdiv(bcpow(bcadd($a, $b), 2), bcmul(4, $t), $precision) - $b $b $b - $x + bcsqrt(2) CpuPerformance @@ -200,69 +156,24 @@ - - $this->dir - - - $path - - - $dir - $dir - - - $nonDirs - $unreadable - - - $dir - $nonDirs[] - $unreadable[] - - - current($nonDirs) - current($unreadable) - DirReadable - - $this->dir - - - $path - - - $dir - $dir - current($nonDirs) - current($unwritable) - - - $nonDirs - $unwritable - - - $dir - $nonDirs[] - $unwritable[] - DirWritable - + is_scalar($size) - is_string($path) $bytes - $free + $size $a @@ -273,6 +184,13 @@ $this->path + + $x[$i] + + + $x[$i] + $x[$i] + $bytes $bytes @@ -289,18 +207,15 @@ $bytes - - $a - $a + $k $k DiskFree - + ! is_float($free) - $free === false || ! is_float($free) $this->path @@ -308,20 +223,34 @@ $this->path + + $a + $a + $x + + + $a + $a + $a + $a + $a + $a + $x + $x + $x + $x + $x + $x + - + is_numeric($criticalThreshold) is_numeric($warningThreshold) - is_string($path) DiskUsage - - (int) $criticalThreshold - (int) $warningThreshold - @@ -341,42 +270,9 @@ - - $this->extensions - - - $extensionName - - - $ext - $ext - $ext - $ext - - - $missing - $missing - $this->extensions - - - $versions[$ext] - - - $ext - $ext - $ext - $missing[] - - - $ext - $ext - ExtensionLoaded - - $this->extensions - @@ -405,9 +301,8 @@ $guzzle - + (int) $response->getStatusCode() - (int) $statusCode bool|FailureInterface @@ -440,9 +335,8 @@ is_string($host) - + $memcache - $stats addServer @@ -460,9 +354,8 @@ is_string($host) - + $memcached - $stats addServer @@ -519,55 +412,14 @@ - - is_array($settingName) - is_scalar($expectedValue) - - - $name - - - $failures - $this->settings - - - $failures[] - $name - - - $failures[0] - $this->settings[0] - PhpFlag - - (bool) $expectedValue - $this->operator - - is_array($expectedVersion) - is_scalar($operator) - - - $this->version - - - $expectedVersion - $expectedVersion - [$expectedVersion] - - - $version - $version - - - $version - PhpVersion @@ -602,14 +454,35 @@ + + $client + + + PredisClient|RedisExtensionClient + + + auth + connect + + + $client + Redis + + RedisException + + + $client + PredisClient|RedisExtensionClient + RedisException + + + array + - - is_scalar($lockFilePath) - $advisories @@ -622,24 +495,12 @@ - - $wrappers - $v - + $v - current($missingWrappers) - - $missingWrappers - $this->wrappers - - - $class - $missingWrappers[] - StreamWrapperExists @@ -670,11 +531,6 @@ updateCounters - - $checkResult - parent::offsetGet($index) - parent::offsetGet($index) - $checkResult @@ -692,25 +548,6 @@ consoleWrite consoleWriteLn - - $message - $result - - - $message - $result - - - getLabel - getLabel - getLabel - getMessage - - - $check->getLabel() - $check->getLabel() - $check->getLabel() - $countLength $gutter @@ -726,12 +563,6 @@ [$this, 'errorHandler'] - - $this->reporters - - - array - addCheck addChecks @@ -742,46 +573,28 @@ startErrorHandler stopErrorHandler - - $check - $key - - - $results[$check] - - - $alias - $check - $key + + $config + + $key - $reporter - $result $val CheckInterface - - check - - - $key - $this->checks[$alias] - - $this->reporters - $lastResults (bool) $breakOnFailure - - $this->reporters - + + is_object($result) + @@ -795,32 +608,24 @@ array - - - + $criticalThreshold $warningThreshold - + + + array - - - + $criticalThreshold $warningThreshold - + - - $alias - $alias - $alias - $alias - $alias - $alias + $alias - + $check $check @@ -833,67 +638,41 @@ - + $allExtensions $allWrappers - 'InvalidArgumentException' - 'InvalidArgumentException' - 'InvalidArgumentException' shell_exec('ps -o command= -p ' . $phpPid) - - $this->createMock(AdvisoryAnalyzer::class) - 15 - [$this, 'foobarbar'] - [] - fopen('php://memory', 'r') - new stdClass() - new stdClass() - new stdClass() - new stdClass() - new stdClass() - new stdClass() - new stdClass() + + 'like' new stdClass() - - [] - - + + $extensions $phpPid - 2 - 15 - 15 - 15 - 15 - 15 ceil(strlen($phpPid) / 2) rand() - true - - $dir1 - $dir1 - $dir1 + $dir1 $dir1 $dir1 $dir1 - $dir1 - $dir1 - $dir2 - $dir2 - $dir2 - $dir2 $dir2 $dir2 $dir2 $dir2 $name - $name + + $allFalse + $allFalse + $name + $notAllFalse + $notAllFalse + $valueArray['local_value'] $valueArray['local_value'] @@ -904,21 +683,14 @@ $valueArray $valueArray - - $dir1 - $dir1 + $dir1 $dir2 - $dir2 - - $notAllFalse - - - $dir1 - $dir1 - $dir1 - $dir1 + + $name + + $dir1 $dir1 $dir1 @@ -931,21 +703,12 @@ $dir2 $dir2 $dir2 - $dir2 - $dir2 - $dir2 - $dir2 - $dir2 - $dir2 - $dir2 $name - - new SecurityAdvisory($this->createMock(AdvisoryAnalyzer::class), new stdClass()) - - + + $arguments $this->checkClass @@ -956,15 +719,6 @@ $c - - [] - - - $freeRightNow - $freeRightNow * 0.5 - $freeRightNow + 1073741824 - 100 - array array @@ -972,19 +726,13 @@ - - $criticalThreshold - $dp + 1 - $dp + 2 - $dp - 1 - $dp - 1 - $warningThreshold - array - + + $criticalThreshold $path + $warningThreshold $path @@ -1006,11 +754,6 @@ Generator - - - $extensionName - - $resultClass @@ -1018,9 +761,6 @@ 'not guzzle' - - '200' - $request $request @@ -1054,22 +794,18 @@ ['127.0.0.1'] - - - $criticalThreshold - $warningThreshold - - 'Iterator' 'Traversable' - + $key $key $key $key + $key + $value $this->collection[$key] @@ -1088,19 +824,16 @@ $expectedResult - + 'foo' - 10 array - - getSeverity + getSeverity - - getSeverity + getSeverity @@ -1132,7 +865,8 @@ - + + strpos() strpos() diff --git a/src/Check/AbstractCheck.php b/src/Check/AbstractCheck.php index c6e6cee..68dda94 100644 --- a/src/Check/AbstractCheck.php +++ b/src/Check/AbstractCheck.php @@ -12,7 +12,7 @@ abstract class AbstractCheck implements CheckInterface /** * Explicitly set label. * - * @var string + * @var ?string */ protected $label; diff --git a/src/Check/AbstractFileCheck.php b/src/Check/AbstractFileCheck.php index 8c61b25..e07f6a1 100644 --- a/src/Check/AbstractFileCheck.php +++ b/src/Check/AbstractFileCheck.php @@ -7,12 +7,8 @@ use Laminas\Diagnostics\Result\FailureInterface; use Laminas\Diagnostics\Result\ResultInterface; use Laminas\Diagnostics\Result\Success; -use Traversable; -use function get_class; -use function is_array; use function is_file; -use function is_object; use function is_readable; use function is_string; use function sprintf; @@ -22,25 +18,15 @@ */ abstract class AbstractFileCheck extends AbstractCheck { - /** @var array|Traversable */ + /** @var iterable */ protected $files; /** - * @param string|array|Traversable $files Path name or an array / Traversable of paths + * @param iterable|string $files Path name or an array / Traversable of paths * @throws InvalidArgumentException */ - public function __construct($files) + public function __construct(iterable|string $files) { - if (is_object($files) && ! $files instanceof Traversable) { - throw new InvalidArgumentException( - 'Expected a file name (string) , an array or Traversable of strings, got ' . get_class($files) - ); - } - - if (! is_object($files) && ! is_array($files) && ! is_string($files)) { - throw new InvalidArgumentException('Expected a file name (string) or an array of strings'); - } - if (is_string($files)) { $this->files = [$files]; } else { diff --git a/src/Check/AbstractMemoryCheck.php b/src/Check/AbstractMemoryCheck.php index 08a42aa..eacb05c 100644 --- a/src/Check/AbstractMemoryCheck.php +++ b/src/Check/AbstractMemoryCheck.php @@ -31,11 +31,11 @@ abstract class AbstractMemoryCheck extends AbstractCheck implements CheckInterfa protected $criticalThreshold; /** - * @param int $warningThreshold A number between 0 and 100 - * @param int $criticalThreshold A number between 0 and 100 + * @param numeric $warningThreshold A number between 0 and 100 + * @param numeric $criticalThreshold A number between 0 and 100 * @throws InvalidArgumentException */ - public function __construct($warningThreshold, $criticalThreshold) + public function __construct(string|int|float $warningThreshold, string|int|float $criticalThreshold) { if (! is_numeric($warningThreshold)) { throw new InvalidArgumentException( diff --git a/src/Check/ApcFragmentation.php b/src/Check/ApcFragmentation.php index 921d087..4571ddb 100644 --- a/src/Check/ApcFragmentation.php +++ b/src/Check/ApcFragmentation.php @@ -44,11 +44,11 @@ class ApcFragmentation extends AbstractCheck implements CheckInterface protected $criticalThreshold; /** - * @param int $warningThreshold A number between 0 and 100 - * @param int $criticalThreshold A number between 0 and 100 + * @param numeric $warningThreshold A number between 0 and 100 + * @param numeric $criticalThreshold A number between 0 and 100 * @throws InvalidArgumentException */ - public function __construct($warningThreshold, $criticalThreshold) + public function __construct(int|float|string $warningThreshold, int|float|string $criticalThreshold) { if (! is_numeric($warningThreshold)) { throw new InvalidArgumentException( diff --git a/src/Check/Callback.php b/src/Check/Callback.php index 36f81f3..585576b 100644 --- a/src/Check/Callback.php +++ b/src/Check/Callback.php @@ -5,7 +5,6 @@ use InvalidArgumentException; use function call_user_func_array; -use function is_callable; /** * Run a callback function and return result. @@ -18,17 +17,9 @@ class Callback extends AbstractCheck implements CheckInterface /** @var array */ protected $params = []; - /** - * @param callable $callback - * @param array $params - * @throws InvalidArgumentException - */ - public function __construct($callback, $params = []) + /** @throws InvalidArgumentException */ + public function __construct(callable $callback, array $params = []) { - if (! is_callable($callback)) { - throw new InvalidArgumentException('Invalid callback provided; not callable'); - } - $this->callback = $callback; $this->params = $params; } diff --git a/src/Check/ClassExists.php b/src/Check/ClassExists.php index 4edbdd2..3e52d02 100644 --- a/src/Check/ClassExists.php +++ b/src/Check/ClassExists.php @@ -5,15 +5,11 @@ use InvalidArgumentException; use Laminas\Diagnostics\Result\Failure; use Laminas\Diagnostics\Result\Success; -use Traversable; use function class_exists; use function count; use function current; -use function get_class; use function implode; -use function is_array; -use function is_object; use function is_string; /** @@ -24,7 +20,7 @@ class ClassExists extends AbstractCheck implements CheckInterface /** * An array of classes to check * - * @var array|Traversable + * @var iterable */ protected $classes; @@ -36,22 +32,12 @@ class ClassExists extends AbstractCheck implements CheckInterface protected $autoload = true; /** - * @param string|array|Traversable $classNames Class name or an array of classes - * @param bool $autoload Use autoloader when looking for classes? (defaults to true) + * @param string|iterable $classNames Class name or an array of classes + * @param bool $autoload Use autoloader when looking for classes? (defaults to true) * @throws InvalidArgumentException */ - public function __construct($classNames, $autoload = true) + public function __construct(string|iterable $classNames, $autoload = true) { - if (is_object($classNames) && ! $classNames instanceof Traversable) { - throw new InvalidArgumentException( - 'Expected a class name (string) , an array or Traversable of strings, got ' . get_class($classNames) - ); - } - - if (! is_object($classNames) && ! is_array($classNames) && ! is_string($classNames)) { - throw new InvalidArgumentException('Expected a class name (string) or an array of strings'); - } - if (is_string($classNames)) { $this->classes = [$classNames]; } else { diff --git a/src/Check/CpuPerformance.php b/src/Check/CpuPerformance.php index 9cbcd81..051f98e 100644 --- a/src/Check/CpuPerformance.php +++ b/src/Check/CpuPerformance.php @@ -120,11 +120,11 @@ public static function calcPi($precision) $limit = ceil(log($precision) / log(2)) - 1; bcscale($precision + 6); $a = 1; - $b = bcdiv(1, bcsqrt(2)); + $b = bcdiv('1', bcsqrt(2)); $t = 1 / 4; $p = 1; for ($n = 0; $n < $limit; $n++) { - $x = bcdiv(bcadd($a, $b), 2); + $x = bcdiv(bcadd($a, $b), '2'); $y = bcsqrt(bcmul($a, $b)); $t = bcsub($t, bcmul($p, bcpow(bcsub($a, $x), 2))); $a = $x; diff --git a/src/Check/DirReadable.php b/src/Check/DirReadable.php index 9da4c26..20b069a 100644 --- a/src/Check/DirReadable.php +++ b/src/Check/DirReadable.php @@ -5,15 +5,11 @@ use InvalidArgumentException; use Laminas\Diagnostics\Result\Failure; use Laminas\Diagnostics\Result\Success; -use Traversable; use function count; use function current; -use function get_class; use function implode; -use function is_array; use function is_dir; -use function is_object; use function is_readable; use function is_string; use function trim; @@ -23,25 +19,15 @@ */ class DirReadable extends AbstractCheck implements CheckInterface { - /** @var array|Traversable */ + /** @var array */ protected $dir; /** - * @param string|array|Traversable $path Path name or an array of paths + * @param string|array $path Path name or an array of paths * @throws InvalidArgumentException */ - public function __construct($path) + public function __construct(string|array $path) { - if (is_object($path) && ! $path instanceof Traversable) { - throw new InvalidArgumentException( - 'Expected a dir name (string) , an array or Traversable of strings, got ' . get_class($path) - ); - } - - if (! is_object($path) && ! is_array($path) && ! is_string($path)) { - throw new InvalidArgumentException('Expected a dir name (string) or an array of strings'); - } - if (is_string($path)) { $this->dir = [$path]; } else { diff --git a/src/Check/DirWritable.php b/src/Check/DirWritable.php index 985c10e..8bbad04 100644 --- a/src/Check/DirWritable.php +++ b/src/Check/DirWritable.php @@ -5,15 +5,11 @@ use InvalidArgumentException; use Laminas\Diagnostics\Result\Failure; use Laminas\Diagnostics\Result\Success; -use Traversable; use function count; use function current; -use function get_class; use function implode; -use function is_array; use function is_dir; -use function is_object; use function is_string; use function is_writable; use function sprintf; @@ -24,30 +20,22 @@ */ class DirWritable extends AbstractCheck implements CheckInterface { - /** @var array|Traversable */ + /** @var non-empty-list */ protected $dir; /** - * @param string|array|Traversable $path Path name or an array of paths + * @param string|non-empty-list $path Path name or an array of paths * @throws InvalidArgumentException */ - public function __construct($path) + public function __construct(string|array $path) { - if (is_object($path) && ! $path instanceof Traversable) { - throw new InvalidArgumentException( - 'Expected a dir name (string), an array or Traversable of strings, got ' . get_class($path) - ); - } - - if (! is_object($path) && ! is_array($path) && ! is_string($path)) { - throw new InvalidArgumentException('Expected a dir name (string) or an array of strings'); - } - if (is_string($path)) { $this->dir = [$path]; - } else { - $this->dir = $path; + + return; } + + $this->dir = $path; } /** diff --git a/src/Check/DiskFree.php b/src/Check/DiskFree.php index 97acb05..107897e 100644 --- a/src/Check/DiskFree.php +++ b/src/Check/DiskFree.php @@ -16,7 +16,6 @@ use function is_float; use function is_numeric; use function is_scalar; -use function is_string; use function preg_match; use function round; use function sprintf; @@ -127,20 +126,16 @@ class DiskFree extends AbstractCheck implements CheckInterface ]; /** - * @param int|string $size Minimum disk size in bytes or a valid byte string (IEC, SI or Jedec). - * @param string $path The disk path to check, i.e. '/tmp' or 'C:' (defaults to /) + * @param numeric|string $size Minimum disk size in bytes or a valid byte string (IEC, SI or Jedec). + * @param string $path The disk path to check, i.e. '/tmp' or 'C:' (defaults to /) * @throws InvalidArgumentException */ - public function __construct($size, $path = '/') + public function __construct(int|float|string $size, string $path = '/') { if (! is_scalar($size)) { throw new InvalidArgumentException('Invalid free disk space argument - expecting a positive number'); } - if (! is_string($path)) { - throw new InvalidArgumentException('Invalid disk path argument - expecting a string'); - } - if (is_numeric($size)) { $this->minDiskBytes = (int) $size; } else { @@ -188,11 +183,13 @@ public function check() * * @link https://en.wikipedia.org/wiki/Binary_prefix * - * @param int $size Number of bytes to convert - * @param int $precision Rounding precision (defaults to 0) - * @return string Highest rounded multiplication with IEC suffix + * @param numeric $size Number of bytes to convert + * @param int $precision Rounding precision (defaults to 0) + * + * @return string Highest rounded multiplicatio + * n with IEC suffix */ - public static function bytesToString($size, $precision = 0) + public static function bytesToString(int|float|string $size, int $precision = 0) { if ($size >= 1125899906842624) { $size /= 1125899906842624; diff --git a/src/Check/DiskUsage.php b/src/Check/DiskUsage.php index 0dd7e35..61739ba 100644 --- a/src/Check/DiskUsage.php +++ b/src/Check/DiskUsage.php @@ -10,7 +10,6 @@ use function disk_free_space; use function disk_total_space; use function is_numeric; -use function is_string; use function sprintf; /** @@ -40,19 +39,16 @@ class DiskUsage extends AbstractCheck implements CheckInterface protected $path; /** - * @param int $warningThreshold A number between 0 and 100 - * @param int $criticalThreshold A number between 0 and 100 - * @param string $path The disk path to check, i.e. '/tmp' or 'C:' (defaults to /) + * @param numeric $warningThreshold A number between 0 and 100 + * @param numeric $criticalThreshold A number between 0 and 100 + * @param string $path The disk path to check, i.e. '/tmp' or 'C:' (defaults to /) * @throws InvalidArgumentException */ - public function __construct($warningThreshold, $criticalThreshold, $path = '/') - { - if (! is_string($path)) { - throw new InvalidArgumentException( - 'Invalid disk path argument - expecting a string' - ); - } - + public function __construct( + int|float|string $warningThreshold, + int|float|string $criticalThreshold, + string $path = '/' + ) { if (! is_numeric($warningThreshold)) { throw new InvalidArgumentException( 'Invalid warningThreshold argument - expecting an integer' diff --git a/src/Check/ElasticSearch.php b/src/Check/ElasticSearch.php new file mode 100644 index 0000000..173cce6 --- /dev/null +++ b/src/Check/ElasticSearch.php @@ -0,0 +1,58 @@ +guzzle->send($this->request, array_merge($this->options)); + $health = trim((string) $response->getBody()); + $responseTime = microtime(true) - $startTime; + } catch (Exception $e) { + return new Failure("Unable to connect to elasticsearch: " . $e->getMessage()); + } + + $serviceData = [ + "responseTime" => $responseTime, + ]; + + if ($health === 'green') { + return new Success("Cluster status green", $serviceData); + } + + if ($health === 'yellow') { + return new Warning("Cluster status yellow", $serviceData); + } + + return new Failure("Cluster status red", $serviceData); + } +} diff --git a/src/Check/ExtensionLoaded.php b/src/Check/ExtensionLoaded.php index 3a16853..d21f0a9 100644 --- a/src/Check/ExtensionLoaded.php +++ b/src/Check/ExtensionLoaded.php @@ -5,14 +5,10 @@ use InvalidArgumentException; use Laminas\Diagnostics\Result\Failure; use Laminas\Diagnostics\Result\Success; -use Traversable; use function count; use function extension_loaded; -use function get_class; use function implode; -use function is_array; -use function is_object; use function is_string; use function phpversion; @@ -21,33 +17,25 @@ */ class ExtensionLoaded extends AbstractCheck implements CheckInterface { - /** @var array|Traversable */ + /** @var non-empty-list */ protected $extensions; /** @var bool */ protected $autoload = true; /** - * @param string|array|Traversable $extensionName PHP extension name or an array of names + * @param string|non-empty-list $extensionName PHP extension name or an array of names * @throws InvalidArgumentException */ - public function __construct($extensionName) + public function __construct(string|array $extensionName) { - if (is_object($extensionName) && ! $extensionName instanceof Traversable) { - throw new InvalidArgumentException( - 'Expected a module name (string) , an array or Traversable of strings, got ' . get_class($extensionName) - ); - } - - if (! is_object($extensionName) && ! is_array($extensionName) && ! is_string($extensionName)) { - throw new InvalidArgumentException('Expected a module name (string) or an array of strings'); - } - if (is_string($extensionName)) { $this->extensions = [$extensionName]; - } else { - $this->extensions = $extensionName; + + return; } + + $this->extensions = $extensionName; } /** diff --git a/src/Check/GuzzleHttpService.php b/src/Check/GuzzleHttpService.php index 48d738b..e73ec0f 100644 --- a/src/Check/GuzzleHttpService.php +++ b/src/Check/GuzzleHttpService.php @@ -50,7 +50,7 @@ class GuzzleHttpService extends AbstractCheck * The absolute url to check, or a fully-formed request instance. * @param array $headers An array of headers used to create the request * @param array $options An array of guzzle options to use when sending the request - * @param int $statusCode The response status code to check + * @param numeric-string|int $statusCode The response status code to check * @param null|string $content The response content to check * @param null|GuzzleClientInterface $guzzle Instance of guzzle to use * @param string $method The method of the request @@ -61,7 +61,7 @@ public function __construct( $requestOrUrl, array $headers = [], array $options = [], - $statusCode = 200, + int|string $statusCode = 200, $content = null, $guzzle = null, $method = 'GET', diff --git a/src/Check/Memcached.php b/src/Check/Memcached.php index 2d8659a..d09e944 100644 --- a/src/Check/Memcached.php +++ b/src/Check/Memcached.php @@ -68,8 +68,7 @@ public function check() $memcached = new MemcachedService(); $memcached->addServer($this->host, $this->port); - $startTime = microtime(true); - /** @var false|array> $stats */ + $startTime = microtime(true); $stats = @$memcached->getStats(); $responseTime = microtime(true) - $startTime; diff --git a/src/Check/PhpFlag.php b/src/Check/PhpFlag.php index b454ad7..c64d808 100644 --- a/src/Check/PhpFlag.php +++ b/src/Check/PhpFlag.php @@ -5,17 +5,11 @@ use InvalidArgumentException; use Laminas\Diagnostics\Result\Failure; use Laminas\Diagnostics\Result\Success; -use Traversable; use function count; -use function get_class; -use function gettype; use function implode; use function ini_get; -use function is_array; -use function is_object; -use function is_scalar; -use function iterator_to_array; +use function is_string; /** * Make sure given PHP flag is turned on or off in php.ini @@ -24,44 +18,27 @@ */ class PhpFlag extends AbstractCheck implements CheckInterface { - /** @var array */ + /** @var non-empty-list */ protected $settings; /** @var bool */ protected $expectedValue; /** - * @param string|array|Traversable $settingName PHP setting names to check. - * @param bool $expectedValue true or false + * @param string|non-empty-list $settingName PHP setting names to check. * @throws InvalidArgumentException */ - public function __construct($settingName, $expectedValue) + public function __construct(string|array $settingName, bool $expectedValue) { - if (is_object($settingName)) { - if (! $settingName instanceof Traversable) { - throw new InvalidArgumentException( - 'Expected setting name as string, array or traversable, got ' . get_class($settingName) - ); - } - $this->settings = iterator_to_array($settingName); - } elseif (! is_scalar($settingName)) { - if (! is_array($settingName)) { - throw new InvalidArgumentException( - 'Expected setting name as string, array or traversable, got ' . gettype($settingName) - ); - } - $this->settings = $settingName; - } else { + $this->expectedValue = $expectedValue; + + if (is_string($settingName)) { $this->settings = [$settingName]; - } - if (! is_scalar($expectedValue)) { - throw new InvalidArgumentException( - 'Expected expected value, expected boolean, got ' . gettype($expectedValue) - ); + return; } - $this->expectedValue = (bool) $expectedValue; + $this->settings = $settingName; } /** diff --git a/src/Check/PhpVersion.php b/src/Check/PhpVersion.php index 7bb92e3..b0cd712 100644 --- a/src/Check/PhpVersion.php +++ b/src/Check/PhpVersion.php @@ -5,14 +5,9 @@ use InvalidArgumentException; use Laminas\Diagnostics\Result\Failure; use Laminas\Diagnostics\Result\Success; -use Traversable; -use function get_class; -use function gettype; use function in_array; -use function is_array; -use function is_object; -use function is_scalar; +use function is_string; use function sprintf; use function version_compare; @@ -23,64 +18,47 @@ * * This test accepts a single version and an operator or an array of * versions to test for. + * + * @psalm-type Operator = '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' */ class PhpVersion extends AbstractCheck implements CheckInterface { - /** @var string */ + private const VALID_OPERATORS = [ + '<', + 'lt', + '<=', + 'le', + '>', + 'gt', + '>=', + 'ge', + '==', + '=', + 'eq', + '!=', + '<>', + 'ne', + ]; + + /** @var iterable */ protected $version; /** @var string */ protected $operator = '>='; /** - * @param string|array|Traversable $expectedVersion The expected version - * @param string $operator One of: <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne + * @param string|iterable $expectedVersion The expected version + * @param value-of $operator * @throws InvalidArgumentException */ - public function __construct($expectedVersion, $operator = '>=') + public function __construct(string|iterable $expectedVersion, string $operator = '>=') { - if (is_object($expectedVersion)) { - if (! $expectedVersion instanceof Traversable) { - throw new InvalidArgumentException( - 'Expected version number as string, array or traversable, got ' . get_class($expectedVersion) - ); - } - $this->version = $expectedVersion; - } elseif (! is_scalar($expectedVersion)) { - if (! is_array($expectedVersion)) { - throw new InvalidArgumentException( - 'Expected version number as string, array or traversable, got ' . gettype($expectedVersion) - ); - } - - $this->version = $expectedVersion; - } else { - $this->version = [$expectedVersion]; - } - - if (! is_scalar($operator)) { - throw new InvalidArgumentException( - 'Expected comparison operator as a string, got ' . gettype($operator) - ); - } + $this->version = is_string($expectedVersion) + ? [$expectedVersion] + : $expectedVersion; if ( - ! in_array($operator, [ - '<', - 'lt', - '<=', - 'le', - '>', - 'gt', - '>=', - 'ge', - '==', - '=', - 'eq', - '!=', - '<>', - 'ne', - ]) + ! in_array($operator, self::VALID_OPERATORS) ) { throw new InvalidArgumentException( 'Unknown comparison operator ' . $operator diff --git a/src/Check/SecurityAdvisory.php b/src/Check/SecurityAdvisory.php index a14a60b..93fe03e 100644 --- a/src/Check/SecurityAdvisory.php +++ b/src/Check/SecurityAdvisory.php @@ -18,10 +18,8 @@ use function count; use function file_exists; use function getcwd; -use function gettype; use function is_file; use function is_readable; -use function is_scalar; use function sprintf; use const DIRECTORY_SEPARATOR; @@ -41,7 +39,7 @@ class SecurityAdvisory extends AbstractCheck * @param string $lockFilePath Path to composer.lock * @throws InvalidArgumentException */ - public function __construct($lockFilePath = null) + public function __construct(string|null $lockFilePath = null) { if (! class_exists(AdvisoryAnalyzer::class)) { throw new InvalidArgumentException(sprintf( @@ -51,7 +49,7 @@ public function __construct($lockFilePath = null) )); } - if (! $lockFilePath) { + if ($lockFilePath === null) { if (! file_exists('composer.lock')) { throw new InvalidArgumentException( 'You have not provided lock file path and there is no "composer.lock" file in current directory.' @@ -59,11 +57,6 @@ public function __construct($lockFilePath = null) } $lockFilePath = getcwd() . DIRECTORY_SEPARATOR . 'composer.lock'; - } elseif (! is_scalar($lockFilePath)) { - throw new InvalidArgumentException(sprintf( - 'Invalid argument 2 provided for SecurityAdvisory check - expected file name (string) , got %s', - gettype($lockFilePath) - )); } $this->lockFilePath = $lockFilePath; diff --git a/src/Check/StreamWrapperExists.php b/src/Check/StreamWrapperExists.php index d22de69..3ef800c 100644 --- a/src/Check/StreamWrapperExists.php +++ b/src/Check/StreamWrapperExists.php @@ -5,16 +5,12 @@ use InvalidArgumentException; use Laminas\Diagnostics\Result\Failure; use Laminas\Diagnostics\Result\Success; -use Traversable; use function array_walk; use function count; use function current; -use function get_class; use function implode; use function in_array; -use function is_array; -use function is_object; use function is_string; use function sprintf; use function stream_get_wrappers; @@ -25,29 +21,15 @@ */ class StreamWrapperExists extends AbstractCheck implements CheckInterface { - /** @var array|Traversable */ + /** @var array */ protected $wrappers; /** - * @param string|array|Traversable $wrappers Stream wrapper name or an array of names + * @param string|array $wrappers Stream wrapper name or an array of names * @throws InvalidArgumentException */ - public function __construct($wrappers) + public function __construct(string|array $wrappers) { - if (is_object($wrappers) && ! $wrappers instanceof Traversable) { - throw new InvalidArgumentException(sprintf( - 'Expected a stream wrapper name (string), or an array or Traversable of strings;' - . ' received %s', - get_class($wrappers) - )); - } - - if (! is_object($wrappers) && ! is_array($wrappers) && ! is_string($wrappers)) { - throw new InvalidArgumentException( - 'Expected a stream wrapper name (string) or an array of strings' - ); - } - if (is_string($wrappers)) { $this->wrappers = [$wrappers]; } else { diff --git a/src/Result/Collection.php b/src/Result/Collection.php index 910ef90..092f2fb 100644 --- a/src/Result/Collection.php +++ b/src/Result/Collection.php @@ -14,6 +14,8 @@ /** * Utility class to store Results entities for corresponding Checks + * + * @template-extends SplObjectStorage */ class Collection extends SplObjectStorage { @@ -102,12 +104,7 @@ public function getUnknownCount() return $this->countUnknown; } - /** - * @link http://php.net/manual/en/splobjectstorage.offsetget.php - * - * @param object $index - * @return mixed - */ + /** @inheritDoc */ #[ReturnTypeWillChange] public function offsetGet($index) { @@ -116,12 +113,7 @@ public function offsetGet($index) return parent::offsetGet($index); } - /** - * @link http://php.net/manual/en/splobjectstorage.offsetexists.php - * - * @param object $index - * @return bool - */ + /** @inheritDoc */ #[ReturnTypeWillChange] public function offsetExists($index) { @@ -130,14 +122,7 @@ public function offsetExists($index) return parent::offsetExists($index); } - /** - * @link http://php.net/manual/en/splobjectstorage.offsetset.php - * - * @param object $index - * @param mixed|null $checkResult - * - * @return void - */ + /** @inheritDoc */ #[ReturnTypeWillChange] public function offsetSet($index, $checkResult = null) { @@ -156,13 +141,7 @@ public function offsetSet($index, $checkResult = null) $this->updateCounters($checkResult, 1); } - /** - * @link http://php.net/manual/en/splobjectstorage.offsetunset.php - * - * @param object $index - * - * @return void - */ + /** @inheritDoc */ #[ReturnTypeWillChange] public function offsetUnset($index) { @@ -200,6 +179,7 @@ protected function updateCounters(ResultInterface $result, $delta = 1) * Validate index object. * * @param mixed $index + * @psalm-assert CheckInterface $index * @return string * @throws InvalidArgumentException */ diff --git a/src/Runner/Reporter/BasicConsole.php b/src/Runner/Reporter/BasicConsole.php index cb48e44..e3751c8 100644 --- a/src/Runner/Reporter/BasicConsole.php +++ b/src/Runner/Reporter/BasicConsole.php @@ -112,20 +112,18 @@ public function onStart(ArrayObject $checks, $runnerConfig) } /** - * @see \Laminas\Diagnostics\Runner\Reporter\ReporterInterface - * + * @inheritDoc * @param string|null $checkAlias - * @return bool|void + * @return void */ public function onBeforeRun(CheckInterface $check, $checkAlias = null) { } /** - * @see \Laminas\Diagnostics\Runner\Reporter\ReporterInterface - * + * @inheritDoc * @param string|null $checkAlias - * @return bool|void + * @return void */ public function onAfterRun(CheckInterface $check, ResultInterface $result, $checkAlias = null) { @@ -166,9 +164,7 @@ public function onAfterRun(CheckInterface $check, ResultInterface $result, $chec $this->iteration++; } - /** - * @see \Laminas\Diagnostics\Runner\Reporter\ReporterInterface - */ + /** @inheritDoc */ public function onFinish(ResultsCollection $results) { $this->consoleWriteLn(); @@ -252,9 +248,7 @@ public function onFinish(ResultsCollection $results) } } - /** - * @see \Laminas\Diagnostics\Runner\Reporter\ReporterInterface - */ + /** @inheritDoc */ public function onStop(ResultsCollection $results) { $this->stopped = true; diff --git a/src/Runner/Runner.php b/src/Runner/Runner.php index 04fa39f..5df18f6 100644 --- a/src/Runner/Runner.php +++ b/src/Runner/Runner.php @@ -68,14 +68,14 @@ class Runner /** * An array of Checks to run. * - * @var ArrayObject + * @var ArrayObject */ protected $checks; /** * An array of reporters. * - * @var array|Traversable + * @var array */ protected $reporters = []; @@ -114,6 +114,7 @@ public function __construct($config = null, $checks = null, ?Reporter $reporter $this->setConfig($config); } + /** @var ArrayObject $this->checks */ $this->checks = new ArrayObject(); if ($checks !== null) { @@ -214,17 +215,13 @@ public function run($checkAlias = null) /** * Set config values from an array. * - * @param array|Traversable $config + * @param iterable $config * @throws InvalidArgumentException * @throws BadMethodCallException * @return $this */ - public function setConfig($config) + public function setConfig(iterable $config) { - if (! is_array($config) && ! $config instanceof Traversable) { - throw new InvalidArgumentException('Expected an array or Traversable as config for Runner.'); - } - foreach ($config as $key => $val) { $methodName = 'set' . implode(array_map(function ($value) { return ucfirst($value); @@ -306,7 +303,7 @@ public function addReporter(Reporter $reporter) */ public function removeReporter(Reporter $reporter) { - $this->reporters = array_filter($this->reporters, function (Reporter $r) use (&$reporter) { + $this->reporters = array_filter($this->reporters, function (Reporter $r) use ($reporter) { return $r !== $reporter; }); } @@ -331,7 +328,7 @@ public function getCheck($alias) } /** - * @return ArrayObject + * @return ArrayObject */ public function getChecks() { @@ -365,7 +362,7 @@ public function getBreakOnFailure() } /** - * @return array + * @return array */ public function getReporters() { diff --git a/test/AbstractMemoryTest.php b/test/AbstractMemoryTest.php index 73dcdce..1dc548c 100644 --- a/test/AbstractMemoryTest.php +++ b/test/AbstractMemoryTest.php @@ -30,12 +30,14 @@ public function invalidArgumentProvider(): array [105, 100], [10, -10], [10, 105], + ['-10', 10], + [10, '105'], ]; } /** - * @param string|int $warningThreshold - * @param string|int $criticalThreshold + * @param numeric $warningThreshold + * @param numeric $criticalThreshold */ abstract protected function createCheck($warningThreshold, $criticalThreshold): CheckInterface; } diff --git a/test/BasicConsoleReporterTest.php b/test/BasicConsoleReporterTest.php index e7ee264..9f3c5a2 100644 --- a/test/BasicConsoleReporterTest.php +++ b/test/BasicConsoleReporterTest.php @@ -50,7 +50,7 @@ public function testProgressDots(): void foreach ($checks as $alias => $check) { $result = new Success(); - $this->reporter->onAfterRun($check, $result, $alias); + $this->reporter->onAfterRun($check, $result, (string) $alias); } self::assertSame('.....', ob_get_clean()); @@ -66,7 +66,7 @@ public function testWarningSymbols(): void foreach ($checks as $alias => $check) { $result = new Warning(); - $this->reporter->onAfterRun($check, $result, $alias); + $this->reporter->onAfterRun($check, $result, (string) $alias); } self::assertSame('!!!!!', ob_get_clean()); @@ -82,7 +82,7 @@ public function testFailureSymbols(): void foreach ($checks as $alias => $check) { $result = new Failure(); - $this->reporter->onAfterRun($check, $result, $alias); + $this->reporter->onAfterRun($check, $result, (string) $alias); } self::assertSame('FFFFF', ob_get_clean()); @@ -98,7 +98,7 @@ public function testUnknownSymbols(): void foreach ($checks as $alias => $check) { $result = new Unknown(); - $this->reporter->onAfterRun($check, $result, $alias); + $this->reporter->onAfterRun($check, $result, (string) $alias); } self::assertSame('?????', ob_get_clean()); @@ -115,7 +115,7 @@ public function testProgressDotsNoGutter(): void foreach ($checks as $alias => $check) { $result = new Success(); - $this->reporter->onAfterRun($check, $result, $alias); + $this->reporter->onAfterRun($check, $result, (string) $alias); } self::assertSame(str_repeat('.', 40), ob_get_clean()); @@ -154,7 +154,7 @@ public function testProgressOverflowMatch(): void foreach ($checks as $alias => $check) { $result = new Success(); - $this->reporter->onAfterRun($check, $result, $alias); + $this->reporter->onAfterRun($check, $result, (string) $alias); } $expected = '......................... 25 / 75 ( 33%)'; diff --git a/test/ChecksTest.php b/test/ChecksTest.php index 5013256..8583fbb 100644 --- a/test/ChecksTest.php +++ b/test/ChecksTest.php @@ -36,6 +36,7 @@ use stdClass; use function array_rand; +use function assert; use function ceil; use function chmod; use function class_exists; @@ -43,7 +44,6 @@ use function fclose; use function file_exists; use function file_put_contents; -use function fopen; use function fwrite; use function get_loaded_extensions; use function getenv; @@ -63,6 +63,7 @@ use function strlen; use function substr; use function sys_get_temp_dir; +use function tempnam; use function tmpfile; use function uniqid; use function unlink; @@ -362,15 +363,6 @@ public function testPhpFlag(): void self::assertInstanceOf(Failure::class, $result = $check->check()); self::assertStringMatchesFormat('%A' . implode(', ', $allFalse) . '%Aenabled%A', $result->getMessage()); - $allFalse = new ArrayObject($allFalse); - $check = new PhpFlag($allFalse, false); - - self::assertInstanceOf(Success::class, $check->check()); - - $check = new PhpFlag($allFalse, true); - - self::assertInstanceOf(Failure::class, $check->check()); - $notAllFalse = $allFalse; foreach ($all as $name => $valueArray) { if ($valueArray['local_value'] === '1') { @@ -561,20 +553,8 @@ public function testDirWritable(): void self::assertInstanceOf(Success::class, $result, 'Single writable dir'); - // generate a random dir name - // phpcs:disable Generic.CodeAnalysis.EmptyStatement.DetectedWhile - while (($dir1 = $tmpDir . '/test' . mt_rand(1, PHP_INT_MAX)) && file_exists($dir1)) { - } - while (($dir2 = $tmpDir . '/test' . mt_rand(1, PHP_INT_MAX)) && file_exists($dir2)) { - } - // phpcs:enable Generic.CodeAnalysis.EmptyStatement.DetectedWhile - - // create temporary writable directories - if (! mkdir($dir1) || ! mkdir($dir2)) { - self::markTestSkipped('Cannot create unreadable temporary directory to perform the test... '); - - return; - } + $dir1 = $this->makeTemporaryDirectory(); + $dir2 = $this->makeTemporaryDirectory(); // we should now have 3 writable directories $check = new DirWritable([ @@ -760,27 +740,6 @@ public function testSecurityAdvisoryCheckerSuccess(): void self::assertInstanceOf(Success::class, $result); } - public function testPhpVersionInvalidVersion(): void - { - $this->expectException(InvalidArgumentException::class); - - new PhpVersion(new stdClass()); - } - - public function testPhpVersionInvalidVersion2(): void - { - $this->expectException(InvalidArgumentException::class); - - new PhpVersion(fopen('php://memory', 'r')); - } - - public function testPhpVersionInvalidOperator(): void - { - $this->expectException(InvalidArgumentException::class); - - new PhpVersion('1.0.0', []); - } - public function testPhpVersionInvalidOperator2(): void { $this->expectException(InvalidArgumentException::class); @@ -788,90 +747,6 @@ public function testPhpVersionInvalidOperator2(): void new PhpVersion('1.0.0', 'like'); } - public function testClassExistsInvalidArgument(): void - { - $this->expectException(InvalidArgumentException::class); - - new ClassExists(new stdClass()); - } - - public function testClassExistsInvalidArgument2(): void - { - $this->expectException(InvalidArgumentException::class); - - new ClassExists(15); - } - - public function testExtensionLoadedInvalidArgument(): void - { - $this->expectException(InvalidArgumentException::class); - - new ExtensionLoaded(new stdClass()); - } - - public function testExtensionLoadedInvalidArgument2(): void - { - $this->expectException(InvalidArgumentException::class); - - new ExtensionLoaded(15); - } - - public function testDirReadableInvalidArgument(): void - { - $this->expectException(InvalidArgumentException::class); - - new DirReadable(new stdClass()); - } - - public function testDirReadableInvalidArgument2(): void - { - $this->expectException(InvalidArgumentException::class); - - new DirReadable(15); - } - - public function testDirWritableInvalidArgument(): void - { - $this->expectException(InvalidArgumentException::class); - - new DirWritable(new stdClass()); - } - - public function testDirWritableInvalidArgument2(): void - { - $this->expectException(InvalidArgumentException::class); - - new DirWritable(15); - } - - public function testStreamWrapperInvalidArgument(): void - { - $this->expectException(InvalidArgumentException::class); - - new StreamWrapperExists(new stdClass()); - } - - public function testStreamWrapperInvalidInvalidArgument2(): void - { - $this->expectException(InvalidArgumentException::class); - - new StreamWrapperExists(15); - } - - public function testCallbackInvalidArgument(): void - { - $this->expectException(InvalidArgumentException::class); - - new Callback(15); - } - - public function testCallbackInvalidArgument2(): void - { - $this->expectException(InvalidArgumentException::class); - - new Callback([$this, 'foobarbar']); - } - public function testCpuPerformanceInvalidArgument(): void { $this->expectException(InvalidArgumentException::class); @@ -900,16 +775,6 @@ public function testProcessRunningInvalidArgument3(): void new ProcessRunning(''); } - /** - * @depends testSecurityAdvisory - */ - public function testSecurityAdvisoryInvalidArgument1(): void - { - $this->expectException(InvalidArgumentException::class); - - new SecurityAdvisory($this->createMock(AdvisoryAnalyzer::class), new stdClass()); - } - public function testAbstractFileCheckArgument1(): void { $temp = tmpfile(); @@ -935,33 +800,6 @@ public function testAbstractFileCheckArgument1(): void fclose($temp); } - public function testAbstractFileCheckInvalidArgument1(): void - { - // int - try { - new XmlFile(2); - self::fail('InvalidArguementException should be thrown here!'); - } catch (Exception $e) { - self::assertInstanceOf('InvalidArgumentException', $e); - } - - // bool - try { - new XmlFile(true); - self::fail('InvalidArguementException should be thrown here!'); - } catch (Exception $e) { - self::assertInstanceOf('InvalidArgumentException', $e); - } - - // object not implementing \Traversable - try { - new XmlFile(new stdClass()); - self::fail('InvalidArguementException should be thrown here!'); - } catch (Exception $e) { - self::assertInstanceOf('InvalidArgumentException', $e); - } - } - public function testXmlFileValid(): void { $temp = tmpfile(); @@ -1101,4 +939,21 @@ public function testJsonFileNotPresent(): void self::assertInstanceOf(FailureInterface::class, $check->check()); } + + private function makeTemporaryDirectory(): string + { + $tmpDir = sys_get_temp_dir(); + + if (! is_dir($tmpDir) || ! is_writable($tmpDir)) { + self::markTestSkipped('Cannot access writable system temp dir to perform the test... '); + } + + $dir = tempnam($tmpDir, 'test'); + + assert($dir !== false, 'Could not create a temporary file'); + assert(unlink($dir), 'Could not remove temporary file'); + assert(mkdir($dir), 'Could not create a temporary directory'); + + return $dir; + } } diff --git a/test/DiskFreeTest.php b/test/DiskFreeTest.php index 14d3770..60f052e 100644 --- a/test/DiskFreeTest.php +++ b/test/DiskFreeTest.php @@ -1,5 +1,7 @@ = count($prefixSymbol) - 4; $data[] = ["{$value}{$prefixSymbol[$i]}B", $jedec, $v]; @@ -190,20 +193,6 @@ public function testInvalidSizeParamThrowsException2(): void new DiskFree(-1, $this->getTempDir()); } - public function testInvalidSizeParamThrowsException3(): void - { - $this->expectException(InvalidArgumentException::class); - - new DiskFree([], $this->getTempDir()); - } - - public function testInvalidPathParamThrowsException(): void - { - $this->expectException(InvalidArgumentException::class); - - new DiskFree(1024, 100); - } - protected function getTempDir(): string { // try to retrieve tmp dir diff --git a/test/DiskUsageTest.php b/test/DiskUsageTest.php index 43ac40e..dd81566 100644 --- a/test/DiskUsageTest.php +++ b/test/DiskUsageTest.php @@ -1,5 +1,7 @@ getTempDir()], [5, 'Not an integer.', $this->getTempDir()], ['Not an integer.', 100, $this->getTempDir()], - [5, 100, []], + [-10.1, 100, $this->getTempDir()], [-10, 100, $this->getTempDir()], + ['-10', 100, $this->getTempDir()], [105, 100, $this->getTempDir()], + [105.1, 100, $this->getTempDir()], [10, -10, $this->getTempDir()], [10, 105, $this->getTempDir()], + [10, '105', $this->getTempDir()], + [10, 105.1, $this->getTempDir()], ]; } diff --git a/test/ElasticSearchTest.php b/test/ElasticSearchTest.php new file mode 100644 index 0000000..6cdda4e --- /dev/null +++ b/test/ElasticSearchTest.php @@ -0,0 +1,51 @@ + $expectedResult + * @throws Exception + */ + public function testElasticSearch(string $clusterStatus, string $expectedResult): void + { + $mockHandler = new MockHandler([new Response(200, [], $clusterStatus)]); + $mockClient = new Client(['handler' => $mockHandler]); + $check = new ElasticSearch('localhost:9200', [], [], $mockClient); + + // Assert the ElasticSearch check converts the API response to the correct ResultInterface implementation + $checkResult = $check->check(); + static::assertInstanceOf($expectedResult, $checkResult); + + // Assert ElasticSearch check returns extra data + $resultData = $checkResult->getData(); + static::assertIsArray($resultData); + static::assertArrayHasKey('responseTime', $resultData); + static::assertIsNumeric($resultData['responseTime']); + } + + /** @return non-empty-list}> */ + public function healthStatusProvider(): array + { + return [ + ["green\n", SuccessInterface::class], + ["yellow\n", WarningInterface::class], + ["red\n", FailureInterface::class], + ["unknown\n", FailureInterface::class], + ]; + } +} diff --git a/test/ExtensionLoadedTest.php b/test/ExtensionLoadedTest.php index c0a9890..087e1ff 100644 --- a/test/ExtensionLoadedTest.php +++ b/test/ExtensionLoadedTest.php @@ -1,30 +1,19 @@ expectException(InvalidArgumentException::class); - - new ExtensionLoaded($extensionName); - } - public function testCheck(): void { $check = new ExtensionLoaded('json'); @@ -54,15 +43,4 @@ public function testCheckMissingExtension(): void self::assertInstanceof(FailureInterface::class, $result); self::assertSame(['unknown-foo', 'unknown-bar'], $result->getData()); } - - /** - * @return array> - */ - public function invalidArgumentProvider(): array - { - return [ - [new stdClass()], - [100], - ]; - } } diff --git a/test/RunnerTest.php b/test/RunnerTest.php index d949ab8..f5ed7b0 100644 --- a/test/RunnerTest.php +++ b/test/RunnerTest.php @@ -1,5 +1,7 @@ runner->getConfig()); } - public function testInvalidValueForSetConfig(): void - { - $this->expectException(InvalidArgumentException::class); - - $this->runner->setConfig(10); - } - public function testUnknownValueInConfig(): void { $this->expectException(BadMethodCallException::class); @@ -332,21 +324,6 @@ public function testExceptionResultsInFailure(): void self::assertInstanceOf(Failure::class, $results[$check]); } - public function testPHPWarningResultsInFailure(): void - { - if (PHP_MAJOR_VERSION >= 8) { - self::markTestSkipped('Test case raises a TypeError under PHP 8, instead of a warning'); - } - - $check = new TriggerWarning(); - $this->runner->addCheck($check); - $results = $this->runner->run(); - - self::assertInstanceOf(Failure::class, $results[$check]); - self::assertInstanceOf(ErrorException::class, $results[$check]->getData()); - self::assertSame(E_WARNING, $results[$check]->getData()->getSeverity()); - } - public function testPHPUserErrorResultsInFailure(): void { $check = new TriggerUserError('error', E_USER_ERROR); diff --git a/test/TestAsset/Check/TriggerUserError.php b/test/TestAsset/Check/TriggerUserError.php index ea34f05..5a7db81 100644 --- a/test/TestAsset/Check/TriggerUserError.php +++ b/test/TestAsset/Check/TriggerUserError.php @@ -8,7 +8,7 @@ final class TriggerUserError extends AbstractCheck { - /** @var string */ + /** @var ?string */ protected $label = ''; private string $message; diff --git a/test/TestAsset/Reporter/AbstractReporter.php b/test/TestAsset/Reporter/AbstractReporter.php index cb7f1d7..befed72 100644 --- a/test/TestAsset/Reporter/AbstractReporter.php +++ b/test/TestAsset/Reporter/AbstractReporter.php @@ -10,17 +10,25 @@ abstract class AbstractReporter implements ReporterInterface { - /** @param array $runnerConfig */ + /** @inheritDoc */ public function onStart(ArrayObject $checks, $runnerConfig) { } - /** @param string|null $checkAlias */ + /** + * @inheritDoc + * @param string|null $checkAlias + * @return void + */ public function onBeforeRun(Check $check, $checkAlias = null) { } - /** @param string|null $checkAlias */ + /** + * @inheritDoc + * @param string|null $checkAlias + * @return void + */ public function onAfterRun(Check $check, Result $result, $checkAlias = null) { }