diff --git a/composer.json b/composer.json index ba745a80cd..7e54581666 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 6897567784..553c042218 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": "43ec74747c68c7396bedc0a710526d75", + "content-hash": "1d3ebeb1e9ccedd2cc7af3db262c13d7", "packages": [ { "name": "firebase/php-jwt", @@ -192,20 +192,20 @@ }, { "name": "psr/container", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", "autoload": { @@ -234,9 +234,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/log", @@ -1050,6 +1050,53 @@ }, "time": "2019-09-10T21:36:25+00:00" }, + { + "name": "doctrine/deprecations", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931", + "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.2" + }, + "time": "2023-09-27T20:04:15+00:00" + }, { "name": "doctrine/inflector", "version": "2.0.8", @@ -2528,6 +2575,53 @@ }, "time": "2017-03-05T17:38:23+00:00" }, + { + "name": "php-stubs/wordpress-stubs", + "version": "v6.4.1", + "source": { + "type": "git", + "url": "https://github.com/php-stubs/wordpress-stubs.git", + "reference": "6d6063cf9464a306ca2a0529705d41312b08500b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/6d6063cf9464a306ca2a0529705d41312b08500b", + "reference": "6d6063cf9464a306ca2a0529705d41312b08500b", + "shasum": "" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "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", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.8" + }, + "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.4.1" + }, + "time": "2023-11-10T00:33:47+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", @@ -2640,25 +2734,33 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.1", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" + "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", + "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "doctrine/deprecations": "^1.0", + "php": "^7.4 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" }, "type": "library", "extra": { @@ -2684,9 +2786,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.3" }, - "time": "2022-03-15T21:29:03+00:00" + "time": "2023-08-12T11:01:26+00:00" }, { "name": "phpspec/prophecy", @@ -2755,6 +2857,50 @@ }, "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", @@ -2802,6 +2948,116 @@ }, "time": "2023-09-26T12:28:12+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.10.41", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "c6174523c2a69231df55bdc65b61655e72876d76" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c6174523c2a69231df55bdc65b61655e72876d76", + "reference": "c6174523c2a69231df55bdc65b61655e72876d76", + "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-11-05T12:57:57+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", @@ -5791,6 +6047,68 @@ ], "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", @@ -6532,7 +6850,7 @@ "platform": [], "platform-dev": [], "platform-overrides": { - "php": "7.3.33" + "php": "7.4" }, "plugin-api-version": "2.6.0" } diff --git a/package.json b/package.json index 19cefa1ff6..6568d310a2 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 old mode 100644 new mode 100755 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/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. } 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/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..fda094319f --- /dev/null +++ b/src/Common/Site_Health/Fields/Info_Field_Interface.php @@ -0,0 +1,23 @@ +|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/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/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/Admin/Activation_Page.php b/src/Tribe/Admin/Activation_Page.php index c9db44099d..85caff2d91 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 ); } /** @@ -169,7 +169,8 @@ public function maybe_redirect() { * * @since 5.0.0 * - * @param $bypass bool + * @param bool $bypass + * @param Tribe__Admin__Activation_Page $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..8eb9ea86e7 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 ); @@ -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/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/Admin/Notice/Plugin_Upgrade_Notice.php b/src/Tribe/Admin/Notice/Plugin_Upgrade_Notice.php index 819d85ba54..563543194b 100644 --- a/src/Tribe/Admin/Notice/Plugin_Upgrade_Notice.php +++ b/src/Tribe/Admin/Notice/Plugin_Upgrade_Notice.php @@ -166,7 +166,6 @@ protected function form_wp_svn_readme_url() { * notice (if any) for a version higher than $this->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..00313577fa 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 ) { @@ -335,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/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/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 04f753a20e..afc0adf0ce 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 ); @@ -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 42a112a19f..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 ); @@ -239,7 +246,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,18 +257,18 @@ 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 */ 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 @@ -375,7 +382,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..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; @@ -36,7 +37,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 +84,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/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 176b962c0a..e77dc9c316 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 ); @@ -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 ); } @@ -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 ); 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/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/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 16fb82e2ea..d0b6f52deb 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/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/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 c01cd540b9..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,9 +74,9 @@ 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__Dependency::instance(); + $tribe_dependency = tribe( Tribe__Dependency::class ); return $tribe_dependency->check_plugin( $main_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 ); @@ -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 */ @@ -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="" - - - + + >