From 0444b73c82a1932089b69a894a8da1b19af98d1c Mon Sep 17 00:00:00 2001 From: Stephen Page Date: Mon, 30 Oct 2023 11:20:45 -0400 Subject: [PATCH 01/10] Try to fix the container undefined noise. --- src/Common/Contracts/Service_Provider.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Common/Contracts/Service_Provider.php b/src/Common/Contracts/Service_Provider.php index 29d3162b04..d752b38202 100644 --- a/src/Common/Contracts/Service_Provider.php +++ b/src/Common/Contracts/Service_Provider.php @@ -4,6 +4,14 @@ use TEC\Common\lucatume\DI52\ServiceProvider as DI52_Service_Provider; +/** + * Class ServiceProvider + * + * @package TEC\Common\Contracts + * + * @property bool $deferred + * @property TEC\Common\lucatume\DI52\Container $container + */ abstract class Service_Provider extends DI52_Service_Provider { // Intentionally empty. } From 7536f61cb057c921703a9d2bb8d761dead9de898 Mon Sep 17 00:00:00 2001 From: Stephen Page Date: Mon, 30 Oct 2023 11:41:56 -0400 Subject: [PATCH 02/10] Add phpstan per https://theeventscalendar.atlassian.net/browse/TECENG-44 Fix issue with undefined `$container` --- .github/workflows/phpstan.yml | 47 +++ composer.json | 11 +- composer.lock | 764 +++++++++++++++++++++++++--------- package-lock.json | 4 +- package.json | 1 + phpstan.neon | 6 + 6 files changed, 629 insertions(+), 204 deletions(-) create mode 100644 .github/workflows/phpstan.yml create mode 100755 phpstan.neon diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000000..df61b74be4 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,47 @@ +name: 'PHPStan Tests' +on: + pull_request: + paths: + - 'src/**.php' + - '*.php' +jobs: + phpstan: + strategy: + matrix: + phpVersion: [ + "7.4", + "8.0", + "8.1", + "8.2", + "8.3", + ] + runs-on: ubuntu-20.04 + steps: + - name: Checkout the repository + uses: actions/checkout@v2 + with: + fetch-depth: 1000 + submodules: recursive + # ------------------------------------------------------------------------------ + # Set up PHP and run phpstan + # ------------------------------------------------------------------------------ + - name: Configure PHP environment to run phpstan + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.phpVersion }} + # ------------------------------------------------------------------------------ + # Override composer php version + # ------------------------------------------------------------------------------ + - name: Set php version ${{ matrix.phpVersion }} in composer + run: composer config platform.php ${{ matrix.phpVersion }} + # ------------------------------------------------------------------------------ + # Install dependencies - ignoring php requirements + # ------------------------------------------------------------------------------ + - name: Install dependencies + run: composer i --ignore-platform-req=php+ + # ------------------------------------------------------------------------------ + # Run phpstan + # ------------------------------------------------------------------------------ + - name: Run phpstan + run: ./vendor/bin/phpstan analyse --error-format=table + diff --git a/composer.json b/composer.json index a1942a1cfe..5d8bef3dae 100644 --- a/composer.json +++ b/composer.json @@ -13,10 +13,11 @@ "config": { "preferred-install": "dist", "platform": { - "php": "7.3.33" + "php": "7.4" }, "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "phpstan/extension-installer": true } }, "require": { @@ -41,7 +42,11 @@ "the-events-calendar/coding-standards": "dev-master", "the-events-calendar/tec-testing-facilities": "dev-master", "wp-cli/checksum-command": "1.0.5", - "wp-coding-standards/wpcs": "^2.1" + "wp-coding-standards/wpcs": "^2.1", + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-deprecation-rules": "^1.1", + "phpstan/extension-installer": "^1.3", + "szepeviktor/phpstan-wordpress": "*" }, "repositories": [ { diff --git a/composer.lock b/composer.lock index 4c0748ad2d..b19b2ccb8d 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": "21a576846805bcaa49add0b200fe1fb4", + "content-hash": "05bc0eff83d7d9fea1dc9fcde25593b0", "packages": [ { "name": "firebase/php-jwt", @@ -70,16 +70,16 @@ }, { "name": "lucatume/di52", - "version": "3.3.3", + "version": "3.3.5", "source": { "type": "git", "url": "https://github.com/lucatume/di52", - "reference": "4185e21be2ac6c96bb1bb03970258352b6876bb2" + "reference": "d39d1cbbc57eb41c7aa21fab106e17b6938ec6b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lucatume/di52/zipball/4185e21be2ac6c96bb1bb03970258352b6876bb2", - "reference": "4185e21be2ac6c96bb1bb03970258352b6876bb2", + "url": "https://api.github.com/repos/lucatume/di52/zipball/d39d1cbbc57eb41c7aa21fab106e17b6938ec6b3", + "reference": "d39d1cbbc57eb41c7aa21fab106e17b6938ec6b3", "shasum": "" }, "require": { @@ -106,7 +106,7 @@ } ], "description": "A PHP 5.6 compatible dependency injection container.", - "time": "2023-04-28T07:39:10+00:00" + "time": "2023-09-01T08:49:32+00:00" }, { "name": "monolog/monolog", @@ -290,16 +290,16 @@ }, { "name": "stellarwp/container-contract", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/stellarwp/container-contract.git", - "reference": "b1568be99b4d2d38446895d31a1c0f3718bf4d36" + "reference": "b2c42c76681db314e4edbb2af0a312b6c06b495e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stellarwp/container-contract/zipball/b1568be99b4d2d38446895d31a1c0f3718bf4d36", - "reference": "b1568be99b4d2d38446895d31a1c0f3718bf4d36", + "url": "https://api.github.com/repos/stellarwp/container-contract/zipball/b2c42c76681db314e4edbb2af0a312b6c06b495e", + "reference": "b2c42c76681db314e4edbb2af0a312b6c06b495e", "shasum": "" }, "require": { @@ -331,22 +331,22 @@ ], "support": { "issues": "https://github.com/stellarwp/container-contract/issues", - "source": "https://github.com/stellarwp/container-contract/tree/1.1.0" + "source": "https://github.com/stellarwp/container-contract/tree/1.1.1" }, - "time": "2023-02-13T21:24:31+00:00" + "time": "2023-09-05T20:08:29+00:00" }, { "name": "stellarwp/db", - "version": "1.0.3", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/stellarwp/db.git", - "reference": "782daf58b6160478059baeb7e7d84d6127726067" + "reference": "e299e35869cb8092b48143a11509c1574cc33dc0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stellarwp/db/zipball/782daf58b6160478059baeb7e7d84d6127726067", - "reference": "782daf58b6160478059baeb7e7d84d6127726067", + "url": "https://api.github.com/repos/stellarwp/db/zipball/e299e35869cb8092b48143a11509c1574cc33dc0", + "reference": "e299e35869cb8092b48143a11509c1574cc33dc0", "shasum": "" }, "require-dev": { @@ -387,9 +387,9 @@ "description": "A WPDB wrapper and query builder library.", "support": { "issues": "https://github.com/stellarwp/db/issues", - "source": "https://github.com/stellarwp/db/tree/1.0.3" + "source": "https://github.com/stellarwp/db/tree/1.0.7" }, - "time": "2022-11-22T21:32:56+00:00" + "time": "2023-10-23T20:46:29+00:00" }, { "name": "stellarwp/installer", @@ -446,16 +446,16 @@ }, { "name": "stellarwp/telemetry", - "version": "2.0.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/stellarwp/telemetry.git", - "reference": "e02f117dd260fc3d55fae28ec1dcfccfb83c9ea9" + "reference": "38089cda35fe479c62c03ab4b02eb5a0a57c4f75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stellarwp/telemetry/zipball/e02f117dd260fc3d55fae28ec1dcfccfb83c9ea9", - "reference": "e02f117dd260fc3d55fae28ec1dcfccfb83c9ea9", + "url": "https://api.github.com/repos/stellarwp/telemetry/zipball/38089cda35fe479c62c03ab4b02eb5a0a57c4f75", + "reference": "38089cda35fe479c62c03ab4b02eb5a0a57c4f75", "shasum": "" }, "require": { @@ -490,7 +490,8 @@ }, "autoload-dev": { "psr-4": { - "StellarWP\\Telemetry\\Tests\\": "tests/" + "StellarWP\\Telemetry\\Tests\\": "tests/", + "StellarWP\\Telemetry\\Tests\\Support\\": "tests/_support/" } }, "scripts": { @@ -533,25 +534,25 @@ ], "description": "Telemetry library for StellarWP plugins.", "support": { - "source": "https://github.com/stellarwp/telemetry/tree/2.0.0", + "source": "https://github.com/stellarwp/telemetry/tree/2.2.0", "issues": "https://github.com/stellarwp/telemetry/issues" }, - "time": "2023-04-25T19:13:21+00:00" + "time": "2023-10-03T19:57:24+00:00" } ], "packages-dev": [ { "name": "antecedent/patchwork", - "version": "2.1.25", + "version": "2.1.26", "source": { "type": "git", "url": "https://github.com/antecedent/patchwork.git", - "reference": "17314e042d45e0dacb0a494c2d1ef50e7621136a" + "reference": "f2dae0851b2eae4c51969af740fdd0356d7f8f55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/antecedent/patchwork/zipball/17314e042d45e0dacb0a494c2d1ef50e7621136a", - "reference": "17314e042d45e0dacb0a494c2d1ef50e7621136a", + "url": "https://api.github.com/repos/antecedent/patchwork/zipball/f2dae0851b2eae4c51969af740fdd0356d7f8f55", + "reference": "f2dae0851b2eae4c51969af740fdd0356d7f8f55", "shasum": "" }, "require": { @@ -584,34 +585,34 @@ ], "support": { "issues": "https://github.com/antecedent/patchwork/issues", - "source": "https://github.com/antecedent/patchwork/tree/2.1.25" + "source": "https://github.com/antecedent/patchwork/tree/2.1.26" }, - "time": "2023-02-19T12:51:24+00:00" + "time": "2023-09-18T08:18:37+00:00" }, { "name": "automattic/vipwpcs", - "version": "2.3.3", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/Automattic/VIP-Coding-Standards.git", - "reference": "6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b" + "reference": "b8610e3837f49c5f2fcc4b663b6c0a7c9b3509b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b", - "reference": "6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b", + "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/b8610e3837f49c5f2fcc4b663b6c0a7c9b3509b6", + "reference": "b8610e3837f49c5f2fcc4b663b6c0a7c9b3509b6", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", "php": ">=5.4", - "sirbrillig/phpcs-variable-analysis": "^2.11.1", - "squizlabs/php_codesniffer": "^3.5.5", + "sirbrillig/phpcs-variable-analysis": "^2.11.17", + "squizlabs/php_codesniffer": "^3.7.1", "wp-coding-standards/wpcs": "^2.3" }, "require-dev": { - "php-parallel-lint/php-console-highlighter": "^0.5", - "php-parallel-lint/php-parallel-lint": "^1.0", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9", "phpcsstandards/phpcsdevtools": "^1.0", "phpunit/phpunit": "^4 || ^5 || ^6 || ^7" @@ -631,6 +632,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -638,7 +640,7 @@ "source": "https://github.com/Automattic/VIP-Coding-Standards", "wiki": "https://github.com/Automattic/VIP-Coding-Standards/wiki" }, - "time": "2021-09-29T16:20:23+00:00" + "time": "2023-08-24T15:11:13+00:00" }, { "name": "behat/gherkin", @@ -1056,28 +1058,28 @@ }, { "name": "doctrine/inflector", - "version": "2.0.6", + "version": "2.0.8", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024" + "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/d9d313a36c872fd6ee06d9a6cbcf713eaa40f024", - "reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/f9301a5b2fb1216b2b08f02ba04dc45423db6bff", + "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^10", + "doctrine/coding-standard": "^11.0", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-strict-rules": "^1.3", "phpunit/phpunit": "^8.5 || ^9.5", - "vimeo/psalm": "^4.25" + "vimeo/psalm": "^4.25 || ^5.4" }, "type": "library", "autoload": { @@ -1127,7 +1129,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.6" + "source": "https://github.com/doctrine/inflector/tree/2.0.8" }, "funding": [ { @@ -1143,7 +1145,7 @@ "type": "tidelift" } ], - "time": "2022-10-20T09:10:12+00:00" + "time": "2023-06-16T13:40:37+00:00" }, { "name": "doctrine/instantiator", @@ -1935,16 +1937,16 @@ }, { "name": "lucatume/wp-browser", - "version": "3.1.9", + "version": "3.1.10", "source": { "type": "git", "url": "https://github.com/lucatume/wp-browser.git", - "reference": "38e15758d2960d31ce6347bff843574f147d2630" + "reference": "d591a12891305b29ff0e1e08e2a173e6f915abf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lucatume/wp-browser/zipball/38e15758d2960d31ce6347bff843574f147d2630", - "reference": "38e15758d2960d31ce6347bff843574f147d2630", + "url": "https://api.github.com/repos/lucatume/wp-browser/zipball/d591a12891305b29ff0e1e08e2a173e6f915abf4", + "reference": "d591a12891305b29ff0e1e08e2a173e6f915abf4", "shasum": "" }, "require": { @@ -1973,11 +1975,10 @@ }, "require-dev": { "erusev/parsedown": "^1.7", - "ext-pcntl": "*", - "ext-sockets": "*", "gumlet/php-image-resize": "^1.6", "lucatume/codeception-snapshot-assertions": "^0.2", "mikey179/vfsstream": "^1.6", + "symfony/translation": "^3.4", "victorjonsson/markdowndocs": "dev-master", "vlucas/phpdotenv": "^3.0", "wp-cli/wp-cli-bundle": "*" @@ -2028,7 +2029,7 @@ ], "support": { "issues": "https://github.com/lucatume/wp-browser/issues", - "source": "https://github.com/lucatume/wp-browser/tree/3.1.9" + "source": "https://github.com/lucatume/wp-browser/tree/3.1.10" }, "funding": [ { @@ -2036,7 +2037,7 @@ "type": "github" } ], - "time": "2023-04-11T07:42:24+00:00" + "time": "2023-07-20T16:11:45+00:00" }, { "name": "mikehaertl/php-shellcommand", @@ -2260,25 +2261,29 @@ }, { "name": "nesbot/carbon", - "version": "2.67.0", + "version": "2.71.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "c1001b3bc75039b07f38a79db5237c4c529e04c8" + "reference": "98276233188583f2ff845a0f992a235472d9466a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/c1001b3bc75039b07f38a79db5237c4c529e04c8", - "reference": "c1001b3bc75039b07f38a79db5237c4c529e04c8", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/98276233188583f2ff845a0f992a235472d9466a", + "reference": "98276233188583f2ff845a0f992a235472d9466a", "shasum": "" }, "require": { "ext-json": "*", "php": "^7.1.8 || ^8.0", + "psr/clock": "^1.0", "symfony/polyfill-mbstring": "^1.0", "symfony/polyfill-php80": "^1.16", "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, + "provide": { + "psr/clock-implementation": "1.0" + }, "require-dev": { "doctrine/dbal": "^2.0 || ^3.1.4", "doctrine/orm": "^2.7", @@ -2358,7 +2363,7 @@ "type": "tidelift" } ], - "time": "2023-05-25T22:09:47+00:00" + "time": "2023-09-25T11:31:05+00:00" }, { "name": "nilportugues/sql-query-formatter", @@ -2529,6 +2534,51 @@ }, "time": "2017-03-05T17:38:23+00:00" }, + { + "name": "php-stubs/wordpress-stubs", + "version": "v6.3.2", + "source": { + "type": "git", + "url": "https://github.com/php-stubs/wordpress-stubs.git", + "reference": "f22b00cacd3b9addc2b07ff48290084503c48574" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/f22b00cacd3b9addc2b07ff48290084503c48574", + "reference": "f22b00cacd3b9addc2b07ff48290084503c48574", + "shasum": "" + }, + "require-dev": { + "nikic/php-parser": "^4.13", + "php": "^7.4 || ~8.0.0", + "php-stubs/generator": "^0.8.3", + "phpdocumentor/reflection-docblock": "^5.3", + "phpstan/phpstan": "^1.10.12", + "phpunit/phpunit": "^9.5" + }, + "suggest": { + "paragonie/sodium_compat": "Pure PHP implementation of libsodium", + "symfony/polyfill-php80": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress function and class declaration stubs for static analysis.", + "homepage": "https://github.com/php-stubs/wordpress-stubs", + "keywords": [ + "PHPStan", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/php-stubs/wordpress-stubs/issues", + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.3.2" + }, + "time": "2023-10-14T10:08:05+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", @@ -2756,6 +2806,207 @@ }, "time": "2020-03-05T15:02:03+00:00" }, + { + "name": "phpstan/extension-installer", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "f45734bfb9984c6c56c4486b71230355f066a58a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f45734bfb9984c6c56c4486b71230355f066a58a", + "reference": "f45734bfb9984c6c56c4486b71230355f066a58a", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.9.0" + }, + "require-dev": { + "composer/composer": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2.0", + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "support": { + "issues": "https://github.com/phpstan/extension-installer/issues", + "source": "https://github.com/phpstan/extension-installer/tree/1.3.1" + }, + "time": "2023-05-24T08:59:17+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.24.2", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "bcad8d995980440892759db0c32acae7c8e79442" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442", + "reference": "bcad8d995980440892759db0c32acae7c8e79442", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^4.15", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2" + }, + "time": "2023-09-26T12:28:12+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "1.10.40", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "93c84b5bf7669920d823631e39904d69b9c7dc5d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/93c84b5bf7669920d823631e39904d69b9c7dc5d", + "reference": "93c84b5bf7669920d823631e39904d69b9c7dc5d", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2023-10-30T14:48:31+00:00" + }, + { + "name": "phpstan/phpstan-deprecation-rules", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", + "reference": "089d8a8258ed0aeefdc7b68b6c3d25572ebfdbaa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/089d8a8258ed0aeefdc7b68b6c3d25572ebfdbaa", + "reference": "089d8a8258ed0aeefdc7b68b6c3d25572ebfdbaa", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.10.3" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-php-parser": "^1.1", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^9.5" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", + "support": { + "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.1.4" + }, + "time": "2023-08-05T09:02:04+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "5.3.2", @@ -3179,6 +3430,54 @@ "abandoned": true, "time": "2018-08-09T05:50:03+00:00" }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, { "name": "psr/http-message", "version": "1.1", @@ -3327,66 +3626,6 @@ }, "time": "2019-03-08T08:55:37+00:00" }, - { - "name": "rmccue/requests", - "version": "v1.8.1", - "source": { - "type": "git", - "url": "https://github.com/WordPress/Requests.git", - "reference": "82e6936366eac3af4d836c18b9d8c31028fe4cd5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/WordPress/Requests/zipball/82e6936366eac3af4d836c18b9d8c31028fe4cd5", - "reference": "82e6936366eac3af4d836c18b9d8c31028fe4cd5", - "shasum": "" - }, - "require": { - "php": ">=5.2" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", - "php-parallel-lint/php-console-highlighter": "^0.5.0", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpcompatibility/php-compatibility": "^9.0", - "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5", - "requests/test-server": "dev-master", - "squizlabs/php_codesniffer": "^3.5", - "wp-coding-standards/wpcs": "^2.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Requests": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Ryan McCue", - "homepage": "http://ryanmccue.info" - } - ], - "description": "A HTTP library written in PHP, for human beings.", - "homepage": "http://github.com/WordPress/Requests", - "keywords": [ - "curl", - "fsockopen", - "http", - "idna", - "ipv6", - "iri", - "sockets" - ], - "support": { - "issues": "https://github.com/WordPress/Requests/issues", - "source": "https://github.com/WordPress/Requests/tree/v1.8.1" - }, - "time": "2021-06-04T09:56:25+00:00" - }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.2", @@ -4022,16 +4261,16 @@ }, { "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.11.16", + "version": "v2.11.17", "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "dc5582dc5a93a235557af73e523c389aac9a8e88" + "reference": "3b71162a6bf0cde2bff1752e40a1788d8273d049" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/dc5582dc5a93a235557af73e523c389aac9a8e88", - "reference": "dc5582dc5a93a235557af73e523c389aac9a8e88", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/3b71162a6bf0cde2bff1752e40a1788d8273d049", + "reference": "3b71162a6bf0cde2bff1752e40a1788d8273d049", "shasum": "" }, "require": { @@ -4076,7 +4315,72 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2023-03-31T16:46:32+00:00" + "time": "2023-08-05T23:46:11+00:00" + }, + { + "name": "slevomat/coding-standard", + "version": "8.14.1", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", + "php": "^7.2 || ^8.0", + "phpstan/phpdoc-parser": "^1.23.1", + "squizlabs/php_codesniffer": "^3.7.1" + }, + "require-dev": { + "phing/phing": "2.17.4", + "php-parallel-lint/php-parallel-lint": "1.3.2", + "phpstan/phpstan": "1.10.37", + "phpstan/phpstan-deprecation-rules": "1.1.4", + "phpstan/phpstan-phpunit": "1.3.14", + "phpstan/phpstan-strict-rules": "1.5.1", + "phpunit/phpunit": "8.5.21|9.6.8|10.3.5" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "keywords": [ + "dev", + "phpcs" + ], + "support": { + "issues": "https://github.com/slevomat/coding-standard/issues", + "source": "https://github.com/slevomat/coding-standard/tree/8.14.1" + }, + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2023-10-08T07:28:08+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -4731,16 +5035,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { @@ -4755,7 +5059,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4793,7 +5097,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -4809,20 +5113,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "639084e360537a19f9ee352433b84ce831f3d2da" + "reference": "ecaafce9f77234a6a449d29e49267ba10499116d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/639084e360537a19f9ee352433b84ce831f3d2da", - "reference": "639084e360537a19f9ee352433b84ce831f3d2da", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/ecaafce9f77234a6a449d29e49267ba10499116d", + "reference": "ecaafce9f77234a6a449d29e49267ba10499116d", "shasum": "" }, "require": { @@ -4836,7 +5140,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4880,7 +5184,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.28.0" }, "funding": [ { @@ -4896,20 +5200,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:30:37+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", "shasum": "" }, "require": { @@ -4921,7 +5225,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4964,7 +5268,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" }, "funding": [ { @@ -4980,20 +5284,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -5008,7 +5312,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5047,7 +5351,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -5063,20 +5367,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", "shasum": "" }, "require": { @@ -5085,7 +5389,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5123,7 +5427,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" }, "funding": [ { @@ -5139,20 +5443,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", "shasum": "" }, "require": { @@ -5161,7 +5465,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5202,7 +5506,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" }, "funding": [ { @@ -5218,20 +5522,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -5240,7 +5544,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5285,7 +5589,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -5301,7 +5605,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/process", @@ -5692,31 +5996,94 @@ ], "time": "2022-08-02T15:47:23+00:00" }, + { + "name": "szepeviktor/phpstan-wordpress", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/szepeviktor/phpstan-wordpress.git", + "reference": "b8516ed6bab7ec50aae981698ce3f67f1be2e45a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/b8516ed6bab7ec50aae981698ce3f67f1be2e45a", + "reference": "b8516ed6bab7ec50aae981698ce3f67f1be2e45a", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0", + "phpstan/phpstan": "^1.10.30", + "symfony/polyfill-php73": "^1.12.0" + }, + "require-dev": { + "composer/composer": "^2.1.14", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.1", + "phpstan/phpstan-strict-rules": "^1.2", + "phpunit/phpunit": "^8.0 || ^9.0", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.8" + }, + "suggest": { + "swissspidy/phpstan-no-private": "Detect usage of internal core functions, classes and methods" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "SzepeViktor\\PHPStan\\WordPress\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress extensions for PHPStan", + "keywords": [ + "PHPStan", + "code analyse", + "code analysis", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.3.2" + }, + "time": "2023-10-16T17:23:56+00:00" + }, { "name": "the-events-calendar/coding-standards", "version": "dev-master", "source": { "type": "git", "url": "https://github.com/the-events-calendar/coding-standards", - "reference": "a6c655ae65d0782299f518b04343dceee2d096e5" + "reference": "854043c83779599ef3531e6c8a8b2454c5de683f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/the-events-calendar/coding-standards/zipball/a6c655ae65d0782299f518b04343dceee2d096e5", - "reference": "a6c655ae65d0782299f518b04343dceee2d096e5", + "url": "https://api.github.com/repos/the-events-calendar/coding-standards/zipball/854043c83779599ef3531e6c8a8b2454c5de683f", + "reference": "854043c83779599ef3531e6c8a8b2454c5de683f", "shasum": "" }, "require": { "php": ">=5.6", + "slevomat/coding-standard": "^8.14", "squizlabs/php_codesniffer": "^3.3.1", - "wp-coding-standards/wpcs": "^2.1" + "wp-coding-standards/wpcs": "^2.1 | ^3.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5", + "dealerdirect/phpcodesniffer-composer-installer": "*", "phpcompatibility/php-compatibility": "^9" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." }, "default-branch": true, "type": "phpcodesniffer-standard", @@ -5759,7 +6126,7 @@ "phpcs", "standards" ], - "time": "2022-08-10T16:50:50+00:00" + "time": "2023-10-20T14:50:46+00:00" }, { "name": "the-events-calendar/tec-testing-facilities", @@ -6182,16 +6549,16 @@ }, { "name": "wp-cli/php-cli-tools", - "version": "v0.11.18", + "version": "v0.11.21", "source": { "type": "git", "url": "https://github.com/wp-cli/php-cli-tools.git", - "reference": "0f503a790698cb36cf835e5c8d09cd4b64bf2325" + "reference": "b3457a8d60cd0b1c48cab76ad95df136d266f0b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/0f503a790698cb36cf835e5c8d09cd4b64bf2325", - "reference": "0f503a790698cb36cf835e5c8d09cd4b64bf2325", + "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/b3457a8d60cd0b1c48cab76ad95df136d266f0b6", + "reference": "b3457a8d60cd0b1c48cab76ad95df136d266f0b6", "shasum": "" }, "require": { @@ -6199,7 +6566,7 @@ }, "require-dev": { "roave/security-advisories": "dev-latest", - "wp-cli/wp-cli-tests": "^3.1.6" + "wp-cli/wp-cli-tests": "^4" }, "type": "library", "extra": { @@ -6239,29 +6606,28 @@ ], "support": { "issues": "https://github.com/wp-cli/php-cli-tools/issues", - "source": "https://github.com/wp-cli/php-cli-tools/tree/v0.11.18" + "source": "https://github.com/wp-cli/php-cli-tools/tree/v0.11.21" }, - "time": "2023-04-04T16:03:53+00:00" + "time": "2023-09-29T15:28:10+00:00" }, { "name": "wp-cli/wp-cli", - "version": "v2.7.1", + "version": "v2.9.0", "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli.git", - "reference": "1ddc754f1c15e56fb2cdd1a4e82bd0ec6ca32a76" + "reference": "8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/1ddc754f1c15e56fb2cdd1a4e82bd0ec6ca32a76", - "reference": "1ddc754f1c15e56fb2cdd1a4e82bd0ec6ca32a76", + "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7", + "reference": "8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7", "shasum": "" }, "require": { "ext-curl": "*", "mustache/mustache": "^2.14.1", "php": "^5.6 || ^7.0 || ^8.0", - "rmccue/requests": "^1.8", "symfony/finder": ">2.7", "wp-cli/mustangostang-spyc": "^0.6.3", "wp-cli/php-cli-tools": "~0.11.2" @@ -6272,7 +6638,7 @@ "wp-cli/entity-command": "^1.2 || ^2", "wp-cli/extension-command": "^1.1 || ^2", "wp-cli/package-command": "^1 || ^2", - "wp-cli/wp-cli-tests": "^3.1.6" + "wp-cli/wp-cli-tests": "^4.0.1" }, "suggest": { "ext-readline": "Include for a better --prompt implementation", @@ -6285,7 +6651,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8.x-dev" + "dev-main": "2.9.x-dev" } }, "autoload": { @@ -6312,7 +6678,7 @@ "issues": "https://github.com/wp-cli/wp-cli/issues", "source": "https://github.com/wp-cli/wp-cli" }, - "time": "2022-10-17T23:10:42+00:00" + "time": "2023-10-25T09:06:37+00:00" }, { "name": "wp-coding-standards/wpcs", @@ -6435,5 +6801,5 @@ "platform-overrides": { "php": "7.3.33" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/package-lock.json b/package-lock.json index 1bbee5277c..0624300f7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tribe-common", - "version": "5.1.12", + "version": "5.1.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tribe-common", - "version": "5.1.12", + "version": "5.1.11", "dependencies": { "@babel/runtime": "^7.15.3", "@moderntribe/common": "file:src/modules", diff --git a/package.json b/package.json index 5fe6f10e84..21ffabebf7 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "rebuild": "rm -rf node_modules && npm install && npm run build", "dev": "export NODE_OPTIONS=--openssl-legacy-provider && cross-env NODE_ENV=development webpack -d --watch", "preanalyze": "cross-env NODE_ENV=production webpack -p --profile --json > stats.json", + "phpstan": "vendor/bin/phpstan analyse --configuration=phpstan.neon --level=0 --memory-limit=1G", "lint": "npm run lint:eslint && npm run lint:stylelint", "lint:eslint": "gulp eslint", "lint:stylelint": "gulp stylelint", diff --git a/phpstan.neon b/phpstan.neon new file mode 100755 index 0000000000..806efa1546 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,6 @@ +parameters: + level: 0 + paths: + - src + - tribe-common.php + - tribe-autoload.php \ No newline at end of file From 46d5704b656307fe6882c1259a6f3fe76c643ccf Mon Sep 17 00:00:00 2001 From: Stephen Page Date: Wed, 1 Nov 2023 11:11:34 -0400 Subject: [PATCH 03/10] Add our libraries --- phpstan.neon | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 806efa1546..8206884439 100755 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,4 +3,6 @@ parameters: paths: - src - tribe-common.php - - tribe-autoload.php \ No newline at end of file + - tribe-autoload.php + scanDirectories: + - vendor/vendor-prefixed \ No newline at end of file From 487a8e798bce557691897fb69ba488a050677d3d Mon Sep 17 00:00:00 2001 From: Stephen Page Date: Wed, 1 Nov 2023 11:40:46 -0400 Subject: [PATCH 04/10] Fix some phpstan notifications --- src/Common/Integrations/Integration_Abstract.php | 1 + src/Common/Storage/Timed_Option.php | 1 + src/Common/Telemetry/Telemetry.php | 4 +++- src/Tribe/Admin/Activation_Page.php | 7 ++++--- .../Conditional_Content/Datetime_Conditional_Abstract.php | 4 ++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Common/Integrations/Integration_Abstract.php b/src/Common/Integrations/Integration_Abstract.php index 198bc0dd87..89d66adc21 100644 --- a/src/Common/Integrations/Integration_Abstract.php +++ b/src/Common/Integrations/Integration_Abstract.php @@ -86,6 +86,7 @@ protected function filter_should_load( bool $value ): bool { * @since 5.1.1 * * @param bool $value Whether the integration should load. + * @param string $parent Parent of the integration we are loading. * @param string $type Type of integration we are loading. * @param string $slug Slug of the integration we are loading. */ diff --git a/src/Common/Storage/Timed_Option.php b/src/Common/Storage/Timed_Option.php index 5b9d51959f..93d19b9461 100644 --- a/src/Common/Storage/Timed_Option.php +++ b/src/Common/Storage/Timed_Option.php @@ -96,6 +96,7 @@ public function get_option_name( string $key ): string { * @since 5.0.6 * * @param string $option_name Name of the option where all the transient data will live. + * @param string $option_name_prefix The option prefix used. */ return (string) apply_filters( 'tec_common_timed_option_name', $this->option_name_prefix . $key, $this->option_name_prefix ); } diff --git a/src/Common/Telemetry/Telemetry.php b/src/Common/Telemetry/Telemetry.php index 3b40f8514d..66900f824f 100644 --- a/src/Common/Telemetry/Telemetry.php +++ b/src/Common/Telemetry/Telemetry.php @@ -398,8 +398,10 @@ public function show_optin_modal( $slug ): void { * * @since 5.1.0 * - * @param bool $show Whether to show the modal or not. + * @param bool $show Whether to show the modal or not. + * @param string $slug The slug of the plugin showing the modal. * + * @return bool $show Whether to show the modal or not. */ $show = (bool) apply_filters( 'tec_common_telemetry_show_optin_modal', true, $slug ); diff --git a/src/Tribe/Admin/Activation_Page.php b/src/Tribe/Admin/Activation_Page.php index c9db44099d..c74a52370f 100644 --- a/src/Tribe/Admin/Activation_Page.php +++ b/src/Tribe/Admin/Activation_Page.php @@ -86,8 +86,8 @@ public function hooks() { add_action( 'admin_init', [ $this, 'maybe_redirect' ], 10, 0 ); add_action( 'admin_menu', [ $this, 'register_page' ], 100, 0 ); // Come in after the default page is registered. - add_action( 'update_plugin_complete_actions', [ $this, 'update_complete_actions' ], 15, 2 ); - add_action( 'update_bulk_plugins_complete_actions', [ $this, 'update_complete_actions' ], 15, 2 ); + add_filter( 'update_plugin_complete_actions', [ $this, 'update_complete_actions' ], 15, 2 ); + add_filter( 'update_bulk_plugins_complete_actions', [ $this, 'update_complete_actions' ], 15, 2 ); } /** @@ -170,6 +170,7 @@ public function maybe_redirect() { * @since 5.0.0 * * @param $bypass bool + * @param $activation_page Tribe__Admin__Activation_Page */ $bypass_update_page = apply_filters( 'tec_admin_update_page_bypass', false, $this ); @@ -337,7 +338,7 @@ protected function disable_default_settings_page() { * * @param string $context * - * @return string|null + * @return void */ public function display_page() { if ( empty( $this->args[ $this->current_context . '_page_title' ] ) || empty( $this->args[ $this->current_context . '_page_template'] ) ) { diff --git a/src/Tribe/Admin/Conditional_Content/Datetime_Conditional_Abstract.php b/src/Tribe/Admin/Conditional_Content/Datetime_Conditional_Abstract.php index 47c93351c3..ea03b7e3dc 100644 --- a/src/Tribe/Admin/Conditional_Content/Datetime_Conditional_Abstract.php +++ b/src/Tribe/Admin/Conditional_Content/Datetime_Conditional_Abstract.php @@ -80,8 +80,8 @@ protected function get_start_time() { * Allow filtering of the start date for testing. * * @since 4.14.7 - * @param \DateTime $date - Unix timestamp for start date - * @param object $this + * @param \DateTime $date Unix timestamp for start date + * @param object $notice The date-based notice object. */ $date = apply_filters( "tec_admin_conditional_content_{$this->slug}_start_date", $date, $this ); From d587319ccf8f2e97189d8b289e98bc22a9217524 Mon Sep 17 00:00:00 2001 From: Stephen Page Date: Wed, 1 Nov 2023 12:28:39 -0400 Subject: [PATCH 05/10] Address more phpstan --- src/Tribe/Admin/Activation_Page.php | 4 ++-- .../Datetime_Conditional_Abstract.php | 8 ++++---- src/Tribe/Editor/Blocks/Abstract.php | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Tribe/Admin/Activation_Page.php b/src/Tribe/Admin/Activation_Page.php index c74a52370f..85caff2d91 100644 --- a/src/Tribe/Admin/Activation_Page.php +++ b/src/Tribe/Admin/Activation_Page.php @@ -169,8 +169,8 @@ public function maybe_redirect() { * * @since 5.0.0 * - * @param $bypass bool - * @param $activation_page Tribe__Admin__Activation_Page + * @param bool $bypass + * @param Tribe__Admin__Activation_Page $activation_page */ $bypass_update_page = apply_filters( 'tec_admin_update_page_bypass', false, $this ); diff --git a/src/Tribe/Admin/Conditional_Content/Datetime_Conditional_Abstract.php b/src/Tribe/Admin/Conditional_Content/Datetime_Conditional_Abstract.php index ea03b7e3dc..8eb9ea86e7 100644 --- a/src/Tribe/Admin/Conditional_Content/Datetime_Conditional_Abstract.php +++ b/src/Tribe/Admin/Conditional_Content/Datetime_Conditional_Abstract.php @@ -107,8 +107,8 @@ protected function get_end_time() { * Allow filtering of the end date for testing. * * @since 4.14.7 - * @param \DateTime $date - Unix timestamp for end date - * @param object $this + * @param \DateTime $date Unix timestamp for end date + * @param object $notice The date-based notice object. */ $date = apply_filters( "tec_admin_conditional_content_{$this->slug}_end_date", $date, $this ); @@ -131,8 +131,8 @@ protected function should_display() { * Allow filtering whether the content should display. * * @since 4.14.7 - * @param bool $should_display - whether the content should display - * @param object $this - the conditional content object + * @param bool $should_display Whether the content should display + * @param object $notice The date-based notice object. */ $should_display = apply_filters( "tec_admin_conditional_content_{$this->slug}_should_display", $display, $this ); diff --git a/src/Tribe/Editor/Blocks/Abstract.php b/src/Tribe/Editor/Blocks/Abstract.php index 864f394e48..b8e6d04014 100644 --- a/src/Tribe/Editor/Blocks/Abstract.php +++ b/src/Tribe/Editor/Blocks/Abstract.php @@ -61,8 +61,8 @@ public function attributes( $params = [] ) { /** * Filters the default attributes for the block * - * @param array $attributes The attributes - * @param object $this The current object + * @param array $attributes The attributes + * @param object $block_object The current object */ $attributes = apply_filters( 'tribe_block_attributes_defaults_' . $this->slug(), $attributes, $this ); @@ -85,8 +85,8 @@ public function default_attributes() { /** * Filters the default attributes * - * @param array $params The attributes - * @param object $this The current object + * @param array $params The attributes + * @param object $block_object The current object */ $attributes = apply_filters( 'tribe_block_attributes_defaults', $attributes, $this ); @@ -263,8 +263,8 @@ public function block_data() { * * @since 4.12.0 * - * @param array $block_data The block data. - * @param object $this The current object. + * @param array $block_data The block data. + * @param object $block_object The current object */ $block_data = apply_filters( 'tribe_block_block_data', $block_data, $this ); @@ -273,8 +273,8 @@ public function block_data() { * * @since 4.12.0 * - * @param array $block_data The block data. - * @param object $this The current object. + * @param array $block_data The block data. + * @param object $block_object The current object */ $block_data = apply_filters( 'tribe_block_block_data_' . $this->slug(), $block_data, $this ); From 67e0abecf36ae441d530ef10b30f66f1bd711998 Mon Sep 17 00:00:00 2001 From: Stephen Page Date: Wed, 1 Nov 2023 12:39:54 -0400 Subject: [PATCH 06/10] Moar phpstan! --- src/Tribe/Admin/Helpers.php | 2 +- src/Tribe/Admin/Notice/Date_Based.php | 14 ++++++++------ src/Tribe/Admin/Notice/Marketing.php | 4 ++-- src/Tribe/Admin/Notice/Php_Version.php | 2 +- src/Tribe/Extension.php | 2 +- src/functions/utils.php | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Tribe/Admin/Helpers.php b/src/Tribe/Admin/Helpers.php index 7f1d832b29..b73b90dd16 100644 --- a/src/Tribe/Admin/Helpers.php +++ b/src/Tribe/Admin/Helpers.php @@ -44,7 +44,7 @@ public function is_wp_screen() { * Allows fo filter if we're on a WP_Screen * * @since 4.9.5 - * @param bool null bypass if we want to return a bool of is_wp_scren + * @param bool|null $bypass return non-null if we want to short-circuit and return a bool for is_wp_screen */ $is_wp_screen = apply_filters( 'tribe_admin_is_wp_screen', null ); if ( null !== $is_wp_screen ) { diff --git a/src/Tribe/Admin/Notice/Date_Based.php b/src/Tribe/Admin/Notice/Date_Based.php index d3ae9ac9e1..a8d483e53c 100644 --- a/src/Tribe/Admin/Notice/Date_Based.php +++ b/src/Tribe/Admin/Notice/Date_Based.php @@ -260,14 +260,13 @@ public function should_display() { $should_display = $notice_start <= $now && $now < $notice_end; - /** * Allow filtering of whether the notice should display. * * @since 4.14.2 * - * @param boolean $should_display Whether the notice should display. - * @param Tribe__Admin__Notice_Date_Based $notice The notice object. + * @param boolean $should_display Whether the notice should display. + * @param Date_Based $notice The notice object. */ return apply_filters( "tribe_{$this->slug}_notice_should_display", $should_display, $this ); } @@ -291,7 +290,8 @@ public function get_start_time() { * * @since 4.14.2 * - * @param \DateTime $date Date object for the notice start. + * @param \DateTime $date Date object for the notice start. + * @param Date_Based $notice The notice object. */ $date = apply_filters( "tribe_{$this->slug}_notice_start_date", $date, $this ); @@ -317,7 +317,8 @@ public function get_end_time() { * * @since 4.14.2 * - * @param \DateTime $date Date object for the notice end. + * @param \DateTime $date Date object for the notice end. + * @param Date_Based $notice The notice object. */ $date = apply_filters( "tribe_{$this->slug}_notice_end_date", $date, $this ); @@ -348,7 +349,8 @@ public function get_extension_time() { * * @since 4.14.2 * - * @param \DateTime $date Date object for the notice end. + * @param \DateTime $date Date object for the notice end. + * @param Date_Based $notice The notice object. */ $date = apply_filters( "tribe_{$this->slug}_notice_extension_date", $date, $this ); diff --git a/src/Tribe/Admin/Notice/Marketing.php b/src/Tribe/Admin/Notice/Marketing.php index ecb017af2e..858f3675ae 100644 --- a/src/Tribe/Admin/Notice/Marketing.php +++ b/src/Tribe/Admin/Notice/Marketing.php @@ -89,7 +89,7 @@ public function get_black_friday_start_time() { * * @since 4.12.14 * - * @param int $bf_start_date Unix time for the Monday of Thanksgiving week @ 6am UTC. + * @param string $bf_start_date Numeric string: Unix time for the Monday of Thanksgiving week @ 6am UTC. */ return apply_filters( 'tribe_black_friday_start_time', $start_time ); } @@ -115,7 +115,7 @@ public function get_black_friday_end_time() { * * @since 4.12.14 * - * @param int $bf_end_date Unix time for Dec 1 @ 6am UTC. + * @param string $bf_end_date Numeric string: Unix time for Dec 1 @ 6am UTC. */ return apply_filters( 'tribe_black_friday_end_time', $end_time ); } diff --git a/src/Tribe/Admin/Notice/Php_Version.php b/src/Tribe/Admin/Notice/Php_Version.php index cfb18e4eeb..064cca0479 100644 --- a/src/Tribe/Admin/Notice/Php_Version.php +++ b/src/Tribe/Admin/Notice/Php_Version.php @@ -29,7 +29,7 @@ public function hook() { */ public function get_active_plugins() { - $active_plugins = Tribe__Dependency::instance()->get_active_plugins(); + $active_plugins = tribe( Tribe__Dependency::class )->get_active_plugins(); foreach ( $active_plugins as $active_plugin ) { diff --git a/src/Tribe/Extension.php b/src/Tribe/Extension.php index 021008bebf..940697ad82 100644 --- a/src/Tribe/Extension.php +++ b/src/Tribe/Extension.php @@ -172,7 +172,7 @@ final public function register() { $plugins_required ); - $dependency = Tribe__Dependency::instance(); + $dependency = tribe( Tribe__Dependency::class ); // check requisite plugins are active for this extension $is_plugin_authorized = $dependency->has_requisite_plugins( $plugins_required ); diff --git a/src/functions/utils.php b/src/functions/utils.php index c01cd540b9..801ca9c5bc 100644 --- a/src/functions/utils.php +++ b/src/functions/utils.php @@ -76,7 +76,7 @@ function tribe_register_plugin( $file_path, $main_class, $version, $classes_req */ function tribe_check_plugin( $main_class ) { - $tribe_dependency = Tribe__Dependency::instance(); + $tribe_dependency = tribe( Tribe__Dependency::class ); return $tribe_dependency->check_plugin( $main_class ); From 573066f12c2786520addfdfa59b50847002989ab Mon Sep 17 00:00:00 2001 From: Stephen Page Date: Wed, 1 Nov 2023 13:14:21 -0400 Subject: [PATCH 07/10] phpstan fixes. Fixes: Invalid param formats in docblocks. src/Tribe/Context.php Invalid return statements: Tribe__Admin__Notices::register_transient() Tribe__Ajax__Dropdown::sort_terms_hierarchically() Tribe__Admin__Notice__Plugin_Upgrade_Notice::parse_for_upgrade_notice() Unsafe usage of new static() Thrown in src/Common/Site_Health/Fields/Generic_Info_Field.php mitigated via an interface to enforce the constructor signature Static access to instance property Tribe\Admin\Upsell_Notice\Main::$template. Incorrect/unused use function in src/Tribe/Admin/Notices.php --- .../Site_Health/Fields/Generic_Info_Field.php | 3 ++- .../Site_Health/Fields/Info_Field_Interface.php | 14 ++++++++++++++ src/Tribe/Admin/Notice/Plugin_Upgrade_Notice.php | 1 - src/Tribe/Admin/Notices.php | 3 --- src/Tribe/Admin/Upsell_Notice/Main.php | 2 +- src/Tribe/Ajax/Dropdown.php | 2 -- src/Tribe/Context.php | 8 ++++---- 7 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 src/Common/Site_Health/Fields/Info_Field_Interface.php diff --git a/src/Common/Site_Health/Fields/Generic_Info_Field.php b/src/Common/Site_Health/Fields/Generic_Info_Field.php index 96416649d2..ca48327e0a 100644 --- a/src/Common/Site_Health/Fields/Generic_Info_Field.php +++ b/src/Common/Site_Health/Fields/Generic_Info_Field.php @@ -3,6 +3,7 @@ namespace TEC\Common\Site_Health\Fields; use TEC\Common\Site_Health\Info_Field_Abstract; +use TEC\Common\Site_Health\Info_Field_Interface; /** * Class Generic_Info_Field @@ -11,7 +12,7 @@ * * @package TEC\Common\Site_Health */ -class Generic_Info_Field extends Info_Field_Abstract { +class Generic_Info_Field extends Info_Field_Abstract implements Info_Field_Interface { /** * Configure all the params for a generic field. diff --git a/src/Common/Site_Health/Fields/Info_Field_Interface.php b/src/Common/Site_Health/Fields/Info_Field_Interface.php new file mode 100644 index 0000000000..2f6e04a5aa --- /dev/null +++ b/src/Common/Site_Health/Fields/Info_Field_Interface.php @@ -0,0 +1,14 @@ +current_version. * * @param string $readme - * @return string */ protected function parse_for_upgrade_notice( $readme ) { $in_upgrade_notice = false; diff --git a/src/Tribe/Admin/Notices.php b/src/Tribe/Admin/Notices.php index 9c8f6781fb..aa3077be5f 100644 --- a/src/Tribe/Admin/Notices.php +++ b/src/Tribe/Admin/Notices.php @@ -3,8 +3,6 @@ use Tribe__Date_Utils as Dates; use TEC\Common\StellarWP\DB\DB; -use function Crontrol\Event\delete; - /** * @since 4.3 */ @@ -608,7 +606,6 @@ public function register( $slug, $callback, $arguments = [], $active_callback = * @param array $arguments Arguments to Setup a notice * @param int $expire After how much time (in seconds) the notice will stop showing. * - * @return stdClass Which notice was registered */ public function register_transient( $slug, $html, $arguments = [], $expire = null ) { $notices = $this->get_transients(); diff --git a/src/Tribe/Admin/Upsell_Notice/Main.php b/src/Tribe/Admin/Upsell_Notice/Main.php index 5f220d0e58..a21e8b195c 100644 --- a/src/Tribe/Admin/Upsell_Notice/Main.php +++ b/src/Tribe/Admin/Upsell_Notice/Main.php @@ -29,7 +29,7 @@ class Main { * @return \Tribe__Template */ private function get_template() { - if ( empty( self::$template ) ) { + if ( empty( $this->template ) ) { $this->template = new \Tribe__Template(); $this->template->set_template_origin( \Tribe__Main::instance() ); $this->template->set_template_folder( 'src/admin-views/notices/upsell' ); diff --git a/src/Tribe/Ajax/Dropdown.php b/src/Tribe/Ajax/Dropdown.php index 071d977cf0..f9bc11e24b 100644 --- a/src/Tribe/Ajax/Dropdown.php +++ b/src/Tribe/Ajax/Dropdown.php @@ -182,8 +182,6 @@ public function format_posts_for_dropdown( array $posts, $selected = null, $pagi * @param array &$terms Array of Terms from `get_terms`. * @param array &$into Variable where we will store the. * @param integer $parent Used for the recursion. - * - * @return array */ public function sort_terms_hierarchically( &$terms, &$into, $parent = 0 ) { foreach ( $terms as $i => $term ) { diff --git a/src/Tribe/Context.php b/src/Tribe/Context.php index 04f753a20e..4a2c18a325 100644 --- a/src/Tribe/Context.php +++ b/src/Tribe/Context.php @@ -454,9 +454,9 @@ public function get_locations() { * * @since 4.10.2 * - * @param $locations array An array of read and write location in the shape of the `Tribe__Context::$locations` one, - * `[ => [ 'read' => , 'write' => ] ]`. - * @param $context Tribe__Context Current instance of the context. + * @param array $locations An array of read and write location in the shape of the `Tribe__Context::$locations` one, + * `[ => [ 'read' => , 'write' => ] ]`. + * @param Tribe__Context $context Current instance of the context. */ $locations = apply_filters( 'tribe_context_locations', $locations, $this ); } @@ -1178,7 +1178,7 @@ public function get_state( array $fields = null, $whitelist = true ) { * @param array $state The Redux store compatible state produced from the current context. * @param bool $is_global_context Whether the context producing the state is the global one * or a modified clone of it. - * @param Tribe__Context The context object producing the state. + * @param Tribe__Context $context The context object producing the state. */ $state = apply_filters( 'tribe_context_state', $state, $is_global_context, $this ); From 804ad711ae3aa21578efb2a5632bbf004f7afd81 Mon Sep 17 00:00:00 2001 From: Stephen Page Date: Wed, 1 Nov 2023 13:24:00 -0400 Subject: [PATCH 08/10] MOAR PHPSTAN! --- .../Configuration/Configuration_Provider_Interface.php | 4 ++-- src/Common/Site_Health/Fields/Info_Field_Interface.php | 2 +- src/Tribe/Cache_Listener.php | 6 +++--- src/Tribe/Cost_Utils.php | 8 ++++---- src/Tribe/Credits.php | 4 ++-- src/functions/template-tags/general.php | 6 +++--- src/functions/utils.php | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Common/Configuration/Configuration_Provider_Interface.php b/src/Common/Configuration/Configuration_Provider_Interface.php index f29645ce7d..53995a30bf 100644 --- a/src/Common/Configuration/Configuration_Provider_Interface.php +++ b/src/Common/Configuration/Configuration_Provider_Interface.php @@ -22,7 +22,7 @@ interface Configuration_Provider_Interface { * * @since 5.1.3 * - * @param $key string Variable name. + * @param string $key Variable name. * * @return bool Whether the variable is defined or not. */ @@ -33,7 +33,7 @@ public function has( string $key ): bool; * * @since 5.1.3 * - * @param $key string Variable name. + * @param string $key Variable name. * * @return null|mixed */ diff --git a/src/Common/Site_Health/Fields/Info_Field_Interface.php b/src/Common/Site_Health/Fields/Info_Field_Interface.php index 2f6e04a5aa..3482bdae7c 100644 --- a/src/Common/Site_Health/Fields/Info_Field_Interface.php +++ b/src/Common/Site_Health/Fields/Info_Field_Interface.php @@ -9,6 +9,6 @@ * * @package TEC\Common\Site_Health\Fields */ -interface Info_Section_Interface { +interface Info_Field_Interface { public function __construct( string $id, string $label, $value, int $priority ); } \ No newline at end of file diff --git a/src/Tribe/Cache_Listener.php b/src/Tribe/Cache_Listener.php index d471b0c12a..793f5a56c9 100755 --- a/src/Tribe/Cache_Listener.php +++ b/src/Tribe/Cache_Listener.php @@ -172,10 +172,10 @@ public function filter_action_last_occurrence_triggers( array $triggers = [], $a /** * For any hook that doesn't need any additional filtering * - * @param $method - * @param $args + * @param string $method The method name. + * @param mixed $unused_args The method args. */ - public function __call( $method, $args ) { + public function __call( $method, $unused_args ) { $this->cache->set_last_occurrence( $method ); } diff --git a/src/Tribe/Cost_Utils.php b/src/Tribe/Cost_Utils.php index 42a112a19f..1b9df7a82f 100644 --- a/src/Tribe/Cost_Utils.php +++ b/src/Tribe/Cost_Utils.php @@ -239,7 +239,7 @@ public function merge_cost_ranges( $original_string_cost, $merging_cost, $with_c * Returns a maximum cost in a list of costs. If an array of costs is not passed in, the array of costs is fetched * via query. * - * @param $costs mixed Cost(s) to review for max value + * @param mixed $costs Cost(s) to review for max value * * @return float */ @@ -250,8 +250,8 @@ public function get_maximum_cost( $costs = null ) { /** * Returns a particular cost within an array of costs * - * @param $costs mixed Cost(s) to review for max value - * @param $function string Function to use to determine which cost to return from range. Valid values: max, min + * @param mixed $costs Cost(s) to review for max value + * @param string $function Function to use to determine which cost to return from range. Valid values: max, min * * @return float */ @@ -375,7 +375,7 @@ public function parse_cost_range( $costs, $max_decimals = null, $sort = true ) { * Returns a minimum cost in a list of costs. If an array of costs is not passed in, the array of costs is fetched * via query. * - * @param $costs mixed Cost(s) to review for min value + * @param mixed $costs Cost(s) to review for min value * * @return float */ diff --git a/src/Tribe/Credits.php b/src/Tribe/Credits.php index c87bc1f518..8fa9142490 100755 --- a/src/Tribe/Credits.php +++ b/src/Tribe/Credits.php @@ -36,7 +36,7 @@ public function html_comment_credit( $after_html ) { /** * Add ratings nudge in admin footer * - * @param $footer_text + * @param string $footer_text * * @return string */ @@ -83,7 +83,7 @@ public function rating_nudge( $footer_text ) { * * @since 4.15.0 * - * @param $footer_text The admin footer text. + * @param string $footer_text The admin footer text. */ return apply_filters( 'tec_admin_footer_text', $footer_text ); } diff --git a/src/functions/template-tags/general.php b/src/functions/template-tags/general.php index f0ccd1334c..e3d689efae 100755 --- a/src/functions/template-tags/general.php +++ b/src/functions/template-tags/general.php @@ -157,8 +157,8 @@ function tribe_resource_url( $resource, $echo = false, $root_dir = null, $origin /** * Filters the resource URL * - * @param $url - * @param $resource + * @param string $url + * @param string $resource */ $url = apply_filters( 'tribe_resource_url', $url, $resource ); @@ -310,7 +310,7 @@ function tribe_get_days_between( $start_date, $end_date, $day_cutoff = '00:00' ) * * @category Events * - * @param $string + * @param string $string * * @return string */ diff --git a/src/functions/utils.php b/src/functions/utils.php index 801ca9c5bc..1051b8b74b 100644 --- a/src/functions/utils.php +++ b/src/functions/utils.php @@ -565,7 +565,7 @@ function tribe_post_exists( $post_id_or_name, $post_type = null ) { * Wrapper function for `tribe_events_get_the_excerpt` to prevent access the function when is not present on the * current site installation. * - * @param $post + * @param mixed $post * * @return null|string */ From 99d69b12edf835670426109b063b975e88571d6c Mon Sep 17 00:00:00 2001 From: Stephen Page Date: Fri, 10 Nov 2023 15:33:28 -0500 Subject: [PATCH 09/10] Exclude the deprecated code. --- phpstan.neon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 8206884439..247640e8b2 100755 --- a/phpstan.neon +++ b/phpstan.neon @@ -5,4 +5,7 @@ parameters: - tribe-common.php - tribe-autoload.php scanDirectories: - - vendor/vendor-prefixed \ No newline at end of file + - vendor/vendor-prefixed + excludePaths: + analyse: + - src/deprecated \ No newline at end of file From 680b0ec78826582dd5a1888936eeb08dad816730 Mon Sep 17 00:00:00 2001 From: Stephen Page Date: Tue, 14 Nov 2023 08:52:50 -0500 Subject: [PATCH 10/10] fixes --- .github/workflows/phpstan.yml | 8 +- package-lock.json | 4 +- .../Fields/Info_Field_Interface.php | 11 +- .../Site_Health/Info_Field_Interface.php | 10 + src/Tribe/Abstract_Plugin_Register.php | 13 -- src/Tribe/Ajax/Dropdown.php | 2 +- src/Tribe/Container.php | 2 +- src/Tribe/Context.php | 19 +- src/Tribe/Cost_Utils.php | 29 ++- src/Tribe/Credits.php | 7 +- src/Tribe/Customizer.php | 4 +- src/Tribe/Customizer/Section.php | 13 +- src/Tribe/DB_Lock.php | 2 +- src/Tribe/Date_Utils.php | 188 ++---------------- src/Tribe/Debug_Bar/Panels/Context.php | 4 +- src/Tribe/Debug_Bar/Panels/Json_Ld.php | 2 +- src/Tribe/Dependency.php | 6 +- src/Tribe/Deprecation.php | 12 +- src/Tribe/Dialog/View.php | 5 +- src/Tribe/Duplicate/Post.php | 1 + src/Tribe/Duplicate/Strategy_Factory.php | 6 +- src/Tribe/Editor/Assets.php | 4 +- src/Tribe/Editor/Blocks/Abstract.php | 18 +- .../Editor/Compatibility/Classic_Editor.php | 2 +- src/Tribe/Feature_Detection.php | 4 +- src/Tribe/Field.php | 56 ------ src/Tribe/JSON_LD/Abstract.php | 6 +- src/Tribe/Languages/Locations.php | 4 +- src/Tribe/Log/Logger.php | 6 +- src/Tribe/Log/Null_Logger.php | 8 +- src/Tribe/Log/Service_Provider.php | 4 +- src/Tribe/Main.php | 2 +- src/Tribe/Process/Handler.php | 2 +- src/Tribe/Process/Queue.php | 20 +- src/Tribe/Template.php | 3 +- src/Tribe/Utils/Body_Classes.php | 2 +- src/Tribe/Utils/Compatibility_Classes.php | 4 +- src/Tribe/Utils/Taxonomy.php | 6 +- src/Tribe/Values/Abstract_Currency.php | 112 ++++++----- src/Tribe/Values/Abstract_Value.php | 42 ++-- src/Tribe/Values/Value_Update.php | 8 +- src/Tribe/View_Helpers.php | 2 +- src/Tribe/Widget/Widget_Abstract.php | 47 +++-- src/functions/template-tags/html.php | 24 --- src/functions/utils.php | 23 +-- src/views/dialog/button.php | 5 +- 46 files changed, 287 insertions(+), 475 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index df61b74be4..27b7288cb8 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -10,10 +10,10 @@ jobs: matrix: phpVersion: [ "7.4", - "8.0", - "8.1", - "8.2", - "8.3", + #"8.0", + #"8.1", + #"8.2", + #"8.3", ] runs-on: ubuntu-20.04 steps: diff --git a/package-lock.json b/package-lock.json index 0624300f7d..16ecddd78e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tribe-common", - "version": "5.1.11", + "version": "5.1.13", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tribe-common", - "version": "5.1.11", + "version": "5.1.13", "dependencies": { "@babel/runtime": "^7.15.3", "@moderntribe/common": "file:src/modules", diff --git a/src/Common/Site_Health/Fields/Info_Field_Interface.php b/src/Common/Site_Health/Fields/Info_Field_Interface.php index 3482bdae7c..fda094319f 100644 --- a/src/Common/Site_Health/Fields/Info_Field_Interface.php +++ b/src/Common/Site_Health/Fields/Info_Field_Interface.php @@ -10,5 +10,14 @@ * @package TEC\Common\Site_Health\Fields */ interface Info_Field_Interface { - public function __construct( string $id, string $label, $value, int $priority ); + + /** + * Configure all the params for a generic field. + * + * @param string $id + * @param string $label + * @param array|string|null $value + * @param int $priority + */ + public function __construct( string $id, string $label, $value = null, int $priority = 50 ); } \ No newline at end of file diff --git a/src/Common/Site_Health/Info_Field_Interface.php b/src/Common/Site_Health/Info_Field_Interface.php index a9e980d950..ef7aab191b 100644 --- a/src/Common/Site_Health/Info_Field_Interface.php +++ b/src/Common/Site_Health/Info_Field_Interface.php @@ -13,6 +13,16 @@ */ interface Info_Field_Interface { + /** + * Configure all the params for a generic field. + * + * @param string $id + * @param string $label + * @param array|string|null $value + * @param int $priority + */ + public function __construct( string $id, string $label, $value = null, int $priority = 50 ); + /** * Gets the ID for this field. * diff --git a/src/Tribe/Abstract_Plugin_Register.php b/src/Tribe/Abstract_Plugin_Register.php index d6d791aeb5..e1b6199710 100644 --- a/src/Tribe/Abstract_Plugin_Register.php +++ b/src/Tribe/Abstract_Plugin_Register.php @@ -56,17 +56,4 @@ public function register_plugin() { $this->dependencies ); } - - /** - * Returns whether or not the dependencies have been met - * - * This is basically an aliased function - register_plugins, upon - * second calling, returns whether or not a plugin should load. - * - * @deprecated since 4.9.17 It is unused by any Tribe plugins and returned void. - * @todo remove in 4.11 - */ - public function has_valid_dependencies() { - _deprecated_function( __METHOD__, '4.9.17' ); - } } \ No newline at end of file diff --git a/src/Tribe/Ajax/Dropdown.php b/src/Tribe/Ajax/Dropdown.php index f9bc11e24b..00313577fa 100644 --- a/src/Tribe/Ajax/Dropdown.php +++ b/src/Tribe/Ajax/Dropdown.php @@ -333,6 +333,6 @@ private function error( $message ) { public function __call( $name, $arguments ) { $message = __( 'The "%s" source is invalid and cannot be reached on "%s" instance.', 'tribe-common' ); - return $this->error( sprintf( $message, $name, __CLASS__ ) ); + $this->error( sprintf( $message, $name, __CLASS__ ) ); } } diff --git a/src/Tribe/Container.php b/src/Tribe/Container.php index 56ba833537..be3fd1d20d 100644 --- a/src/Tribe/Container.php +++ b/src/Tribe/Container.php @@ -298,7 +298,7 @@ function tribe_register_provider( $provider_class ) { add_action( 'tribe_tickets_plugin_loaded', static function() use ( $container ) { - $container->register( Tribe\Tickets\Admin\Home\Service_Provider::class ); + $container->register( Tribe\Tickets\Admin\Home\Service_Provider::class ); /** @phpstan-ignore class.notFound */ } ); } else { diff --git a/src/Tribe/Context.php b/src/Tribe/Context.php index 4a2c18a325..afc0adf0ce 100644 --- a/src/Tribe/Context.php +++ b/src/Tribe/Context.php @@ -1191,8 +1191,8 @@ public function get_state( array $fields = null, $whitelist = true ) { * * @since 4.9.5 * - * @param array $state The Redux store compatible state produced from the global context. - * @param Tribe__Context The global context object producing the state. + * @param array $state The Redux store compatible state produced from the global context. + * @param Tribe__Context $context The global context object producing the state. */ $state = apply_filters( 'tribe_global_context_state', $state, $this ); } @@ -1252,10 +1252,10 @@ public function get_orm_args( array $fields = null, $whitelist = true ) { * * @since 4.9.5 * - * @param array $orm_args The ORM args produced from the current context. - * @param bool $is_global_context Whether the context producing the ORM args is the global one - * or a modified clone of it. - * @param Tribe__Context The context object producing the ORM args. + * @param array $orm_args The ORM args produced from the current context. + * @param bool $is_global_context Whether the context producing the ORM args is the global one + * or a modified clone of it. + * @param Tribe__Context $context The context object producing the ORM args. */ $orm_args = apply_filters( 'tribe_context_orm_args', $orm_args, $is_global_context, $this ); @@ -1268,8 +1268,8 @@ public function get_orm_args( array $fields = null, $whitelist = true ) { * * @since 4.9.5 * - * @param array $orm_args The ORM args produced from the global context. - * @param Tribe__Context The global context object producing the ORM args. + * @param array $orm_args The ORM args produced from the global context. + * @param Tribe__Context $context The global context object producing the ORM args. */ $orm_args = apply_filters( 'tribe_global_context_orm_args', $orm_args, $this ); } @@ -1297,7 +1297,8 @@ protected function populate_locations() { * * @since 4.9.8 * - * @param array $locations An array of locations registered on the Context object. + * @param array $locations An array of locations registered on the Context object. + * @param Tribe__Context $context The global context object producing the ORM args. */ static::$locations = apply_filters( 'tribe_context_locations', static::$locations, $this ); diff --git a/src/Tribe/Cost_Utils.php b/src/Tribe/Cost_Utils.php index 1b9df7a82f..241b673b1d 100644 --- a/src/Tribe/Cost_Utils.php +++ b/src/Tribe/Cost_Utils.php @@ -48,7 +48,7 @@ public function is_valid_cost( $cost, $allow_negative = true ) { } /** - * Returns the regular expression that shold be used to identify a valid + * Returns the regular expression that should be used to identify a valid * cost string. * * @return string @@ -65,8 +65,12 @@ public function get_cost_regex() { * * @deprecated 4.3 Use `tribe_cost_regex` instead */ - $cost_regex = apply_filters( - 'tribe_events_cost_regex', $cost_regex + $cost_regex = apply_filters_deprecated( + 'tribe_events_cost_regex', + $cost_regex, + '4.3.0', + 'tribe_cost_regex', + 'Tribe__Cost_Utils::get_cost_regex' ); /** @@ -125,13 +129,13 @@ public function maybe_replace_cost_with_free( $cost ) { * return string * @param int|WP_Post $event An event post ID or post object. * @param string $currency_symbol - * @param string $currency_position Either "prefix" or "posfix" + * @param string $currency_position Either "prefix" or "postfix" * * @return float|int|string */ public function maybe_format_with_currency( $cost, $event = null, $currency_symbol = null, $currency_position = null ) { // check if the currency symbol is desired, and it's just a number in the field - // be sure to account for european formats in decimals, and thousands separators + // be sure to account for European formats in decimals, and thousands separators if ( is_numeric( str_replace( $this->get_separators(), '', $cost ) ) ) { $reverse_position = null; // currency_position often gets passed as null or an empty string. @@ -188,11 +192,14 @@ public function merge_cost_ranges( $original_string_cost, $merging_cost, $with_c $matches[0] ); - $numeric_orignal_costs = empty( $matches[0] ) ? $matches[0] : array_map( - 'floatval', $matches[0] + $numeric_original_costs = empty( $matches[0] ) + ? $matches[0] + : array_map( + 'floatval', + $matches[0] ); - $all_numeric_costs = array_filter( array_merge( $numeric_merging_cost_costs, $numeric_orignal_costs ) ); + $all_numeric_costs = array_filter( array_merge( $numeric_merging_cost_costs, $numeric_original_costs ) ); $cost_min = $cost_max = false; $merging_mins = array_intersect( $sorted_mins, (array) $merging_cost ); @@ -257,11 +264,11 @@ public function get_maximum_cost( $costs = null ) { */ protected function get_cost_by_func( $costs = null, $function = 'max' ) { if ( null === $costs ) { - $costs = $this->get_all_costs(); - } else { - $costs = (array) $costs; + return 0; } + $costs = (array) $costs; + $costs = $this->parse_cost_range( $costs ); // if there's only one item, we're looking at a single event. If the cost is non-numeric, let's diff --git a/src/Tribe/Credits.php b/src/Tribe/Credits.php index 8fa9142490..dcbc4b708e 100755 --- a/src/Tribe/Credits.php +++ b/src/Tribe/Credits.php @@ -14,15 +14,16 @@ public static function init() { */ public function hook() { add_filter( 'tribe_events_after_html', [ $this, 'html_comment_credit' ] ); - add_filter( 'admin_footer_text', [ $this, 'rating_nudge' ], 1, 2 ); + add_filter( 'admin_footer_text', [ $this, 'rating_nudge' ], 1 ); } /** * Add credit in HTML page source * - * @return void + * @param string $after_html The current HTML page source. + * @return string $after_html The modified HTML page source. **/ - public function html_comment_credit( $after_html ) { + public function html_comment_credit( $after_html ): string { if ( ! class_exists( 'Tribe__Events__Main' ) ) { return $after_html; diff --git a/src/Tribe/Customizer.php b/src/Tribe/Customizer.php index a153ded51f..283983f9bf 100644 --- a/src/Tribe/Customizer.php +++ b/src/Tribe/Customizer.php @@ -624,8 +624,8 @@ public function register( WP_Customize_Manager $customizer ) { * @since 4.4 * @since 4.12.15 Add Customizer instance as a parameter. * - * @param array $section - * @param WP_Customize_Manager $manager + * @param WP_Customize_Section $section The customizer section. + * @param WP_Customize_Manager $manager The customizer manager. * @param Tribe__Customizer $customizer The current customizer instance. */ do_action( "tribe_customizer_register_{$id}_settings", $this->sections[ $id ], $this->manager, $this ); diff --git a/src/Tribe/Customizer/Section.php b/src/Tribe/Customizer/Section.php index 6743b3556b..e6f1ffaaf9 100644 --- a/src/Tribe/Customizer/Section.php +++ b/src/Tribe/Customizer/Section.php @@ -335,16 +335,16 @@ public function filter_settings( $settings, $search ) { * * @since 4.13.3 * - * @return void + * @return array The filtered arguments. */ public function setup_arguments() {} /** * Filter section arguments. * - * @since 4.14.0 + * @return array The filtered arguments. * - * @return void + * @since 4.14.0 */ public function filter_arguments( $arguments ) { /** @@ -375,7 +375,7 @@ public function filter_arguments( $arguments ) { * * @since 4.14.0 * - * @return void + * @return array The filtered arguments. */ public function get_arguments() { return $this->filter_arguments( $this->setup_arguments() ); @@ -705,7 +705,10 @@ public function get_accepted_control_types() { * * @since 4.13.3 * - * @param array $control_types The map of keys to WP Control classes. + * @param array $control_types The map of keys to WP Control classes. + * @param static $instance The section instance we are dealing with. + * + * @return array $control_types The modified map of keys to WP Control classes. */ return apply_filters( 'tribe_customizer_accepted_control_types', $accepted_control_types, $this ); } diff --git a/src/Tribe/DB_Lock.php b/src/Tribe/DB_Lock.php index cb9e1955b3..d5d3ac2a04 100644 --- a/src/Tribe/DB_Lock.php +++ b/src/Tribe/DB_Lock.php @@ -95,7 +95,7 @@ public function acquire_db_lock( $lock_key ) { * * @param int $timeout The timeout, in seconds, of the lock acquisition attempt. * @param string $lock_key The lock key the target of the acquisition attempt. - * @param static $this The object that's trying to acquire the lock by means of the trait. + * @param static $instance The object instance that's trying to acquire the lock by means of the trait. */ $timeout = apply_filters( 'tribe_db_lock_timeout', 3, $lock_key, $this ); diff --git a/src/Tribe/Date_Utils.php b/src/Tribe/Date_Utils.php index fe268e5b14..a9c790eeb9 100755 --- a/src/Tribe/Date_Utils.php +++ b/src/Tribe/Date_Utils.php @@ -136,7 +136,7 @@ public static function datepicker_formats( $translate = null ) { * @param string $format The weird format you are using * @param string $date The date string to parse * - * @return string A DB formated Date, includes time if possible + * @return string A DB formatted Date, includes time if possible */ public static function datetime_from_format( $format, $date ) { // Reverse engineer the relevant date formats @@ -400,13 +400,13 @@ public static function is_weekend( $curdate ) { * @return int The timestamp of the date that fits the qualifications. */ public static function get_last_day_of_week_in_month( $curdate, $day_of_week ) { - $nextdate = mktime( date( 'H', $curdate ), date( 'i', $curdate ), date( 's', $curdate ), date( 'n', $curdate ), self::get_last_day_of_month( $curdate ), date( 'Y', $curdate ) );; + $next_date = mktime( date( 'H', $curdate ), date( 'i', $curdate ), date( 's', $curdate ), date( 'n', $curdate ), self::get_last_day_of_month( $curdate ), date( 'Y', $curdate ) );; - while ( date( 'N', $nextdate ) != $day_of_week && $day_of_week != - 1 ) { - $nextdate = strtotime( date( self::DBDATETIMEFORMAT, $nextdate ) . ' - 1 day' ); + while ( date( 'N', $next_date ) != $day_of_week && $day_of_week != - 1 ) { + $next_date = strtotime( date( self::DBDATETIMEFORMAT, $next_date ) . ' - 1 day' ); } - return $nextdate; + return $next_date; } /** @@ -418,15 +418,15 @@ public static function get_last_day_of_week_in_month( $curdate, $day_of_week ) { * @return int The timestamp of the date that fits the qualifications. */ public static function get_first_day_of_week_in_month( $curdate, $day_of_week ) { - $nextdate = mktime( 0, 0, 0, date( 'n', $curdate ), 1, date( 'Y', $curdate ) ); + $next_date = mktime( 0, 0, 0, date( 'n', $curdate ), 1, date( 'Y', $curdate ) ); - while ( ! ( $day_of_week > 0 && date( 'N', $nextdate ) == $day_of_week ) && - ! ( $day_of_week == - 1 && self::is_weekday( $nextdate ) ) && - ! ( $day_of_week == - 2 && self::is_weekend( $nextdate ) ) ) { - $nextdate = strtotime( date( self::DBDATETIMEFORMAT, $nextdate ) . ' + 1 day' ); + while ( ! ( $day_of_week > 0 && date( 'N', $next_date ) == $day_of_week ) && + ! ( $day_of_week == - 1 && self::is_weekday( $next_date ) ) && + ! ( $day_of_week == - 2 && self::is_weekend( $next_date ) ) ) { + $next_date = strtotime( date( self::DBDATETIMEFORMAT, $next_date ) . ' + 1 day' ); } - return $nextdate; + return $next_date; } /** @@ -1078,160 +1078,6 @@ public static function meridianOnly( $date ) { return self::meridian_only( $date ); } - /** - * Returns the end of a given day. - * - * @deprecated since 3.10 - use tribe_event_end_of_day() - * @todo remove in 4.1 - * - * @param int|string $date The date (timestamp or string). - * @param bool $isTimestamp Is $date in timestamp format? - * - * @return string The date and time of the end of a given day - */ - public static function endOfDay( $date, $isTimestamp = false ) { - _deprecated_function( __METHOD__, '3.10', 'tribe_event_end_of_day' ); - - if ( $isTimestamp ) { - $date = date( self::DBDATEFORMAT, $date ); - } - - return tribe_event_end_of_day( $date, self::DBDATETIMEFORMAT ); - } - - /** - * Returns the beginning of a given day. - * - * @deprecated since 3.10 - * @todo remove in 4.1 - * - * @param int|string $date The date (timestamp or string). - * @param bool $isTimestamp Is $date in timestamp format? - * - * @return string The date and time of the beginning of a given day. - */ - public static function beginningOfDay( $date, $isTimestamp = false ) { - _deprecated_function( __METHOD__, '3.10', 'tribe_event_beginning_of_day' ); - - if ( $isTimestamp ) { - $date = date( self::DBDATEFORMAT, $date ); - } - - return tribe_event_beginning_of_day( $date, self::DBDATETIMEFORMAT ); - } - - /** - * Deprecated camelCase version of self::time_between - * - * @param string $date1 The first date. - * @param string $date2 The second date. - * - * @return int The number of seconds between the dates. - */ - public static function timeBetween( $date1, $date2 ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::time_between' ); - return self::time_between( $date1, $date2 ); - } - - /** - * Deprecated camelCase version of self::date_diff - * - * @param string $date1 The first date. - * @param string $date2 The second date. - * - * @return int The number of days between two dates. - */ - public static function dateDiff( $date1, $date2 ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::date_diff' ); - return self::date_diff( $date1, $date2 ); - } - - /** - * Deprecated camelCase version of self::get_last_day_of_month - * - * @param int $timestamp THe timestamp. - * - * @return string The last day of the month. - */ - public static function getLastDayOfMonth( $timestamp ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::get_last_day_of_month' ); - return self::get_last_day_of_month( $timestamp ); - } - - /** - * Deprecated camelCase version of self::is_weekday - * - * @param int $curDate A timestamp. - * - * @return bool If the timestamp is a weekday. - */ - public static function isWeekday( $curdate ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::is_weekday' ); - return self::is_weekday( $curdate ); - } - - /** - * Deprecated camelCase version of self::is_weekend - * - * @param int $curDate A timestamp. - * - * @return bool If the timestamp is a weekend. - */ - public static function isWeekend( $curdate ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::is_weekend' ); - return self::is_weekend( $curdate ); - } - - /** - * Deprecated camelCase version of self::get_last_day_of_week_in_month - * - * @param int $curdate A timestamp. - * @param int $day_of_week The index of the day of the week. - * - * @return int The timestamp of the date that fits the qualifications. - */ - public static function getLastDayOfWeekInMonth( $curdate, $day_of_week ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::get_last_day_of_week_in_month' ); - return self::get_last_day_of_week_in_month( $curdate, $day_of_week ); - } - - /** - * Deprecated camelCase version of self::get_first_day_of_week_in_month - * - * @param int $curdate A timestamp. - * @param int $day_of_week The index of the day of the week. - * - * @return int The timestamp of the date that fits the qualifications. - */ - public static function getFirstDayOfWeekInMonth( $curdate, $day_of_week ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::get_fist_day_of_week_in_month' ); - return self::get_first_day_of_week_in_month( $curdate, $day_of_week ); - } - - /** - * Deprecated camelCase version of self::number_to_ordinal - * - * @param int $number A number. - * - * @return string The ordinal for that number. - */ - public static function numberToOrdinal( $number ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::number_to_ordinal' ); - return self::number_to_ordinal( $number ); - } - - /** - * Deprecated camelCase version of self::is_timestamp - * - * @param $timestamp - * - * @return bool - */ - public static function isTimestamp( $timestamp ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::is_timestamp' ); - return self::is_timestamp( $timestamp ); - } - /** * Gets the timestamp of a day in week, month and year context. * @@ -1254,7 +1100,7 @@ public static function isTimestamp( $timestamp ) { * $week_direction `1` and $week_in_month `1` means "first week of the month" * $week_direction `1` and $week_in_month `3` means "third week of the month" * $week_direction `-1` and $week_in_month `1` means "last week of the month" - * $week_direction `-1` and $week_in_month `2` means "penultimmate week of the month" + * $week_direction `-1` and $week_in_month `2` means "penultimate week of the month" * * @return int The day timestamp */ @@ -1273,12 +1119,12 @@ public static function get_weekday_timestamp( $day_of_week, $week_in_month, $mon } if ( $week_direction > 0 ) { - $startday = 1; + $start_day = 1; } else { - $startday = date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); + $start_day = date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); } - $start = mktime( 0, 0, 0, $month, $startday, $year ); + $start = mktime( 0, 0, 0, $month, $start_day, $year ); $weekday = date( 'N', $start ); if ( $week_direction * $day_of_week >= $week_direction * $weekday ) { @@ -1289,7 +1135,7 @@ public static function get_weekday_timestamp( $day_of_week, $week_in_month, $mon $offset += $week_direction * ( $week_in_month * 7 ) + ( $day_of_week - $weekday ); - return mktime( 0, 0, 0, $month, $startday + $offset, $year ); + return mktime( 0, 0, 0, $month, $start_day + $offset, $year ); } /** @@ -1451,7 +1297,7 @@ public static function get_week_start_end( $date, $start_of_week = null ) { // If the current date of the week is before the start of the week, move back a week. $week_offset = -1; } elseif ( 0 === $date_day ) { - // When start of the week is on a sunday we add a week. + // When start of the week is on a Sunday we add a week. $week_offset = 1; } diff --git a/src/Tribe/Debug_Bar/Panels/Context.php b/src/Tribe/Debug_Bar/Panels/Context.php index 162aa17407..d3405cdb3a 100644 --- a/src/Tribe/Debug_Bar/Panels/Context.php +++ b/src/Tribe/Debug_Bar/Panels/Context.php @@ -2,12 +2,12 @@ use Tribe__Utils__Array as Arr; /** - * The Debug Bar panel that will display tribe context informations. + * The Debug Bar panel that will display tribe context information. * * @since 4.9.5 */ -class Tribe__Debug_Bar__Panels__Context extends Debug_Bar_Panel { +class Tribe__Debug_Bar__Panels__Context extends Debug_Bar_Panel { // @phpstan-ignore-line /** * Returns the Panel name. diff --git a/src/Tribe/Debug_Bar/Panels/Json_Ld.php b/src/Tribe/Debug_Bar/Panels/Json_Ld.php index 5886ec1c67..326b9ffea7 100644 --- a/src/Tribe/Debug_Bar/Panels/Json_Ld.php +++ b/src/Tribe/Debug_Bar/Panels/Json_Ld.php @@ -7,7 +7,7 @@ * @package Tribe\Debug_Bar\Panels */ -class Tribe__Debug_Bar__Panels__Json_Ld extends Debug_Bar_Panel { +class Tribe__Debug_Bar__Panels__Json_Ld extends Debug_Bar_Panel { // @phpstan-ignore-line /** * Returns the Panel name. * diff --git a/src/Tribe/Dependency.php b/src/Tribe/Dependency.php index cd5342a9c6..ecdd77563f 100644 --- a/src/Tribe/Dependency.php +++ b/src/Tribe/Dependency.php @@ -377,19 +377,19 @@ public function get_pue_from_class( $class ) { */ $callback_map = [ 'Tribe__Events__Pro__Main' => function() { - $pue_reflection = new ReflectionClass( Tribe__Events__Pro__PUE::class ); + $pue_reflection = new ReflectionClass( Tribe__Events__Pro__PUE::class ); // @phpstan-ignore-line $values = $pue_reflection->getStaticProperties(); $values['plugin_file'] = EVENTS_CALENDAR_PRO_FILE; return $values; }, 'Tribe__Events__Filterbar__View' => function() { - $pue_reflection = new ReflectionClass( Tribe__Events__Filterbar__PUE::class ); + $pue_reflection = new ReflectionClass( Tribe__Events__Filterbar__PUE::class ); // @phpstan-ignore-line $values = $pue_reflection->getStaticProperties(); $values['plugin_file'] = TRIBE_EVENTS_FILTERBAR_FILE; return $values; }, 'Tribe__Events__Tickets__Eventbrite__Main' => function() { - $pue_reflection = new ReflectionClass( Tribe__Events__Tickets__Eventbrite__PUE::class ); + $pue_reflection = new ReflectionClass( Tribe__Events__Tickets__Eventbrite__PUE::class ); // @phpstan-ignore-line $values = $pue_reflection->getStaticProperties(); $values['plugin_file'] = EVENTBRITE_PLUGIN_FILE; return $values; diff --git a/src/Tribe/Deprecation.php b/src/Tribe/Deprecation.php index 04ad0a2553..f8a6709fc1 100644 --- a/src/Tribe/Deprecation.php +++ b/src/Tribe/Deprecation.php @@ -167,9 +167,9 @@ public function set_deprecated_actions( $deprecated_actions ) { } /** - * @param string $deprecated_tag + * @param string $deprecated_tag The deprecated action handle. * - * @return int|string + * @return int|string $new_tag The new action handle, if found. Original tag if not. */ protected function get_action_for_deprecated_tag( $deprecated_tag ) { foreach ( $this->deprecated_actions as $new_tag => $args ) { @@ -177,12 +177,14 @@ protected function get_action_for_deprecated_tag( $deprecated_tag ) { return $new_tag; } } + + return $deprecated_tag; } /** - * @param string $deprecated_tag + * @param string $deprecated_tag The deprecated filter handle. * - * @return int|string + * @return int|string $new_tag The new filter handle, if found. Original tag if not. */ protected function get_filter_for_deprecated_tag( $deprecated_tag ) { foreach ( $this->deprecated_filters as $new_tag => $args ) { @@ -190,5 +192,7 @@ protected function get_filter_for_deprecated_tag( $deprecated_tag ) { return $new_tag; } } + + return $deprecated_tag; } } diff --git a/src/Tribe/Dialog/View.php b/src/Tribe/Dialog/View.php index 3e560ccc46..6052eb2430 100644 --- a/src/Tribe/Dialog/View.php +++ b/src/Tribe/Dialog/View.php @@ -77,7 +77,7 @@ public function __construct() { * @param string $id The unique ID for this dialog. Gets prepended to the data attributes. Generated if not passed (`uniqid()`). * @param boolean $echo Whether to echo the script or to return it (default: true). * - * @return string An HTML string of the dialog. + * @return string $html An HTML string of the dialog. */ public function render_dialog( $content, $args = [], $id = null, $echo = true ) { // Check for content to be passed. @@ -538,7 +538,6 @@ public function get_dialog_script( $args, $echo = true ) { 'overlayClasses' => $args[ 'overlay_classes' ], 'overlayClickCloses' => $args[ 'overlay_click_closes' ], 'showEvent' => $args[ 'show_event' ], - 'closeEvent' => $args[ 'close_event' ], 'template' => $args[ 'template' ], 'wrapperClasses' => esc_attr( $args[ 'wrapper_classes' ] ), ]; @@ -603,7 +602,7 @@ public function get_dialog_script( $args, $echo = true ) { * * @since 4.10.0 * - * @param array $args List of arguments to override dialog script. See \Tribe\Dialog\View->build_dialog(). + * @param array $html The HTML prior to output. */ $html = apply_filters( 'tribe_dialog_script_html', $html ); diff --git a/src/Tribe/Duplicate/Post.php b/src/Tribe/Duplicate/Post.php index ab1a489c09..88215303bb 100644 --- a/src/Tribe/Duplicate/Post.php +++ b/src/Tribe/Duplicate/Post.php @@ -342,6 +342,7 @@ protected function prepare_queries( array $postarr ) { * Filters the excluded status. * * @param array $excluded_status The list of post_status to exclude from the query. + * @param array $where_frags The WHERE components for this duplicate search query * @param string $post_type The post type that's being used for this duplicate search query. * * @since 4.6 diff --git a/src/Tribe/Duplicate/Strategy_Factory.php b/src/Tribe/Duplicate/Strategy_Factory.php index ebfde02192..1be8b4e7ea 100644 --- a/src/Tribe/Duplicate/Strategy_Factory.php +++ b/src/Tribe/Duplicate/Strategy_Factory.php @@ -23,7 +23,7 @@ public function __construct() { * If a 'default' slug is not provided the first strategy class in the map will be used as default. * * @param array $strategy_map An array that maps strategy slugs to strategy classes. - * @param Tribe__Duplicate__Strategy_Factory $this This factory object. + * @param Tribe__Duplicate__Strategy_Factory $factory This factory object. * * @since 4.6 */ @@ -48,7 +48,7 @@ public function make( $strategy ) { * @param Tribe__Duplicate__Strategy__Interface $built_strategy The strategy that should be built * for the slug. * @param string $strategy The requested strategy slug. - * @param Tribe__Duplicate__Strategy_Factory $this This factory object. + * @param Tribe__Duplicate__Strategy_Factory $factory This factory object. * * @since 4.6 */ @@ -61,7 +61,7 @@ public function make( $strategy ) { * * @param Tribe__Duplicate__Strategy__Interface $built_strategy The strategy that should be built * for the slug. - * @param Tribe__Duplicate__Strategy_Factory $this This factory object. + * @param Tribe__Duplicate__Strategy_Factory $factory This factory object. * * @since 4.6 */ diff --git a/src/Tribe/Editor/Assets.php b/src/Tribe/Editor/Assets.php index 2b6118cab5..26628b3501 100644 --- a/src/Tribe/Editor/Assets.php +++ b/src/Tribe/Editor/Assets.php @@ -22,11 +22,8 @@ public function hook() { * @since 4.8 * * @param string $key Which key we are checking against - * - * @return boolean */ public function register() { - $plugin = Tribe__Main::instance(); /** @@ -104,6 +101,7 @@ public function register() { 'in_footer' => false, ] ); + } /** diff --git a/src/Tribe/Editor/Blocks/Abstract.php b/src/Tribe/Editor/Blocks/Abstract.php index b8e6d04014..4c6ee48617 100644 --- a/src/Tribe/Editor/Blocks/Abstract.php +++ b/src/Tribe/Editor/Blocks/Abstract.php @@ -194,11 +194,11 @@ public function has_block( $post = null ) { * * @since 5.1.5 * - * @param bool $has_block Whether the post has this block. - * @param WP_Post|null $wp_post The post object. - * @param int|null $post_id The post ID. - * @param string $block_name The block name. - * @param Tribe__Editor__Blocks__Abstract $this The block object. + * @param bool $has_block Whether the post has this block. + * @param WP_Post|null $wp_post The post object. + * @param int|null $post_id The post ID. + * @param string $block_name The block name. + * @param Tribe__Editor__Blocks__Abstract $block_object The block object. */ $has_block = (bool) apply_filters( 'tec_block_has_block', $has_block, $wp_post, $post_id, $this->name(), $this ); $block_name = $this->name(); @@ -208,10 +208,10 @@ public function has_block( $post = null ) { * * @since 5.1.5 * - * @param bool $has_block Whether the post has this block. - * @param WP_Post|null $wp_post The post object. - * @param int|null $post_id The post ID. - * @param Tribe__Editor__Blocks__Abstract $this The block object. + * @param bool $has_block Whether the post has this block. + * @param WP_Post|null $wp_post The post object. + * @param int|null $post_id The post ID. + * @param Tribe__Editor__Blocks__Abstract $block_object The block object. */ return (bool) apply_filters( "tec_block_{$block_name}_has_block", $has_block, $wp_post, $post_id, $this ); } diff --git a/src/Tribe/Editor/Compatibility/Classic_Editor.php b/src/Tribe/Editor/Compatibility/Classic_Editor.php index 2c2d0db339..7cf57af2e8 100644 --- a/src/Tribe/Editor/Compatibility/Classic_Editor.php +++ b/src/Tribe/Editor/Compatibility/Classic_Editor.php @@ -294,7 +294,7 @@ public static function is_classic_plugin_active() { * @since 4.9.12 * @since 4.14.13 moved to separate class. * - * @param $is_plugin_active bool Value that indicates if the plugin is active or not. + * @param bool $is_plugin_active Value that indicates if the plugin is active or not. */ return (boolean) apply_filters( 'tribe_is_classic_editor_plugin_active', $is_plugin_active ); } diff --git a/src/Tribe/Feature_Detection.php b/src/Tribe/Feature_Detection.php index c10b59791c..85760bb77c 100644 --- a/src/Tribe/Feature_Detection.php +++ b/src/Tribe/Feature_Detection.php @@ -62,7 +62,7 @@ public function supports_async_process( $force = false ) { * * @since 4.7.23 * - * @param bool $supports_async_process Whether async, AJAX-based, processing is supported or not. + * @param ?bool $supports_async_process Whether async, AJAX-based, processing is supported or not. * @param bool $force Whether the check is forcing the cached value to be refreshed * or not. */ @@ -170,7 +170,7 @@ public function get_mysql_max_packet_size() { * * @since 4.10.2 * - * @param int $mysql_max_packet_size The value of the `max_allowed_packet` variable, initially `null`. + * @param ?int $mysql_max_packet_size The value of the `max_allowed_packet` variable, initially `null`. */ $mysql_max_packet_size = apply_filters( 'tribe_max_allowed_packet_size', null ); diff --git a/src/Tribe/Field.php b/src/Tribe/Field.php index 45ecd23044..1c45f1b14a 100755 --- a/src/Tribe/Field.php +++ b/src/Tribe/Field.php @@ -902,62 +902,6 @@ public function toggle() { return $field; } - /* deprecated camelCase methods */ - public function doField() { - _deprecated_function( __METHOD__, '4.3', __CLASS__ . '::do_field' ); - return $this->do_field(); - } - - public function doFieldStart() { - _deprecated_function( __METHOD__, '4.3', __CLASS__ . '::do_field_start' ); - return $this->do_field_start(); - } - - public function doFieldEnd() { - _deprecated_function( __METHOD__, '4.3', __CLASS__ . '::do_field_end' ); - return $this->do_field_end(); - } - - public function doFieldLabel() { - _deprecated_function( __METHOD__, '4.3', __CLASS__ . '::do_field_label' ); - return $this->do_field_label(); - } - - public function doFieldDivStart() { - _deprecated_function( __METHOD__, '4.3', __CLASS__ . '::do_field_div_start' ); - return $this->do_field_div_start(); - } - - public function doFieldDivEnd() { - _deprecated_function( __METHOD__, '4.3', __CLASS__ . '::do_field_div_end' ); - return $this->do_field_div_end(); - } - - public function doToolTip() { - _deprecated_function( __METHOD__, '4.3', __CLASS__ . '::do_tool_tip' ); - return $this->do_tool_tip(); - } - - public function doFieldValue() { - _deprecated_function( __METHOD__, '4.3', __CLASS__ . '::do_field_value' ); - return $this->do_field_value(); - } - - public function doFieldName( $multi = false ) { - _deprecated_function( __METHOD__, '4.3', __CLASS__ . '::do_field_name' ); - return $this->do_field_name( $multi ); - } - - public function doFieldAttributes() { - _deprecated_function( __METHOD__, '4.3', __CLASS__ . '::do_field_attributes' ); - return $this->do_field_attributes(); - } - - public function doScreenReaderLabel() { - _deprecated_function( __METHOD__, '4.3', __CLASS__ . '::do_screen_reader_label' ); - return $this->do_screen_reader_label(); - } - /** * Generate a wrapped html field. * diff --git a/src/Tribe/JSON_LD/Abstract.php b/src/Tribe/JSON_LD/Abstract.php index fc86b90541..055a3fbe53 100755 --- a/src/Tribe/JSON_LD/Abstract.php +++ b/src/Tribe/JSON_LD/Abstract.php @@ -132,7 +132,7 @@ protected function apply_object_data_filter( $data, $args, $post ) { $type = strtolower( esc_attr( $this->type ) ); /** - * Allows the event data to be modifed by themes and other plugins. + * Allows the event data to be modified by themes and other plugins. * * @example tribe_json_ld_thing_object * @example tribe_json_ld_event_object @@ -160,7 +160,7 @@ public function get_markup( $post = null, $args = [] ) { } /** - * Allows the event data to be modifed by themes and other plugins. + * Allows the event data to be modified by themes and other plugins. * * @example tribe_json_ld_thing_data * @example tribe_json_ld_event_data @@ -188,7 +188,7 @@ public function markup( $post = null, $args = [] ) { /** * Allows users to filter the end markup of JSON-LD * - * @param string The HTML for the JSON LD markup + * @param string $html The HTML for the JSON LD markup */ $html = apply_filters( 'tribe_json_ld_markup', $html ); echo $html; diff --git a/src/Tribe/Languages/Locations.php b/src/Tribe/Languages/Locations.php index 36449a9075..0fbd34720e 100644 --- a/src/Tribe/Languages/Locations.php +++ b/src/Tribe/Languages/Locations.php @@ -329,7 +329,7 @@ public function build_country_array() { * * @since 4.7.12 * - * @param array associative array with: Country Code => Country Name + * @param array $countries associative array with: Country Code => Country Name */ return (array) apply_filters( 'tribe_countries', $countries ); } @@ -406,7 +406,7 @@ public function build_us_states_array() { * * @since 4.7.12 * - * @param array Associative array with the format: State Code => State Name + * @param array $states Associative array with the format: State Code => State Name */ return (array) apply_filters( 'tribe_us_states', $states ); } diff --git a/src/Tribe/Log/Logger.php b/src/Tribe/Log/Logger.php index 0ffeb09371..32c5fe4334 100644 --- a/src/Tribe/Log/Logger.php +++ b/src/Tribe/Log/Logger.php @@ -18,7 +18,7 @@ public function is_available(); public function get_name(); /** - * Responsible for commiting the entry to the log (but only if the debug level + * Responsible for committing the entry to the log (but only if the debug level * is appropriate). * * @param string $entry @@ -32,8 +32,8 @@ public function log( $entry, $type = Tribe__Log::DEBUG, $src = '' ); * order. If $limit is a negative or zero value, there is no limit. * * Implementation-specific arguments can optionally be provided as a second - * parameter. This may include support for a 'log' param where an identifer - * obtained via the list_availalbe_logs() method is passed in order to query + * parameter. This may include support for a 'log' param where an identifier + * obtained via the list_available_logs() method is passed in order to query * a specific archived log. * * @see Tribe__Log__Logger::list_available_logs() diff --git a/src/Tribe/Log/Null_Logger.php b/src/Tribe/Log/Null_Logger.php index 953215731d..f5407e6dfd 100644 --- a/src/Tribe/Log/Null_Logger.php +++ b/src/Tribe/Log/Null_Logger.php @@ -27,7 +27,7 @@ public function get_name() { } /** - * Responsible for commiting the entry to the log (but only if the debug level + * Responsible for committing the entry to the log (but only if the debug level * is appropriate). * * @param string $entry @@ -43,8 +43,8 @@ public function log( $entry, $type = Tribe__Log::DEBUG, $src = '' ) { * order. If $limit is a negative or zero value, there is no limit. * * Implementation-specific arguments can optionally be provided as a second - * parameter. This may include support for a 'log' param where an identifer - * obtained via the list_availalbe_logs() method is passed in order to query + * parameter. This may include support for a 'log' param where an identifier + * obtained via the list_available_logs() method is passed in order to query * a specific archived log. * * @see Tribe__Log__Logger::list_available_logs() @@ -90,7 +90,7 @@ public function list_available_logs() { * @param mixed $log_identifier * @param bool $create * - * @return bool + * @return void */ public function use_log( $log_identifier, $create = false ) { // no-op diff --git a/src/Tribe/Log/Service_Provider.php b/src/Tribe/Log/Service_Provider.php index d164157512..1f12cee701 100644 --- a/src/Tribe/Log/Service_Provider.php +++ b/src/Tribe/Log/Service_Provider.php @@ -95,9 +95,9 @@ public function build_logger() { * * @since 4.9.16 * - * @param int The threshold level; if the level of a message is this level or above, then it will be logged. + * @param int $level_threshold The threshold level; if the level of a message is this level or above, then it will be logged. * - * @see \Monolog\Logger for possible levels. + * @see \Monolog\Logger for possible levels. */ $level_threshold = apply_filters( 'tribe_log_level', $level_threshold ); diff --git a/src/Tribe/Main.php b/src/Tribe/Main.php index 8af81d44d5..f4a382a7fd 100644 --- a/src/Tribe/Main.php +++ b/src/Tribe/Main.php @@ -582,7 +582,7 @@ public static function get_post_types() { * * @since 4.0.1 * - * @param array Slugs for all Post Types registered. + * @param array $types Slugs for all Post Types registered. */ return apply_filters( 'tribe_post_types', [] ); } diff --git a/src/Tribe/Process/Handler.php b/src/Tribe/Process/Handler.php index ccad1f6801..13e8e19981 100644 --- a/src/Tribe/Process/Handler.php +++ b/src/Tribe/Process/Handler.php @@ -94,7 +94,7 @@ public function __construct() { * * @param bool $allow_nopriv Whether background processing should be triggered and handled on * non-private AJAX requests or not. - * @param static $this This handler instance. + * @param static $handler The current handler instance. */ $allow_nopriv = apply_filters( 'tribe_process_allow_nopriv_handling', true, $this ); diff --git a/src/Tribe/Process/Queue.php b/src/Tribe/Process/Queue.php index b1dc37fcc8..495ebadfe3 100644 --- a/src/Tribe/Process/Queue.php +++ b/src/Tribe/Process/Queue.php @@ -308,7 +308,7 @@ public static function delete_queue( $key ) { * @param string $key The key of the data to save. * @param array $data The data to save. * - * @return $this This process instance. + * @return $this The current process instance. */ public function update( $key, $data ) { $meta_key = $this->get_meta_key( $key ); @@ -697,7 +697,7 @@ public function maybe_handle( $data_source = null ) { * * @param mixed $data An item to process. * - * @return $this This process instance. + * @return $this The current process instance. */ public function push_to_queue( $data ) { $this->data[] = $data; @@ -807,7 +807,7 @@ protected function lock_process() { * @since 4.9.5 * * @param int $lock_duration The lock duration in seconds; defaults to one minute. - * @param static $this This process instance. + * @param static $instance The current process instance. */ $lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration, $this ); @@ -819,7 +819,7 @@ protected function lock_process() { * * @since 4.9.5 Pulled from the `WP_Background_Process` class. * - * @return $this This process instance. + * @return $this The current process instance. */ protected function unlock_process() { delete_transient( $this->identifier . '_process_lock' ); @@ -912,8 +912,8 @@ protected function memory_exceeded() { * * @since 4.9.5 * - * @param bool $return Whether the process did exceed the allowed memory limit or not. - * @param static $this This process instance. + * @param bool $return Whether the process did exceed the allowed memory limit or not. + * @param static $instance The current process instance. */ return apply_filters( $this->identifier . '_memory_exceeded', $return, $this ); } @@ -961,7 +961,7 @@ protected function time_exceeded() { * @since 4.9.5 * * @param int $default_time_limit The time limit for the process. - * @param static $this This process instance. + * @param static $instance The current process instance. */ $time_limit = apply_filters( $this->identifier . '_default_time_limit', 20, $this ); @@ -977,8 +977,8 @@ protected function time_exceeded() { * * @since 4.9.5 * - * @param bool $return Whether the process did exceed the time limit or not. - * @param static $this This process instance. + * @param bool $return Whether the process did exceed the time limit or not. + * @param static $instance The current process instance. */ return apply_filters( $this->identifier . '_time_exceeded', $return ); } @@ -1014,7 +1014,7 @@ public function schedule_cron_healthcheck( $schedules ) { * @since 4.9.5 * * @param int $interval The number of minutes to schedule the cron health-check; defaults to 5. - * @param static $this This process instance. + * @param static $instance The current process instance. */ $interval = apply_filters( $this->identifier . '_cron_interval', $this->healthcheck_cron_interval, $this ); diff --git a/src/Tribe/Template.php b/src/Tribe/Template.php index c752eacd19..3ea4484cb9 100644 --- a/src/Tribe/Template.php +++ b/src/Tribe/Template.php @@ -794,7 +794,8 @@ public function template( $name, $context = [], $echo = true ) { * * @since 4.12.0 * - * @param string null Whether to continue displaying the template or not. + * @param string $display Whether to continue displaying the template or not. Default null. + * Returning anything except null will prevent the template from displaying. * @param array $name Template name. * @param array $context Any context data you need to expose to this file. * @param boolean $echo If we should also print the Template. diff --git a/src/Tribe/Utils/Body_Classes.php b/src/Tribe/Utils/Body_Classes.php index 7f8da5d376..d47306dc09 100644 --- a/src/Tribe/Utils/Body_Classes.php +++ b/src/Tribe/Utils/Body_Classes.php @@ -316,7 +316,7 @@ private function should_add_body_class_to_queue( $class, $queue = 'display' ) { * @since 4.12.6 * * @param boolean $add Whether to add the class to the queue or not. - * @param array $class The array of body class names to add. + * @param string $class The array of body class names to add. * @param string $queue The queue we want to get 'admin', 'display', 'all'. */ return (bool) apply_filters( 'tribe_body_class_should_add_to_queue', false, $class, $queue ); diff --git a/src/Tribe/Utils/Compatibility_Classes.php b/src/Tribe/Utils/Compatibility_Classes.php index 972c0112c1..d9088bbe83 100644 --- a/src/Tribe/Utils/Compatibility_Classes.php +++ b/src/Tribe/Utils/Compatibility_Classes.php @@ -318,7 +318,7 @@ private function should_add_compatibility_class_to_queue( $class, $queue = 'disp * @since 4.14.0 * * @param boolean $add Whether to add the class to the queue or not. - * @param array $class The array of compatibility class names to add. + * @param string $class The array of compatibility class names to add. * @param string $queue The queue we want to get 'admin', 'display', 'all'. */ return (bool) apply_filters( 'tribe_compatibility_class_should_add_to_queue', false, $class, $queue ); @@ -342,9 +342,9 @@ private function should_add_compatibility_classes( array $add_classes, array $ex * @since 4.14.0 * * @param boolean $add Whether to add classes or not. + * @param string $queue The queue we want to get 'admin', 'display', 'all'. * @param array $add_classes The array of compatibility class names to add. * @param array $existing_classes An array of existing compatibility class names from WP. - * @param string $queue The queue we want to get 'admin', 'display', 'all'. * */ return (bool)apply_filters( 'tribe_compatibility_classes_should_add', false, $queue, $add_classes, $existing_classes ); diff --git a/src/Tribe/Utils/Taxonomy.php b/src/Tribe/Utils/Taxonomy.php index 7b759272a5..2fa3b63004 100644 --- a/src/Tribe/Utils/Taxonomy.php +++ b/src/Tribe/Utils/Taxonomy.php @@ -61,6 +61,7 @@ public static function translate_to_repository_args( $taxonomy, $terms, $operand return $tax_query; } + // @todo: This does not belong here! $repo = tribe_events(); $operation = static::OPERAND_AND === $operand ? 'term_and' : 'term_in'; @@ -130,9 +131,8 @@ public static function normalize_to_term_ids( $terms, $taxonomy ) { * so this method primes the caching by doing a single query that will build the cache for all Posts involved on * the template we are about to render, reducing about 2 queries for each Post that we prime the cache for. * - * Important to note that - * * @since 5.0.0 + * @since TBD Removed dependency on Tribe__Events__Main * * @param array $posts * @param array $taxonomies @@ -140,7 +140,7 @@ public static function normalize_to_term_ids( $terms, $taxonomy ) { * * @return array */ - public static function prime_term_cache( array $posts = [], array $taxonomies = [ 'post_tag', \Tribe__Events__Main::TAXONOMY ], bool $prime_term_meta = false ): array { + public static function prime_term_cache( array $posts = [], array $taxonomies = [ 'post_tag' ], bool $prime_term_meta = false ): array { $first = reset( $posts ); $is_numeric = ( ! $first instanceof \WP_Post ); if ( $is_numeric ) { diff --git a/src/Tribe/Values/Abstract_Currency.php b/src/Tribe/Values/Abstract_Currency.php index 89f03622a4..54d51cb104 100644 --- a/src/Tribe/Values/Abstract_Currency.php +++ b/src/Tribe/Values/Abstract_Currency.php @@ -35,7 +35,7 @@ abstract class Abstract_Currency extends Abstract_Value implements Currency_Inte protected $string; /** - * The default currency code + * The default currency code. * * @since 4.14.9 * @@ -44,7 +44,7 @@ abstract class Abstract_Currency extends Abstract_Value implements Currency_Inte protected $currency_code = 'USD'; /** - * The default currency decimal separator + * The default currency decimal separator. * * @since 4.14.9 * @@ -53,7 +53,7 @@ abstract class Abstract_Currency extends Abstract_Value implements Currency_Inte protected $currency_separator_decimal = '.'; /** - * The default currency thousands separator + * The default currency thousands separator. * * @since 4.14.9 * @@ -62,7 +62,7 @@ abstract class Abstract_Currency extends Abstract_Value implements Currency_Inte protected $currency_separator_thousands = ','; /** - * The default complete currency symbol, such as $, € or R$ + * The default complete currency symbol, such as $, € or R$. * * @since 4.14.9 * @@ -71,7 +71,7 @@ abstract class Abstract_Currency extends Abstract_Value implements Currency_Inte protected $currency_symbol = '$'; /** - * The default currency symbol position: prefix if $1 or postfix for 1$ + * The default currency symbol position: prefix if $1 or postfix for 1$. * * @since 4.14.9 * @@ -80,11 +80,11 @@ abstract class Abstract_Currency extends Abstract_Value implements Currency_Inte protected $currency_symbol_position = 'prefix'; /** - * Initialize object + * Initialize object. * * @since 4.14.9 * - * @param mixed $amount the value to set initially + * @param mixed $amount The value to set initially. */ public function __construct( $amount = 0 ) { $this->set_up_currency_details(); @@ -96,26 +96,27 @@ public function __construct( $amount = 0 ) { * @inheritDoc */ public function get_currency() { + $value_type = $this->get_value_type(); /** - * Filter the value returned for get_currency() when implemented in a specific class type + * Filter the value returned for get_currency() when implemented in a specific class type. * * @since 4.14.9 * - * @param string $currency the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency The string representation of the value with symbol. + * @param Abstract_Currency $instance The object instance. * * @return string */ - $currency = apply_filters( "tec_common_value_{$this->get_value_type()}_get_currency", $this->currency, $this ); + $currency = apply_filters( "tec_common_value_{$value_type}_get_currency", $this->currency, $this ); /** - * Filter the value returned for get_currency() when implemented in any class + * Filter the value returned for get_currency() when implemented in any class. * * @since 4.14.9 * - * @param string $currency the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency The string representation of the value with symbol. + * @param Abstract_Currency $instance The object instance. * * @return string */ @@ -126,26 +127,27 @@ public function get_currency() { * @inheritDoc */ public function get_decimal() { + $value_type = $this->get_value_type(); /** - * Filter the value returned for get_decimal() when implemented in a specific class type + * Filter the value returned for get_decimal() when implemented in a specific class type. * * @since 4.14.9 * - * @param float $decimal the float representation of the value, rounded to precision - * @param Abstract_Currency the object instance + * @param float $decimal The float representation of the value, rounded to precision. + * @param Abstract_Currency $instance The object instance. * * @return float */ - $decimal = apply_filters( "tec_common_value_{$this->get_value_type()}_get_decimal", $this->decimal, $this ); + $decimal = apply_filters( "tec_common_value_{$value_type}_get_decimal", $this->decimal, $this ); /** - * Filter the value returned for get_decimal() when implemented in any class + * Filter the value returned for get_decimal() when implemented in any class. * * @since 4.14.9 * - * @param float $decimal the string representation of the value - * @param Abstract_Currency the object instance + * @param float $decimal The float representation of the value. + * @param Abstract_Currency $instance The object instance. * * @return float */ @@ -156,26 +158,27 @@ public function get_decimal() { * @inheritDoc */ public function get_string() { + $value_type = $this->get_value_type(); /** - * Filter the value returned for get_string() when implemented in a specific class type + * Filter the value returned for get_string() when implemented in a specific class type. * * @since 4.14.9 * - * @param string $string the string representation of the value - * @param Abstract_Currency the object instance + * @param string $string The string representation of the value. + * @param Abstract_Currency $instance The object instance. * * @return string */ - $string = apply_filters( "tec_common_value_{$this->get_value_type()}_get_string", $this->string, $this ); + $string = apply_filters( "tec_common_value_{$value_type}_get_string", $this->string, $this ); /** * Filter the value returned for get_string() when implemented in any class * * @since 4.14.9 * - * @param string $string the string representation of the value - * @param Abstract_Currency the object instance + * @param string $string The string representation of the value. + * @param Abstract_Currency $instance The object instance. * * @return string */ @@ -186,26 +189,27 @@ public function get_string() { * @inheritDoc */ public function get_currency_code() { + $value_type = $this->get_value_type(); /** * Filter the value returned for get_currency_code() when implemented in a specific class type * * @since 4.14.9 * - * @param string $currency_code the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency_code The string representation of the currency code. + * @param Abstract_Currency $instance The object instance. * * @return string */ - $currency_code = apply_filters( "tec_common_value_{$this->get_value_type()}_get_currency_code", $this->currency_code, $this ); + $currency_code = apply_filters( "tec_common_value_{$value_type}_get_currency_code", $this->currency_code, $this ); /** * Filter the value returned for get_currency_code() when implemented in any class * * @since 4.14.9 * - * @param string $currency_code the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency_code The string representation of the currency code. + * @param Abstract_Currency $instance The object instance. * * @return string */ @@ -216,26 +220,27 @@ public function get_currency_code() { * @inheritDoc */ public function get_currency_symbol() { + $value_type = $this->get_value_type(); /** * Filter the value returned for get_currency_symbol() when implemented in a specific class type * * @since 4.14.9 * - * @param string $currency_symbol the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency_symbol The string representation of the currency symbol. + * @param Abstract_Currency $instance The object instance. * * @return string */ - $currency_symbol = apply_filters( "tec_common_value_{$this->get_value_type()}_get_currency_symbol", $this->currency_symbol, $this ); + $currency_symbol = apply_filters( "tec_common_value_{$value_type}_get_currency_symbol", $this->currency_symbol, $this ); /** * Filter the value returned for get_currency_symbol() when implemented in any class * * @since 4.14.9 * - * @param string $currency_symbol the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency_symbol The string representation of the currency symbol. + * @param Abstract_Currency $instance The object instance. * * @return string */ @@ -246,26 +251,27 @@ public function get_currency_symbol() { * @inheritDoc */ public function get_currency_symbol_position() { + $value_type = $this->get_value_type(); /** * Filter the value returned for get_currency_symbol_position() when implemented in a specific class type * * @since 4.14.9 * - * @param string $currency_symbol_position the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency_symbol_position The string representation of the currency symbol position. + * @param Abstract_Currency $instance The object instance. * * @return string */ - $currency_symbol_position = apply_filters( "tec_common_value_{$this->get_value_type()}_get_currency_symbol_position", $this->currency_symbol_position, $this ); + $currency_symbol_position = apply_filters( "tec_common_value_{$value_type}_get_currency_symbol_position", $this->currency_symbol_position, $this ); /** * Filter the value returned for get_currency_symbol_position() when implemented in any class * * @since 4.14.9 * - * @param string $currency_symbol_position the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency_symbol_position The string representation of the currency symbol position. + * @param Abstract_Currency $instance The object instance. * * @return string */ @@ -276,26 +282,27 @@ public function get_currency_symbol_position() { * @inheritDoc */ public function get_currency_separator_decimal() { + $value_type = $this->get_value_type(); /** * Filter the value returned for get_currency_separator_decimal() when implemented in a specific class type * * @since 4.14.9 * - * @param string $currency_separator_decimal the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency_separator_decimal The string representation of the currency decimal separator. + * @param Abstract_Currency $instance The object instance. * * @return string */ - $currency_separator_decimal = apply_filters( "tec_common_value_{$this->get_value_type()}_get_currency_separator_decimal", $this->currency_separator_decimal, $this ); + $currency_separator_decimal = apply_filters( "tec_common_value_{$value_type}_get_currency_separator_decimal", $this->currency_separator_decimal, $this ); /** * Filter the value returned for get_currency_separator_decimal() when implemented in any class * * @since 4.14.9 * - * @param string $currency_separator_decimal the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency_separator_decimal The string representation of the currency decimal separator. + * @param Abstract_Currency $instance The object instance. * * @return string */ @@ -306,26 +313,27 @@ public function get_currency_separator_decimal() { * @inheritDoc */ public function get_currency_separator_thousands() { + $value_type = $this->get_value_type(); /** * Filter the value returned for get_currency_separator_thousands() when implemented in a specific class type * * @since 4.14.9 * - * @param string $currency_separator_thousands the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency_separator_thousands The string representation of the value. + * @param Abstract_Currency $instance The object instance. * * @return string */ - $currency_separator_thousands = apply_filters( "tec_common_value_{$this->get_value_type()}_get_currency_separator_thousands", $this->currency_separator_thousands, $this ); + $currency_separator_thousands = apply_filters( "tec_common_value_{$value_type}_get_currency_separator_thousands", $this->currency_separator_thousands, $this ); /** * Filter the value returned for get_currency_separator_thousands() when implemented in any class * * @since 4.14.9 * - * @param string $currency_separator_thousands the string representation of the value - * @param Abstract_Currency the object instance + * @param string $currency_separator_thousands The string representation of the value. + * @param Abstract_Currency $instance The object instance. * * @return string */ diff --git a/src/Tribe/Values/Abstract_Value.php b/src/Tribe/Values/Abstract_Value.php index 34ecb0ca11..d2b25764be 100644 --- a/src/Tribe/Values/Abstract_Value.php +++ b/src/Tribe/Values/Abstract_Value.php @@ -36,7 +36,7 @@ abstract class Abstract_Value implements Value_Interface { private $integer = 0; /** - * The float representation of the amount. By default, this is the same as $normalized_amount + * The float representation of the amount. By default, this is the same as $normalized_amount. * * @since 4.14.9 * @@ -103,25 +103,27 @@ public function set_precision( $amount ) { * @inheritDoc */ public function get_integer() { + $value_type = $this->get_value_type(); + /** * Filter the value returned for get_integer() when implemented in a specific class name * * @since 4.14.9 * - * @param int $integer the integer representation of the value - * @param Abstract_Value the object instance + * @param int $integer The integer representation of the value + * @param Abstract_Value $instance The object instance. * * @return int */ - $integer = apply_filters( "tec_common_value_{$this->get_value_type()}_get_integer", $this->integer, $this ); + $integer = apply_filters( "tec_common_value_{$value_type}_get_integer", $this->integer, $this ); /** * Filter the value returned for get_integer() when implemented in any class * * @since 4.14.9 * - * @param int $integer the integer representation of the value - * @param Abstract_Value the object instance + * @param int $integer the integer representation of the value. + * @param Abstract_Value $instance The object instance. * * @return int */ @@ -138,8 +140,8 @@ public function get_float() { * * @since 4.14.9 * - * @param float $float the float representation of the value - * @param Abstract_Value the object instance + * @param float $float the float representation of the value. + * @param Abstract_Value $instance The object instance. * * @return float */ @@ -150,8 +152,8 @@ public function get_float() { * * @since 4.14.9 * - * @param float $float the float representation of the value - * @param Abstract_Value the object instance + * @param float $float the float representation of the value. + * @param Abstract_Value $instance The object instance. * * @return float */ @@ -167,8 +169,8 @@ public function get_precision() { * * @since 4.14.9 * - * @param int $precision the precision to which values will be calculated - * @param Abstract_Value the object instance + * @param int $precision The precision to which values will be calculated. + * @param Abstract_Value $instance The object instance. * * @return int */ @@ -179,8 +181,8 @@ public function get_precision() { * * @since 4.14.9 * - * @param int $precision the precision to which values will be calculated - * @param Abstract_Value the object instance + * @param int $precision The precision to which values will be calculated. + * @param Abstract_Value $instance The object instance. * * @return int */ @@ -355,8 +357,8 @@ private function set_normalized_amount( $amount ) { * * @since 4.14.9 * - * @param float $normalized_value the normalized value - * @param Abstract_Value the object instance + * @param float $normalized_value the normalized value. + * @param Abstract_Value $instance The object instance. * * @return float */ @@ -367,8 +369,8 @@ private function set_normalized_amount( $amount ) { * * @since 4.14.9 * - * @param float $normalized_value the normalized value - * @param Abstract_Value the object instance + * @param float $normalized_value the normalized value. + * @param Abstract_Value $instance The object instance. * * @return float */ @@ -379,8 +381,8 @@ private function set_normalized_amount( $amount ) { * * @since 4.14.9 * - * @param float $normalized_value the normalized value - * @param Abstract_Value the object instance + * @param float $normalized_value the normalized value. + * @param Abstract_Value $instance The object instance. */ do_action( 'tec_common_value_normalized', $normalized_value, $this ); diff --git a/src/Tribe/Values/Value_Update.php b/src/Tribe/Values/Value_Update.php index 7530557f86..4be7d4f908 100644 --- a/src/Tribe/Values/Value_Update.php +++ b/src/Tribe/Values/Value_Update.php @@ -27,8 +27,8 @@ public function get_setters() { * * @since 4.14.9 * - * @param string[] $setters the list of setter methods returned - * @param Abstract_Value the object instance + * @param string[] $setters The list of setter methods returned. + * @param Abstract_Value $instance The object instance. * * @return string[] */ @@ -39,8 +39,8 @@ public function get_setters() { * * @since 4.14.9 * - * @param string[] $setters the list of setter methods returned - * @param Abstract_Value the object instance + * @param string[] $setters The list of setter methods returned. + * @param Abstract_Value $instance The object instance. * * @return string[] */ diff --git a/src/Tribe/View_Helpers.php b/src/Tribe/View_Helpers.php index 0ee74d06e8..43a68718b2 100755 --- a/src/Tribe/View_Helpers.php +++ b/src/Tribe/View_Helpers.php @@ -249,7 +249,7 @@ private static function minutes( $exact_minute = 0 ) { /** * Filters the amount of minutes to increment the minutes drop-down by * - * @param int Increment amount (defaults to 5) + * @param int $increment Increment amount (defaults to 5) */ $default_increment = apply_filters( 'tribe_minutes_increment', 5 ); diff --git a/src/Tribe/Widget/Widget_Abstract.php b/src/Tribe/Widget/Widget_Abstract.php index 89c4cd7ae4..769e7b992d 100644 --- a/src/Tribe/Widget/Widget_Abstract.php +++ b/src/Tribe/Widget/Widget_Abstract.php @@ -122,12 +122,6 @@ abstract class Widget_Abstract extends \WP_Widget implements Widget_Interface { * {@inheritDoc} */ public function __construct( $id_base = '', $name = '', $widget_options = [], $control_options = [] ) { - /** - * For backwards compatibility purposes alone. - * @todo remove after 2021-08-01 - */ - $this->slug = static::get_widget_slug(); - parent::__construct( $this->parse_id_base( $id_base ), $this->parse_name( $name ), @@ -813,9 +807,9 @@ public function toggle_hooks( $toggle, $location = 'display' ) { * * @since 4.13.0 * - * @param bool $toggle Whether the hooks should be turned on or off. This value is `true` before a widget - * HTML is rendered and `false` after the widget HTML rendered. - * @param static $this The widget object that is toggling the hooks. + * @param bool $toggle Whether the hooks should be turned on or off. This value is `true` before a widget + * HTML is rendered and `false` after the widget HTML rendered. + * @param Widget_Abstract $widget_object The widget object that is toggling the hooks. */ do_action( 'tribe_shortcode_toggle_hooks', $toggle, $this ); } @@ -826,9 +820,7 @@ public function toggle_hooks( $toggle, $location = 'display' ) { * * @since 4.13.0 */ - protected function add_hooks() { - - } + protected function add_hooks() {} /** * Toggles on portions of the template that were modified in `add_template_mods()` above. @@ -837,8 +829,37 @@ protected function add_hooks() { * * @since 4.13.0 */ - protected function remove_hooks() { + protected function remove_hooks() {} + + + /** + * Massages the data before asking tribe_format_field_dependency() to create the dependency attributes. + * + * @since 5.3.0 + * + * @param array $field The field info. + * + * @return string The dependency attributes. + */ + public function format_dependency( $field ) { + $deps = Arr::get( $field, 'dependency', false ); + // Sanity check. + if ( empty( $deps ) ) { + return ''; + } + + if ( isset( $deps['ID'] ) ) { + $deps['id'] = $deps['ID']; + } + + // No ID to hook to? Bail. + if ( empty( $deps['id'] ) ) { + return ''; + } + + $deps['id'] = $this->get_field_id( $deps['id'] ); + return tribe_format_field_dependency( $deps ); } /********************** diff --git a/src/functions/template-tags/html.php b/src/functions/template-tags/html.php index a113a9aaea..0bcef207d3 100644 --- a/src/functions/template-tags/html.php +++ b/src/functions/template-tags/html.php @@ -109,30 +109,6 @@ function tribe_required_label( $required, $echo = true ) { } } -/** - * Get attributes for disabled fields. - * - * @deprecated 4.12.6 - * - * @since 4.10.0 - * - * @param boolean $disabled If the field is disabled. - * @param boolean $echo Whether to echo the string or return it. - * - * @return string|void If echo is false, returns $disabled_string. - */ -function tribe_disabled( $disabled, $echo = true ) { - if ( $disabled ) { - $disabled_string = 'disabled aria-disabled="true"'; - - if ( ! $echo ) { - return $disabled_string; - } else { - echo $disabled_string; - } - } -} - /** * Generates a string for the tribe-dependency attributes. * diff --git a/src/functions/utils.php b/src/functions/utils.php index 1051b8b74b..2b9155c27d 100644 --- a/src/functions/utils.php +++ b/src/functions/utils.php @@ -32,7 +32,7 @@ function tec_sanitize_string( $string ) { * * @return array */ - function tribe_array_merge_recursive( array &$array1, array &$array2 ) { + function tribe_array_merge_recursive( array &$array1, array &$array2 ): array { $merged = $array1; foreach ( $array2 as $key => &$value ) { @@ -74,7 +74,7 @@ function tribe_register_plugin( $file_path, $main_class, $version, $classes_req * * @return bool Indicates if plugin should continue initialization */ - function tribe_check_plugin( $main_class ) { + function tribe_check_plugin( $main_class ): bool { $tribe_dependency = tribe( Tribe__Dependency::class ); @@ -131,8 +131,8 @@ function tribe_exit( $status = '' ) { /** * Filters the callback to call in place of `die()`. * - * @param callable $handler The `die` replacement callback. - * @param string $status The exit/die status. + * @param string|callable $handler The `die` replacement callback. + * @param string $status The exit/die status. */ $handler = apply_filters( 'tribe_exit', $handler, $status ); @@ -727,44 +727,39 @@ function has_blocks( $post = null ) { * * @since 4.9.12 * + * @param string $namespace The first URL segment after core prefix. Should be unique to your package/plugin. * @param string $route The base URL for route you are adding. * @param array $args Optional. Either an array of options for the endpoint, or an array of arrays for * multiple methods. Default empty array. * @param bool $override Optional. If the route already exists, should we override it? True overrides, * false merges (with newer overriding if duplicate keys exist). Default false. * - * @param string $namespace The first URL segment after core prefix. Should be unique to your package/plugin. - * * @return bool True on success, false on error. */ - function tribe_register_rest_route( $namespace, $route, $args = [], $override = false ) { + function tribe_register_rest_route( string $namespace, string $route, array $args = [], bool $override = false ): bool { /** * Allow plugins to customize REST API arguments and callbacks. * * @since 4.9.12 * + * @param array $args Either an array of options for the endpoint, or an array of arrays for multiple methods. * @param string $namespace The first URL segment after core prefix. Should be unique to your package/plugin. * @param string $route The base URL for route you are adding. * @param bool $override Optional. If the route already exists, should we override it? True overrides, * false merges (with newer overriding if duplicate keys exist). Default false. - * - * @param array $args Either an array of options for the endpoint, or an array of arrays for - * multiple methods. Default empty array. */ - $args = apply_filters( 'tribe_register_rest_route_args_' . $namespace . $route, $args, $namespace, $route, $override ); + $args = apply_filters( "tribe_register_rest_route_args_{$namespace}{$route}", $args, $namespace, $route, $override ); /** * Allow plugins to customize REST API arguments and callbacks. * * @since 4.9.12 * + * @param array $args Either an array of options for the endpoint, or an array of arrays for multiple methods. * @param string $namespace The first URL segment after core prefix. Should be unique to your package/plugin. * @param string $route The base URL for route you are adding. * @param bool $override Optional. If the route already exists, should we override it? True overrides, * false merges (with newer overriding if duplicate keys exist). Default false. - * - * @param array $args Either an array of options for the endpoint, or an array of arrays for - * multiple methods. Default empty array. */ $args = apply_filters( 'tribe_register_rest_route_args', $args, $namespace, $route, $override ); diff --git a/src/views/dialog/button.php b/src/views/dialog/button.php index d872ffcda7..4fc8c9d215 100644 --- a/src/views/dialog/button.php +++ b/src/views/dialog/button.php @@ -40,7 +40,6 @@ class="" value="" - - - + + >