diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000000..27b7288cb8 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,47 @@ +name: 'PHPStan Tests' +on: + pull_request: + paths: + - 'src/**.php' + - '*.php' +jobs: + phpstan: + strategy: + matrix: + phpVersion: [ + "7.4", + #"8.0", + #"8.1", + #"8.2", + #"8.3", + ] + runs-on: ubuntu-20.04 + steps: + - name: Checkout the repository + uses: actions/checkout@v2 + with: + fetch-depth: 1000 + submodules: recursive + # ------------------------------------------------------------------------------ + # Set up PHP and run phpstan + # ------------------------------------------------------------------------------ + - name: Configure PHP environment to run phpstan + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.phpVersion }} + # ------------------------------------------------------------------------------ + # Override composer php version + # ------------------------------------------------------------------------------ + - name: Set php version ${{ matrix.phpVersion }} in composer + run: composer config platform.php ${{ matrix.phpVersion }} + # ------------------------------------------------------------------------------ + # Install dependencies - ignoring php requirements + # ------------------------------------------------------------------------------ + - name: Install dependencies + run: composer i --ignore-platform-req=php+ + # ------------------------------------------------------------------------------ + # Run phpstan + # ------------------------------------------------------------------------------ + - name: Run phpstan + run: ./vendor/bin/phpstan analyse --error-format=table + diff --git a/composer.json b/composer.json index ba745a80cd..5d5f710863 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ "php": "7.3.33" }, "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..71f51e04c1 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": "2c108cc81f17a608a75f0b92dd200717", "packages": [ { "name": "firebase/php-jwt", @@ -337,16 +337,16 @@ }, { "name": "stellarwp/db", - "version": "1.0.7", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/stellarwp/db.git", - "reference": "e299e35869cb8092b48143a11509c1574cc33dc0" + "reference": "9c76724be8b60e76b7281118e4ccdf2cc129f257" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stellarwp/db/zipball/e299e35869cb8092b48143a11509c1574cc33dc0", - "reference": "e299e35869cb8092b48143a11509c1574cc33dc0", + "url": "https://api.github.com/repos/stellarwp/db/zipball/9c76724be8b60e76b7281118e4ccdf2cc129f257", + "reference": "9c76724be8b60e76b7281118e4ccdf2cc129f257", "shasum": "" }, "require-dev": { @@ -387,9 +387,9 @@ "description": "A WPDB wrapper and query builder library.", "support": { "issues": "https://github.com/stellarwp/db/issues", - "source": "https://github.com/stellarwp/db/tree/1.0.7" + "source": "https://github.com/stellarwp/db/tree/1.1.0" }, - "time": "2023-10-23T20:46:29+00:00" + "time": "2023-11-14T12:37:35+00:00" }, { "name": "stellarwp/installer", @@ -2528,6 +2528,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", @@ -2755,6 +2802,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 +2893,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", @@ -4689,16 +4890,16 @@ }, { "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.13", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "1d5cd762abaa6b2a4169d3e77610193a7157129e" + "reference": "761c8b8387cfe5f8026594a75fdf0a4e83ba6974" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/1d5cd762abaa6b2a4169d3e77610193a7157129e", - "reference": "1d5cd762abaa6b2a4169d3e77610193a7157129e", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/761c8b8387cfe5f8026594a75fdf0a4e83ba6974", + "reference": "761c8b8387cfe5f8026594a75fdf0a4e83ba6974", "shasum": "" }, "require": { @@ -4748,7 +4949,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.13" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.10.0" }, "funding": [ { @@ -4764,7 +4965,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:41:36+00:00" + "time": "2022-07-20T09:59:04+00:00" }, { "name": "symfony/finder", @@ -5791,6 +5992,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", diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000000..247640e8b2 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,11 @@ +parameters: + level: 0 + paths: + - src + - tribe-common.php + - tribe-autoload.php + scanDirectories: + - vendor/vendor-prefixed + excludePaths: + analyse: + - src/deprecated \ No newline at end of file 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/Integrations/Integration_Abstract.php b/src/Common/Integrations/Integration_Abstract.php index 198bc0dd87..89d66adc21 100644 --- a/src/Common/Integrations/Integration_Abstract.php +++ b/src/Common/Integrations/Integration_Abstract.php @@ -86,6 +86,7 @@ protected function filter_should_load( bool $value ): bool { * @since 5.1.1 * * @param bool $value Whether the integration should load. + * @param string $parent Parent of the integration we are loading. * @param string $type Type of integration we are loading. * @param string $slug Slug of the integration we are loading. */ diff --git a/src/Common/Storage/Timed_Option.php b/src/Common/Storage/Timed_Option.php index 5b9d51959f..5438bf0509 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 $prefix Prefix for all the Timed Options stored on the database. */ 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..e68a40df6a 100644 --- a/src/Common/Telemetry/Telemetry.php +++ b/src/Common/Telemetry/Telemetry.php @@ -389,6 +389,8 @@ public function filter_exit_interview_args( $args ) { * * @since 5.1.0 * + * @param string $slug The slug of the plugin showing the modal. + * * @return void */ public function show_optin_modal( $slug ): void { @@ -399,6 +401,7 @@ public function show_optin_modal( $slug ): void { * @since 5.1.0 * * @param bool $show Whether to show the modal or not. + * @param string $slug The slug of the plugin showing the modal. * */ $show = (bool) apply_filters( 'tec_common_telemetry_show_optin_modal', true, $slug ); diff --git a/src/Tribe/Admin/Activation_Page.php b/src/Tribe/Admin/Activation_Page.php index c9db44099d..2364ac4540 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,11 +338,10 @@ protected function disable_default_settings_page() { * * @param string $context * - * @return string|null */ public function display_page() { if ( empty( $this->args[ $this->current_context . '_page_title' ] ) || empty( $this->args[ $this->current_context . '_page_template'] ) ) { - return null; + return; } do_action( 'tribe_settings_top' ); diff --git a/src/Tribe/Admin/Conditional_Content/Datetime_Conditional_Abstract.php b/src/Tribe/Admin/Conditional_Content/Datetime_Conditional_Abstract.php index 47c93351c3..d937b605c1 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 static $conditional The conditional content 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 static $conditional The conditional content 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 static $conditional The conditional content 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..691314bd1d 100644 --- a/src/Tribe/Admin/Helpers.php +++ b/src/Tribe/Admin/Helpers.php @@ -44,7 +44,8 @@ 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 $bypass Null bypass if we want to return a bool of is_wp_screen */ $is_wp_screen = apply_filters( 'tribe_admin_is_wp_screen', null ); if ( null !== $is_wp_screen ) { diff --git a/src/Tribe/Cache.php b/src/Tribe/Cache.php index 3dbf9e83fa..d71fea9a36 100755 --- a/src/Tribe/Cache.php +++ b/src/Tribe/Cache.php @@ -624,7 +624,7 @@ public function set_chunkable_transient( $id, $value, $expiration = 0, $expirati $inserted = []; $serialized_value = maybe_serialize( $value ); $chunk_size = tribe( 'feature-detection' )->get_mysql_max_packet_size() * 0.9; - $chunks = str_split( $serialized_value, $chunk_size ); + $chunks = str_split( $serialized_value, (int) $chunk_size ); foreach ( $chunks as $i => $chunk ) { $chunk_transient = $transient . '_' . $i; diff --git a/src/Tribe/Cache_Listener.php b/src/Tribe/Cache_Listener.php index d471b0c12a..ac6350d0d2 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 action to record the last occurrence of. + * @param mixed $unused_args */ - public function __call( $method, $args ) { + public function __call( $method, $unused_args ) { $this->cache->set_last_occurrence( $method ); } diff --git a/src/Tribe/Context.php b/src/Tribe/Context.php index 04f753a20e..1d6af6d9f5 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 ); } diff --git a/src/Tribe/Cost_Utils.php b/src/Tribe/Cost_Utils.php index 42a112a19f..d7f09d3d87 100644 --- a/src/Tribe/Cost_Utils.php +++ b/src/Tribe/Cost_Utils.php @@ -239,7 +239,7 @@ public function merge_cost_ranges( $original_string_cost, $merging_cost, $with_c * Returns a maximum cost in a list of costs. If an array of costs is not passed in, the array of costs is fetched * via query. * - * @param $costs mixed Cost(s) to review for max value + * @param mixed $costs Cost(s) to review for max value * * @return float */ @@ -250,8 +250,8 @@ public function get_maximum_cost( $costs = null ) { /** * Returns a particular cost within an array of costs * - * @param $costs mixed Cost(s) to review for max value - * @param $function string Function to use to determine which cost to return from range. Valid values: max, min + * @param mixed $costs Mixed Cost(s) to review for max value + * @param string $function Function to use to determine which cost to return from range. Valid values: max, min * * @return float */ @@ -375,7 +375,7 @@ public function parse_cost_range( $costs, $max_decimals = null, $sort = true ) { * Returns a minimum cost in a list of costs. If an array of costs is not passed in, the array of costs is fetched * via query. * - * @param $costs mixed Cost(s) to review for min value + * @param mixed $costs Cost(s) to review for min value * * @return float */ diff --git a/src/Tribe/Credits.php b/src/Tribe/Credits.php index c87bc1f518..b213e9ec46 100755 --- a/src/Tribe/Credits.php +++ b/src/Tribe/Credits.php @@ -36,9 +36,9 @@ public function html_comment_credit( $after_html ) { /** * Add ratings nudge in admin footer * - * @param $footer_text + * @param string $footer_text The admin footer text. * - * @return string + * @return string $footer_text The modified admin footer text. */ public function rating_nudge( $footer_text ) { $admin_helpers = Tribe__Admin__Helpers::instance(); @@ -83,7 +83,7 @@ public function rating_nudge( $footer_text ) { * * @since 4.15.0 * - * @param $footer_text The admin footer text. + * @param string $footer_text The admin footer text. */ return apply_filters( 'tec_admin_footer_text', $footer_text ); } diff --git a/src/Tribe/Date_Utils.php b/src/Tribe/Date_Utils.php index fe268e5b14..d1ab1e6a7e 100755 --- a/src/Tribe/Date_Utils.php +++ b/src/Tribe/Date_Utils.php @@ -446,7 +446,7 @@ public static function number_to_ordinal( $number ) { /** * check if a given string is a timestamp * - * @param $timestamp + * @param mixed $timestamp * * @return bool */ @@ -464,8 +464,8 @@ public static function is_timestamp( $timestamp ) { * * @since 5.1.5 Make use of `wp_date` for i18n. * - * @param $dt_string - * @param $new_format + * @param string|int $dt_string The date/time string to reformat. + * @param string $new_format The format to convert to. * * @return string */ @@ -481,9 +481,9 @@ public static function reformat( $dt_string, $new_format ) { * option) and converts it to a strtotime() style modifier that can be used * to adjust a DateTime object, etc. * - * @param $offset + * @param string|int $offset The offset to convert. * - * @return string + * @return string The converted offset. */ public static function get_modifier_from_offset( $offset ) { $modifier = ''; @@ -1017,220 +1017,6 @@ public static function wp_locale_month( $month, $format = 'month' ) { // DEPRECATED METHODS // @codingStandardsIgnoreStart - /** - * Deprecated camelCase version of self::date_only - * - * @param int|string $date The date (timestamp or string). - * @param bool $isTimestamp Is $date in timestamp format? - * - * @return string The date only in DB format. - */ - public static function dateOnly( $date, $isTimestamp = false ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::date_only' ); - return self::date_only( $date, $isTimestamp ); - } - - /** - * Deprecated camelCase version of self::time_only - * - * @param string $date The date. - * - * @return string The time only in DB format. - */ - public static function timeOnly( $date ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::time_only' ); - return self::time_only( $date ); - } - - /** - * Deprecated camelCase version of self::hour_only - * - * @param string $date The date. - * - * @return string The hour only. - */ - public static function hourOnly( $date ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::hour_only' ); - return self::hour_only( $date ); - } - - /** - * Deprecated camelCase version of self::minutes_only - * - * @param string $date The date. - * - * @return string The minute only. - */ - public static function minutesOnly( $date ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::minutes_only' ); - return self::minutes_only( $date ); - } - - /** - * Deprecated camelCase version of self::meridian_only - * - * @param string $date The date. - * - * @return string The meridian only in DB format. - */ - public static function meridianOnly( $date ) { - _deprecated_function( __METHOD__, '3.11', __CLASS__ . '::meridian_only' ); - 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. diff --git a/src/Tribe/Editor/Compatibility/Classic_Editor.php b/src/Tribe/Editor/Compatibility/Classic_Editor.php index 2c2d0db339..4c051422fc 100644 --- a/src/Tribe/Editor/Compatibility/Classic_Editor.php +++ b/src/Tribe/Editor/Compatibility/Classic_Editor.php @@ -294,14 +294,14 @@ 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 ); } /** * Check if the setting `classic-editor-replace` is set to `replace` that option means to - * replace the gutenberg editor with the Classic Editor. + * replace the Gutenberg editor with the Classic Editor. * * Prior to 1.3 on Classic Editor plugin the value to identify if is on classic the value * was `replace`, now the value is `classic` diff --git a/src/Tribe/Editor/Meta.php b/src/Tribe/Editor/Meta.php index a209782cfb..e4abde435d 100644 --- a/src/Tribe/Editor/Meta.php +++ b/src/Tribe/Editor/Meta.php @@ -134,9 +134,9 @@ protected function text_array() { * * @since 4.8 * - * @param $value + * @param array $value The array to sanitize. * - * @return array + * @return array The sanitized array. */ public function sanitize_text_array( $value ) { if ( is_array( $value ) ) { @@ -151,7 +151,7 @@ public function sanitize_text_array( $value ) { * * @since 4.8 * - * @param mixed $value Check agains this value + * @param mixed $value Check against this value * * @return array|bool|int */ @@ -171,9 +171,9 @@ public function sanitize_numeric_array( $value ) { * * @since 4.8 * - * @param $value + * @param mixed $value The value to sanitize. * - * @return bool + * @return bool The sanitized value. */ public function sanitize_boolean( $value ) { return filter_var( $value, FILTER_VALIDATE_BOOLEAN ); @@ -185,16 +185,16 @@ public function sanitize_boolean( $value ) { * * @since 4.8 * - * @param $value + * @param mixed $value The separator value to sanitize. * - * @return mixed + * @return string The sanitized string value of the separator */ public function sanitize_separator( $value ) { return tec_sanitize_string( $value ); } /** - * Verify if the current user can edit or not this Post + * Verify if the current user can edit this Post or not. * * @since 4.8 * @@ -205,7 +205,7 @@ public function sanitize_separator( $value ) { * @param string $cap Capability name. * @param array $caps User capabilities. * - * @return boolean + * @return boolean Whether the user can edit the post. */ public function auth_callback( $allowed, $meta_key, $post_id, $user_id, $cap, $caps ) { $post = get_post( $post_id ); diff --git a/src/Tribe/JSON_LD/Abstract.php b/src/Tribe/JSON_LD/Abstract.php index e6e22f9fcd..6f55b4539b 100755 --- a/src/Tribe/JSON_LD/Abstract.php +++ b/src/Tribe/JSON_LD/Abstract.php @@ -291,10 +291,10 @@ public function get_types() { * * @since 4.7.12 * - * @param $post - * @param $type + * @param WP_Post|int|null $post The Post Object|ID, if null defaults to the global post object. + * @param string $type The type to set. * - * @return mixed + * @return mixed The type(s) for the post. */ public function set_type( $post, $type ) { $id = Tribe__Main::post_id_helper( $post ); @@ -336,8 +336,8 @@ public function remove( $post ) { * * @since 4.7.12 * - * @param $id - * @param $type + * @param string|int $id + * @param string $type * * @return bool */ diff --git a/src/Tribe/Log.php b/src/Tribe/Log.php index b25ac9581d..d08e7f6bff 100644 --- a/src/Tribe/Log.php +++ b/src/Tribe/Log.php @@ -296,7 +296,7 @@ public function set_current_logger( $engine ) { * Attempts to return the requested logging object or null if that * is not possible. * - * @param $class_name + * @param string $class_name The name of the logging class to instantiate. * * @return Tribe__Log__Logger|null */ diff --git a/src/Tribe/Log/Admin.php b/src/Tribe/Log/Admin.php index c5aa2472df..0249445902 100644 --- a/src/Tribe/Log/Admin.php +++ b/src/Tribe/Log/Admin.php @@ -209,11 +209,11 @@ protected function get_logging_levels() { * Provides a URL that can be used to download the current or specified * log. * - * @param $log + * @param ?string $unused_log * * @return string */ - protected function get_log_url( $log = null ) { + protected function get_log_url( $unused_log = null ) { $query = [ 'tribe-common-log' => 'download', 'check' => wp_create_nonce( 'download_log' ), diff --git a/src/Tribe/Main.php b/src/Tribe/Main.php index 1691428ba7..ecaeecc078 100644 --- a/src/Tribe/Main.php +++ b/src/Tribe/Main.php @@ -583,43 +583,43 @@ public static function get_post_types() { /** * Insert an array after a specified key within another array. * - * @param $key - * @param $source_array - * @param $insert_array + * @param string $key The key after which the array should be inserted. + * @param array $source The array into which the other array should be inserted. + * @param array $insert The array to insert. * * @return array */ - public static function array_insert_after_key( $key, $source_array, $insert_array ) { - if ( array_key_exists( $key, $source_array ) ) { - $position = array_search( $key, array_keys( $source_array ) ) + 1; - $source_array = array_slice( $source_array, 0, $position, true ) + $insert_array + array_slice( $source_array, $position, null, true ); + public static function array_insert_after_key( $key, $source, $insert ) { + if ( array_key_exists( $key, $source ) ) { + $position = array_search( $key, array_keys( $source ) ) + 1; + $source = array_slice( $source, 0, $position, true ) + $insert + array_slice( $source, $position, null, true ); } else { // If no key is found, then add it to the end of the array. - $source_array += $insert_array; + $source += $insert; } - return $source_array; + return $source; } /** * Insert an array immediately before a specified key within another array. * - * @param $key - * @param $source_array - * @param $insert_array + * @param string $key The key after which the array should be inserted. + * @param array $source The array into which the other array should be inserted. + * @param array $insert The array to insert. * * @return array */ - public static function array_insert_before_key( $key, $source_array, $insert_array ) { - if ( array_key_exists( $key, $source_array ) ) { - $position = array_search( $key, array_keys( $source_array ) ); - $source_array = array_slice( $source_array, 0, $position, true ) + $insert_array + array_slice( $source_array, $position, null, true ); + public static function array_insert_before_key( $key, $source, $insert ) { + if ( array_key_exists( $key, $source ) ) { + $position = array_search( $key, array_keys( $source ) ); + $source = array_slice( $source, 0, $position, true ) + $insert + array_slice( $source, $position, null, true ); } else { // If no key is found, then add it to the end of the array. - $source_array += $insert_array; + $source += $insert; } - return $source_array; + return $source; } /** diff --git a/src/Tribe/Meta/Chunker.php b/src/Tribe/Meta/Chunker.php index f24018d649..431eb42973 100644 --- a/src/Tribe/Meta/Chunker.php +++ b/src/Tribe/Meta/Chunker.php @@ -182,8 +182,8 @@ protected function is_supported_post_type( $object_id ) { /** * Tags a post ID and meta key couple as "chunkable" if needed. * - * @param $post_id - * @param $meta_key + * @param string|int $post_id + * @param string $meta_key */ protected function tag_as_chunkable( $post_id, $meta_key ) { $key = $this->get_key( $post_id, $meta_key ); diff --git a/src/Tribe/PUE/Checker.php b/src/Tribe/PUE/Checker.php index 6ddb7c281a..cb3938e50d 100755 --- a/src/Tribe/PUE/Checker.php +++ b/src/Tribe/PUE/Checker.php @@ -1293,7 +1293,7 @@ public function add_notice_to_plugin_notices( $notices ) { * * @see Tribe__PUE__Checker::request_info() * - * @param $query_args + * @param array $query_args * * @return Tribe__PUE__Plugin_Info|null */ @@ -1714,23 +1714,23 @@ public function add_result_filter( $callback ) { /** * Insert an array after a specified key within another array. * - * @param $key - * @param $source_array - * @param $insert_array + * @param string $key The key after which the array should be inserted. + * @param array $source The array into which the other array should be inserted. + * @param array $insert The array to insert. * * @return array * */ - public static function array_insert_after_key( $key, $source_array, $insert_array ) { - if ( array_key_exists( $key, $source_array ) ) { - $position = array_search( $key, array_keys( $source_array ), true ) + 1; - $source_array = array_slice( $source_array, 0, $position, true ) + $insert_array + array_slice( $source_array, $position, null, true ); + public static function array_insert_after_key( $key, $source, $insert ) { + if ( array_key_exists( $key, $source ) ) { + $position = array_search( $key, array_keys( $source ), true ) + 1; + $source = array_slice( $source, 0, $position, true ) + $insert + array_slice( $source, $position, null, true ); } else { // If no key is found, then add it to the end of the array. - $source_array += $insert_array; + $source += $insert; } - return $source_array; + return $source; } /** diff --git a/src/Tribe/Promoter/Auth.php b/src/Tribe/Promoter/Auth.php index a7939e25a4..2b4349a054 100644 --- a/src/Tribe/Promoter/Auth.php +++ b/src/Tribe/Promoter/Auth.php @@ -49,7 +49,7 @@ public function register_setting() { * * @since 4.9.12 * - * @param $secret_key + * @param string $secret_key * * @return string */ diff --git a/src/Tribe/Repository.php b/src/Tribe/Repository.php index 269d15394c..c03553b9cb 100644 --- a/src/Tribe/Repository.php +++ b/src/Tribe/Repository.php @@ -1239,7 +1239,7 @@ protected function modify_query( $key, $call_args ) { * * @since 4.7.19 * - * @param $key + * @param string $key The key to check for. * * @return bool */ diff --git a/src/Tribe/Repository/Core_Read_Interface.php b/src/Tribe/Repository/Core_Read_Interface.php index ca777fb706..b2004dccaf 100644 --- a/src/Tribe/Repository/Core_Read_Interface.php +++ b/src/Tribe/Repository/Core_Read_Interface.php @@ -243,7 +243,7 @@ public function parent_not_in( $post_ids ); * This is the default WordPress search, to search by title, * content or excerpt only use the `title`, `content`, `excerpt` filters. * - * @param $search + * @param string $search * * @return Tribe__Repository__Read_Interface */ diff --git a/src/Tribe/Service_Providers/Promoter.php b/src/Tribe/Service_Providers/Promoter.php index c3887477c9..bb180dbb9e 100644 --- a/src/Tribe/Service_Providers/Promoter.php +++ b/src/Tribe/Service_Providers/Promoter.php @@ -51,7 +51,8 @@ private function hook() { * Add Admin Bar link to the promoter website * * @since 4.9.2 - * @param $wp_admin_bar + * + * @param WP_Admin_Bar $wp_admin_bar */ public function add_promoter_logo_on_admin_bar( $wp_admin_bar ) { /** @var Tribe__Promoter__PUE $pue */ @@ -77,6 +78,7 @@ public function add_promoter_logo_on_admin_bar( $wp_admin_bar ) { 'class' => 'promoter-admin-bar-link', ], ]; + $wp_admin_bar->add_node( $args ); } diff --git a/src/Tribe/Support.php b/src/Tribe/Support.php index 1c7be122f3..f4d14bb2cf 100755 --- a/src/Tribe/Support.php +++ b/src/Tribe/Support.php @@ -343,9 +343,9 @@ public static function opt_in() { /** * Method to send back sysinfo * - * @param $query + * @param mixed $query The event query. * - * @return string|void + * @return string * */ public static function sysinfo_query( $query ) { @@ -361,10 +361,9 @@ public static function sysinfo_query( $query ) { wp_send_json_error( __( 'Invalid Key', 'tribe-common' ) ); } - $support = Tribe__Support::getInstance(); - $systeminfo = $support->formattedSupportStats(); + $support = static::getInstance(); - return $systeminfo; + return $support->formattedSupportStats(); } /* diff --git a/src/Tribe/Tabbed_View/Tab.php b/src/Tribe/Tabbed_View/Tab.php index 8032ed62b8..83844ae742 100644 --- a/src/Tribe/Tabbed_View/Tab.php +++ b/src/Tribe/Tabbed_View/Tab.php @@ -75,7 +75,7 @@ public function get_priority() { } /** - * @param $priority + * @param int $priority */ public function set_priority( $priority ) { $this->priority = $priority; diff --git a/src/Tribe/Template_Part_Cache.php b/src/Tribe/Template_Part_Cache.php index 3a3e99ac64..ecfdf2062a 100755 --- a/src/Tribe/Template_Part_Cache.php +++ b/src/Tribe/Template_Part_Cache.php @@ -27,6 +27,11 @@ class Tribe__Template_Part_Cache { */ private $cache; + /** + * @var string The transient key/ID. + */ + private $key; + /** * @var string */ @@ -35,10 +40,10 @@ class Tribe__Template_Part_Cache { /** ** Short description * - * @param $template - which template in the views directory is being cached (relative path). - * @param $id - a unique identifier for this fragment. - * @param $expiration - expiration time for the cached fragment. - * @param $expiration_trigger - wordpress hook to expire on. + * @param string $template Which template in the views directory is being cached (relative path). + * @param string|int $id A unique identifier for this fragment. + * @param string|int $expiration The expiration time for the cached fragment. + * @param string $expiration_trigger The wordpress hook to expire on. */ public function __construct( $template, $id, $expiration, $expiration_trigger ) { $this->template = $template; @@ -69,7 +74,7 @@ public function add_hooks() { * Checks if there is a cached html fragment in the transients, if it's there, * don't include the requested file path. If not, just return the file path like normal * - * @param $path file path to the month view template part + * @param string $path file path to the month view template part * * @return bool * @uses tribe_get_template_part_path_[template] hook @@ -89,8 +94,8 @@ public function display( $path ) { /** * Set cached html in transients * - * @param $html - * @param $template + * @param string $html HTML to cache. + * @param string $template Template part being cached. * * @return string * @uses tribe_get_template_part_content hook diff --git a/src/Tribe/Tracker.php b/src/Tribe/Tracker.php index 20e5413917..5dfedaed0c 100644 --- a/src/Tribe/Tracker.php +++ b/src/Tribe/Tracker.php @@ -356,16 +356,16 @@ public function filter_watch_post_fields( $post_id, $post_after, $post_before ) * * @see wp_set_object_terms() * - * @param $object_id - * @param $terms - * @param $tt_ids - * @param $taxonomy - * @param $append - * @param $old_tt_ids + * @param string|int $object_id The post object ID. + * @param array $terms + * @param array $tt_ids + * @param string $taxonomy + * @param bool $unused_append + * @param array $old_tt_ids * * @return bool `true` if the post type and taxonomy are tracked, `false` otherwise. */ - public function track_taxonomy_term_changes( $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids ) { + public function track_taxonomy_term_changes( $object_id, $terms, $tt_ids, $taxonomy, $unused_append, $old_tt_ids ) { /** * Allows toggling the post taxonomy terms tracking * diff --git a/src/Tribe/Utils/Post_Root_Pool.php b/src/Tribe/Utils/Post_Root_Pool.php index de1b920ab4..65682da754 100644 --- a/src/Tribe/Utils/Post_Root_Pool.php +++ b/src/Tribe/Utils/Post_Root_Pool.php @@ -86,7 +86,7 @@ public function get_pool_transient_name() { } /** - * @param $string + * @param string $string * * @return string * @deprecated 4.7.18 @@ -98,7 +98,7 @@ protected function uc_first_letter( $string ) { } /** - * @param $string + * @param string $string * * @return string * @deprecated 4.7.18 @@ -152,8 +152,8 @@ public static function reset_pool() { } /** - * @param $post_name - * @param $postfix + * @param string $post_name + * @param string $postfix * * @return string */ diff --git a/src/Tribe/Values/Abstract_Value.php b/src/Tribe/Values/Abstract_Value.php index 34ecb0ca11..d7ea4f98c3 100644 --- a/src/Tribe/Values/Abstract_Value.php +++ b/src/Tribe/Values/Abstract_Value.php @@ -419,8 +419,8 @@ protected function set_float_value() { * * @since 4.14.9 * - * @param $separator string a separator token, like . or , - * @param $value string a number formatted as a string + * @param string $separator A separator token, like . or , + * @param string $value A number formatted as a string * * @return bool */ diff --git a/src/functions/template-tags/general.php b/src/functions/template-tags/general.php index f0ccd1334c..0ca0e132d6 100755 --- a/src/functions/template-tags/general.php +++ b/src/functions/template-tags/general.php @@ -157,16 +157,11 @@ 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 ); - /** - * Deprecated the tribe_events_resource_url filter in 4.0 in favor of tribe_resource_url. Remove in 5.0 - */ - $url = apply_filters( 'tribe_events_resource_url', $url, $resource ); - if ( $echo ) { echo $url; } @@ -310,7 +305,7 @@ function tribe_get_days_between( $start_date, $end_date, $day_cutoff = '00:00' ) * * @category Events * - * @param $string + * @param string $string * * @return string */ @@ -427,11 +422,12 @@ function tribe_is_bot() { /** * Count keys in a hierarchical array * - * @param $value - * @param $key - * @todo - remove, only used in the meta walker + * @param mixed $value + * @param mixed $key + * @deprecated TBD */ function tribe_count_hierarchical_keys( $value, $key ) { + _deprecated_function( __FUNCTION__, 'TBD' ); global $tribe_count_hierarchical_increment; $tribe_count_hierarchical_increment++; } @@ -444,9 +440,10 @@ function tribe_count_hierarchical_keys( $value, $key ) { * @param array $walk * * @return int - * @todo - remove, only used in the meta walker + * @deprecated TBD */ function tribe_count_hierarchical( array $walk ) { + _deprecated_function( __FUNCTION__, 'TBD' ); global $tribe_count_hierarchical_increment; $tribe_count_hierarchical_increment = 0; array_walk_recursive( $walk, 'tribe_count_hierarchical_keys' ); diff --git a/src/functions/utils.php b/src/functions/utils.php index c01cd540b9..ebfff0fc6f 100644 --- a/src/functions/utils.php +++ b/src/functions/utils.php @@ -565,7 +565,7 @@ function tribe_post_exists( $post_id_or_name, $post_type = null ) { * Wrapper function for `tribe_events_get_the_excerpt` to prevent access the function when is not present on the * current site installation. * - * @param $post + * @param WP_Post|int|null $post The Post Object|ID, if null defaults to get_the_ID() * * @return null|string */ diff --git a/tribe-common.php b/tribe-common.php index 30ed2422fd..e21c11f4fe 100644 --- a/tribe-common.php +++ b/tribe-common.php @@ -9,6 +9,7 @@ * License: GPLv2 or later */ + /* Copyright 2009-2015 by The Events Calendar and the contributors