From ccdcf25cfa0e4e8beb073e982e4346948271f640 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 24 Feb 2023 00:17:07 +0000 Subject: [PATCH 1/3] chore(deps): update dependency vimeo/psalm to v5 --- composer.json | 2 +- composer.lock | 360 +++++++++++++++++++++++++++++++------------------- 2 files changed, 222 insertions(+), 140 deletions(-) diff --git a/composer.json b/composer.json index 5970e4c..66133ef 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "phpcompatibility/phpcompatibility-wp": "^2.1", "phpunit/phpunit": "^9", "psalm/plugin-phpunit": "^0.18.0", - "vimeo/psalm": "^4.7", + "vimeo/psalm": "^5.0", "wp-coding-standards/wpcs": "^2.3" }, "config": { diff --git a/composer.lock b/composer.lock index 49614e1..ed890d3 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": "5f164b65dca219a98239d64411b2294c", + "content-hash": "3c860d50dc5044f52f332949057e9716", "packages": [ { "name": "composer/installers", @@ -991,6 +991,67 @@ }, "time": "2022-03-02T22:36:06+00:00" }, + { + "name": "fidry/cpu-core-counter", + "version": "0.5.1", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/b58e5a3933e541dc286cc91fc4f3898bbc6f1623", + "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623", + "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.5.1" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2022-12-24T12:35:10+00:00" + }, { "name": "johnpbloch/wordpress-core", "version": "6.1.1", @@ -1205,59 +1266,6 @@ }, "time": "2023-01-16T22:05:37+00:00" }, - { - "name": "openlss/lib-array2xml", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/nullivex/lib-array2xml.git", - "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nullivex/lib-array2xml/zipball/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", - "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "LSS": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Bryan Tong", - "email": "bryan@nullivex.com", - "homepage": "https://www.nullivex.com" - }, - { - "name": "Tony Butler", - "email": "spudz76@gmail.com", - "homepage": "https://www.nullivex.com" - } - ], - "description": "Array2XML conversion library credit to lalit.org", - "homepage": "https://www.nullivex.com", - "keywords": [ - "array", - "array conversion", - "xml", - "xml conversion" - ], - "support": { - "issues": "https://github.com/nullivex/lib-array2xml/issues", - "source": "https://github.com/nullivex/lib-array2xml/tree/master" - }, - "time": "2019-03-29T20:06:56+00:00" - }, { "name": "phar-io/manifest", "version": "2.0.3", @@ -3352,6 +3360,70 @@ }, "time": "2023-01-05T18:45:16+00:00" }, + { + "name": "spatie/array-to-xml", + "version": "2.17.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/array-to-xml.git", + "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", + "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "php": "^7.4|^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.2", + "pestphp/pest": "^1.21", + "phpunit/phpunit": "^9.0", + "spatie/pest-plugin-snapshots": "^1.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\ArrayToXml\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://freek.dev", + "role": "Developer" + } + ], + "description": "Convert an array to xml", + "homepage": "https://github.com/spatie/array-to-xml", + "keywords": [ + "array", + "convert", + "xml" + ], + "support": { + "source": "https://github.com/spatie/array-to-xml/tree/2.17.1" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2022-12-26T08:22:07+00:00" + }, { "name": "squizlabs/php_codesniffer", "version": "3.7.2", @@ -3575,6 +3647,70 @@ ], "time": "2022-01-02T09:53:40+00:00" }, + { + "name": "symfony/filesystem", + "version": "v5.4.19", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "648bfaca6a494f3e22378123bcee2894045dc9d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/648bfaca6a494f3e22378123bcee2894045dc9d8", + "reference": "648bfaca6a494f3e22378123bcee2894045dc9d8", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.4.19" + }, + "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": "2023-01-14T19:14:44+00:00" + }, { "name": "symfony/polyfill-ctype", "version": "v1.27.0", @@ -4288,24 +4424,24 @@ }, { "name": "vimeo/psalm", - "version": "4.30.0", + "version": "5.7.5", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69" + "reference": "5390c212bab06ee230c8720c2e9c54b823db00c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/d0bc6e25d89f649e4f36a534f330f8bb4643dd69", - "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/5390c212bab06ee230c8720c2e9c54b823db00c8", + "reference": "5390c212bab06ee230c8720c2e9c54b823db00c8", "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": "*", @@ -4314,35 +4450,34 @@ "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.1 || ^0.5.1", "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 || ^5.0", + "spatie/array-to-xml": "^2.17.0 || ^3.0", + "symfony/console": "^4.1.6 || ^5.0 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0" }, "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.9", "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.6", + "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", @@ -4358,17 +4493,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/" } @@ -4386,13 +4518,14 @@ "keywords": [ "code", "inspection", - "php" + "php", + "static analysis" ], "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.7.5" }, - "time": "2022-11-06T20:37:08+00:00" + "time": "2023-02-21T16:02:51+00:00" }, { "name": "webmozart/assert", @@ -4452,57 +4585,6 @@ }, "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" - }, { "name": "wp-coding-standards/wpcs", "version": "2.3.0", From 080177da3887fa384f53804f8c16eb30de904359 Mon Sep 17 00:00:00 2001 From: Myrotvorets Date: Sat, 25 Feb 2023 02:18:57 +0200 Subject: [PATCH 2/3] Fix issues found by Psalm --- inc/class-plugin.php | 4 ++-- psalm.xml.dist | 9 ++++++++ redis.stubs | 52 ++++++++++++++++++++++---------------------- wordpress.stubs | 2 ++ 4 files changed, 39 insertions(+), 28 deletions(-) diff --git a/inc/class-plugin.php b/inc/class-plugin.php index fc32cf6..0cfa396 100644 --- a/inc/class-plugin.php +++ b/inc/class-plugin.php @@ -232,12 +232,12 @@ public function posts_clauses( array $clauses, WP_Query $query ): array { /** * @param string $status_header * @param int $code - * @param string $description + * @param string $_description * @param string $protocol * @return string * @global WP_Query|null $wp_query */ - public function status_header( $status_header, $code, $description, $protocol ) { + public function status_header( $status_header, $code, $_description, $protocol ) { /** @var WP_Query|null $wp_query */ global $wp_query; diff --git a/psalm.xml.dist b/psalm.xml.dist index 91b0603..46c3814 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -4,6 +4,8 @@ resolveFromConfigFile="true" phpVersion="7.4" findUnusedPsalmSuppress="true" + findUnusedCode="true" + findUnusedBaselineEntry="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" @@ -12,6 +14,13 @@ + + + + + + + diff --git a/redis.stubs b/redis.stubs index f0f8a37..304c6f1 100644 --- a/redis.stubs +++ b/redis.stubs @@ -31,7 +31,7 @@ class Redis { */ public function acl(string $subcmd, ...$args); - /** @return int|Redis */ + /** @return int|Redis */ public function append(string $key, mixed $value); public function auth(mixed $credentials): bool; @@ -79,10 +79,10 @@ class Redis { public function debug(string $key): string; - /** @return int|Redis */ + /** @return int|Redis */ public function decr(string $key); - /** @return int|Redis */ + /** @return int|Redis */ public function decrBy(string $key, int $value); /** @@ -101,7 +101,7 @@ class Redis { public function dump(string $key): string; - /** @return string|Redis */ + /** @return string|Redis */ public function echo(string $str); public function eval(string $script, array $keys = null, int $num_keys = 0): mixed; @@ -110,7 +110,7 @@ class Redis { public function exec(): array; - /** @return bool|Redis */ + /** @return bool|Redis */ public function exists(string $key); public function expire(string $key, int $timeout): bool; @@ -143,12 +143,12 @@ class Redis { public function geosearchstore(string $dst, string $src, array|string $position, array|int|float $shape, string $unit, array $options = []): array; - /** @return string|Redis */ + /** @return string|Redis */ public function get(string $key); public function getAuth(): mixed; - /** @return int|Redis */ + /** @return int|Redis */ public function getBit(string $key, int $idx); public function getEx(string $key, array $options = []): bool|string; @@ -169,12 +169,12 @@ class Redis { public function getPort(): int; - /** @return string|Redis */ + /** @return string|Redis */ public function getRange(string $key, int $start, int $end); public function getReadTimeout(): int; - /** @return string|Redis */ + /** @return string|Redis */ public function getset(string $key, mixed $value); public function getTimeout(): int; @@ -211,20 +211,20 @@ class Redis { public function hscan(string $key, ?int &$iterator, ?string $pattern = null, int $count = 0): bool|array; - /** @return int|Redis */ + /** @return int|Redis */ public function incr(string $key); - /** @return int|Redis */ + /** @return int|Redis */ public function incrBy(string $key, int $value); - /** @return int|Redis */ + /** @return int|Redis */ public function incrByFloat(string $key, float $value); public function info(string $opt = null): array; public function isConnected(): bool; - /** @return array|Redis */ + /** @return array|Redis */ public function keys(string $pattern); /** @@ -252,10 +252,10 @@ class Redis { */ public function rPush(string $key, ...$elements); - /** @return int|Redis */ + /** @return int|Redis */ public function lPushx(string $key, mixed $value); - /** @return int|Redis */ + /** @return int|Redis */ public function rPushx(string $key, mixed $value); public function lSet(string $key, int $index, string $value): bool; @@ -270,7 +270,7 @@ class Redis { public function ltrim(string $key, int $start , int $end): bool; - /** @return array|Redis */ + /** @return array|Redis */ public function mget(array $keys); public function migrate(string $host, int $port, string $key, string $dst, int $timeout, bool $copy = false, bool $replace = false): bool; @@ -305,7 +305,7 @@ public function persist(string $key): bool; public function pfmerge(string $dst, array $keys): bool; - /** @return string|Redis */ + /** @return string|Redis */ public function ping(string $key = NULL); public function pipeline(): bool|Redis; @@ -331,15 +331,15 @@ public function persist(string $key): bool; public function rPop(string $key, int $count = 0): bool|string|array; - /** @return string|Redis */ + /** @return string|Redis */ public function randomKey(); public function rawcommand(string $command, mixed ...$args): mixed; - /** @return bool|Redis */ + /** @return bool|Redis */ public function rename(string $key_src, string $key_dst); - /** @return bool|Redis */ + /** @return bool|Redis */ public function renameNx(string $key_src, string $key_dst); public function reset(): bool; @@ -389,10 +389,10 @@ public function persist(string $key): bool; /** @return bool|Redis */ public function set(string $key, mixed $value, mixed $opt = NULL); - /** @return int|Redis */ + /** @return int|Redis */ public function setBit(string $key, int $idx, bool $value); - /** @return int|Redis */ + /** @return int|Redis */ public function setRange(string $key, int $start, string $value); @@ -401,7 +401,7 @@ public function persist(string $key): bool; /** @return bool|Redis */ public function setex(string $key, int $expire, mixed $value); - /** @return bool|array|Redis */ + /** @return bool|array|Redis */ public function setnx(string $key, mixed $value); public function sismember(string $key, string $value): bool; @@ -436,7 +436,7 @@ public function persist(string $key): bool; public function sscan(string $key, ?int &$iterator, ?string $pattern = null, int $count = 0): array; - /** @return int|Redis */ + /** @return int|Redis */ public function strlen(string $key); public function subscribe(string $channel, string ...$other_channels): array; @@ -447,7 +447,7 @@ public function persist(string $key): bool; public function ttl(string $key): int; - /** @return int|Redis */ + /** @return int|Redis */ public function type(string $key); /** @@ -457,7 +457,7 @@ public function persist(string $key): bool; public function unsubscribe(string $channel, string ...$other_channels): array; - /** @return bool|Redis */ + /** @return bool|Redis */ public function unwatch(); /** diff --git a/wordpress.stubs b/wordpress.stubs index 038b335..da86a38 100644 --- a/wordpress.stubs +++ b/wordpress.stubs @@ -59,4 +59,6 @@ namespace { */ public function prepare( $query, ...$args ); } + + define( 'REDIS_HOST', expr ); } From c2a0ec1f630e2e5f57f09f3b36f2ddb286ca18f8 Mon Sep 17 00:00:00 2001 From: Myrotvorets Date: Sat, 25 Feb 2023 02:20:15 +0200 Subject: [PATCH 3/3] Update vimeo/psalm to 5.7.6 --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index ed890d3..f130773 100644 --- a/composer.lock +++ b/composer.lock @@ -4424,16 +4424,16 @@ }, { "name": "vimeo/psalm", - "version": "5.7.5", + "version": "5.7.6", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "5390c212bab06ee230c8720c2e9c54b823db00c8" + "reference": "ae4ec68e00e4880e3f00b1edd2da891236d749ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/5390c212bab06ee230c8720c2e9c54b823db00c8", - "reference": "5390c212bab06ee230c8720c2e9c54b823db00c8", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/ae4ec68e00e4880e3f00b1edd2da891236d749ab", + "reference": "ae4ec68e00e4880e3f00b1edd2da891236d749ab", "shasum": "" }, "require": { @@ -4523,9 +4523,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.7.5" + "source": "https://github.com/vimeo/psalm/tree/5.7.6" }, - "time": "2023-02-21T16:02:51+00:00" + "time": "2023-02-24T19:45:16+00:00" }, { "name": "webmozart/assert",