Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use php 8.4 for phpstan github workflow and fix all deprecation errors #7220

Merged
merged 15 commits into from
Jan 27, 2025

Conversation

wordpressfan
Copy link
Contributor

@wordpressfan wordpressfan commented Jan 8, 2025

Description

Fixes #7219

Here we update the CI workflow to use php 8.4 also fix all deprecation reported issues.

Type of change

  • Enhancement (non-breaking change which improves an existing functionality).

Detailed scenario

Everything is mentioned in the issue and slack discussion:
https://wp-media.slack.com/archives/CUT7FLHF1/p1736364885301529

Technical description

Documentation

N/A

New dependencies

N/A

Risks

N/A

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

If some mandatory items are not relevant, explain why in this section.

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

Copy link

codacy-production bot commented Jan 8, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for e726c3d1 (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e726c3d) Report Missing Report Missing Report Missing
Head commit (aea1cc0) 38760 17142 44.23%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7220) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@wordpressfan wordpressfan changed the title [POC] use php 8.4 for phpstan github workflow Use php 8.4 for phpstan github workflow and fix all deprecation errors Jan 14, 2025
@wordpressfan wordpressfan marked this pull request as ready for review January 14, 2025 10:28
@wordpressfan wordpressfan requested review from a team and remyperona January 14, 2025 10:42
@Mai-Saad
Copy link
Contributor

For test (share results of):

@jeawhanlee
Copy link
Contributor

jeawhanlee commented Jan 15, 2025

Screenshot 2025-01-15 at 15 19 51

detailed test report in shared/rocket-e2e-reports/wpr_3.18_4220

Failed VR tests:
Screenshot 2025-01-15 at 14 29 06
Screenshot 2025-01-15 at 14 29 23
Screenshot 2025-01-15 at 15 05 37
Screenshot 2025-01-15 at 15 05 52
Screenshot 2025-01-15 at 15 06 14

@wordpressfan
Copy link
Contributor Author

@jeawhanlee @Mai-Saad so we are fine to merge this one?

@wordpressfan
Copy link
Contributor Author

Thanks @jeawhanlee
We have this deprecation errors in two packages with the following details:

  1. Mobile detect package: we use version 2.8 and they fixed this exactly here and released with version 4.8.0
  2. Action Scheduler library: We use version 3.8.1 and they fixed this here which was released on version 3.9.0

@piotrbak @wp-media/engineering-plugin-team are we OK to update those dependencies in this PR or we need another issues with dedicated PRs?

@piotrbak
Copy link
Contributor

@wordpressfan We could either create one separate issue for both upgrades, or do it within this PR.

The mobile detect update seems to be huge.

@wordpressfan
Copy link
Contributor Author

We agreed on updating Action Scheduler's package then create a dedicated PR for Mobile Detect update.

Copy link

codacy-production bot commented Jan 21, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for e726c3d1 8.15% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e726c3d) Report Missing Report Missing Report Missing
Head commit (1dc8fc6) 39333 17143 43.58%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7220) 810 66 8.15%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@MathieuLamiot
Copy link
Contributor

need to retest the failed tests from the report.

@jeawhanlee
Copy link
Contributor

There are still some deprecation notices relating to Action Scheduler:

PHP Deprecated: ActionScheduler_ActionFactory::get_stored_action(): Implicitly marking parameter $schedule as nullable is deprecated, the explicit nullable type must be used instead in /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/classes/ActionScheduler_ActionFactory.php on line 21
[27-Jan-2025 11:54:55 UTC] PHP Stack trace:
[27-Jan-2025 11:54:55 UTC] PHP 1. {main}() /home/boyetesz/public_html/test/wp-admin/plugins.php:0
[27-Jan-2025 11:54:55 UTC] PHP 2. activate_plugin($plugin = 'wp-rocket/wp-rocket.php', $redirect = 'https://boyetechnology.com/test/wp-admin/plugins.php?error=true&plugin=wp-rocket%2Fwp-rocket.php', $network_wide = FALSE, $silent = uninitialized) /home/boyetesz/public_html/test/wp-admin/plugins.php:60
[27-Jan-2025 11:54:55 UTC] PHP 3. do_action($hook_name = 'activate_wp-rocket/wp-rocket.php', ...$arg = variadic(FALSE)) /home/boyetesz/public_html/test/wp-admin/includes/plugin.php:703
[27-Jan-2025 11:54:55 UTC] PHP 4. WP_Hook->do_action($args = [0 => FALSE]) /home/boyetesz/public_html/test/wp-includes/plugin.php:517
[27-Jan-2025 11:54:55 UTC] PHP 5. WP_Hook->apply_filters($value = '', $args = [0 => FALSE]) /home/boyetesz/public_html/test/wp-includes/class-wp-hook.php:348
[27-Jan-2025 11:54:55 UTC] PHP 6. WP_Rocket\Engine\Activation\Activation::activate_plugin(FALSE) /home/boyetesz/public_html/test/wp-includes/class-wp-hook.php:324
[27-Jan-2025 11:54:55 UTC] PHP 7. do_action($hook_name = 'rocket_activation') /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Engine/Activation/Activation.php:90
[27-Jan-2025 11:54:55 UTC] PHP 8. WP_Hook->do_action($args = [0 => '']) /home/boyetesz/public_html/test/wp-includes/plugin.php:517
[27-Jan-2025 11:54:55 UTC] PHP 9. WP_Hook->apply_filters($value = '', $args = [0 => '']) /home/boyetesz/public_html/test/wp-includes/class-wp-hook.php:348
[27-Jan-2025 11:54:55 UTC] PHP 10. WP_Rocket\Engine\Preload\Activation\Activation->preload_activation('') /home/boyetesz/public_html/test/wp-includes/class-wp-hook.php:324
[27-Jan-2025 11:54:55 UTC] PHP 11. WP_Rocket\Engine\Preload\Controller\Queue->add_job_preload_job_load_initial_sitemap_async() /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Engine/Preload/Activation/Activation.php:78
[27-Jan-2025 11:54:55 UTC] PHP 12. WP_Rocket\Engine\Common\Queue\AbstractASQueue->add_async($hook = 'rocket_preload_job_load_initial_sitemap', $args = uninitialized) /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Engine/Preload/Controller/Queue.php:23
[27-Jan-2025 11:54:55 UTC] PHP 13. as_enqueue_async_action($hook = 'rocket_preload_job_load_initial_sitemap', $args = [], $group = 'rocket-preload', $unique = uninitialized, $priority = uninitialized) /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Engine/Common/Queue/AbstractASQueue.php:29
[27-Jan-2025 11:54:55 UTC] PHP 14. ActionScheduler::factory() /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/functions.php:45
[27-Jan-2025 11:54:55 UTC] PHP 15. ActionScheduler::autoload($class = 'ActionScheduler_ActionFactory') /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/classes/abstracts/ActionScheduler.php:39
[27-Jan-2025 11:54:55 UTC] PHP Deprecated: ActionScheduler_Schedule_Deprecated::next(): Implicitly marking parameter $after as nullable is deprecated, the explicit nullable type must be used instead in /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/deprecated/ActionScheduler_Schedule_Deprecated.php on line 16
[27-Jan-2025 11:54:55 UTC] PHP Stack trace:
[27-Jan-2025 11:54:55 UTC] PHP 1. {main}() /home/boyetesz/public_html/test/wp-admin/plugins.php:0
[27-Jan-2025 11:54:55 UTC] PHP 2. activate_plugin($plugin = 'wp-rocket/wp-rocket.php', $redirect = 'https://boyetechnology.com/test/wp-admin/plugins.php?error=true&plugin=wp-rocket%2Fwp-rocket.php', $network_wide = FALSE, $silent = uninitialized) /home/boyetesz/public_html/test/wp-admin/plugins.php:60
[27-Jan-2025 11:54:55 UTC] PHP 3. do_action($hook_name = 'activate_wp-rocket/wp-rocket.php', ...$arg = variadic(FALSE)) /home/boyetesz/public_html/test/wp-admin/includes/plugin.php:703
[27-Jan-2025 11:54:55 UTC] PHP 4. WP_Hook->do_action($args = [0 => FALSE]) /home/boyetesz/public_html/test/wp-includes/plugin.php:517
[27-Jan-2025 11:54:55 UTC] PHP 5. WP_Hook->apply_filters($value = '', $args = [0 => FALSE]) /home/boyetesz/public_html/test/wp-includes/class-wp-hook.php:348
[27-Jan-2025 11:54:55 UTC] PHP 6. WP_Rocket\Engine\Activation\Activation::activate_plugin(FALSE) /home/boyetesz/public_html/test/wp-includes/class-wp-hook.php:324
[27-Jan-2025 11:54:55 UTC] PHP 7. do_action($hook_name = 'rocket_activation') /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Engine/Activation/Activation.php:90
[27-Jan-2025 11:54:55 UTC] PHP 8. WP_Hook->do_action($args = [0 => '']) /home/boyetesz/public_html/test/wp-includes/plugin.php:517
[27-Jan-2025 11:54:55 UTC] PHP 9. WP_Hook->apply_filters($value = '', $args = [0 => '']) /home/boyetesz/public_html/test/wp-includes/class-wp-hook.php:348
[27-Jan-2025 11:54:55 UTC] PHP 10. WP_Rocket\Engine\Preload\Activation\Activation->preload_activation('') /home/boyetesz/public_html/test/wp-includes/class-wp-hook.php:324
[27-Jan-2025 11:54:55 UTC] PHP 11. WP_Rocket\Engine\Preload\Controller\Queue->add_job_preload_job_load_initial_sitemap_async() /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Engine/Preload/Activation/Activation.php:78
[27-Jan-2025 11:54:55 UTC] PHP 12. WP_Rocket\Engine\Common\Queue\AbstractASQueue->add_async($hook = 'rocket_preload_job_load_initial_sitemap', $args = uninitialized) /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Engine/Preload/Controller/Queue.php:23
[27-Jan-2025 11:54:55 UTC] PHP 13. as_enqueue_async_action($hook = 'rocket_preload_job_load_initial_sitemap', $args = [], $group = 'rocket-preload', $unique = uninitialized, $priority = uninitialized) /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Engine/Common/Queue/AbstractASQueue.php:29
[27-Jan-2025 11:54:55 UTC] PHP 14. ActionScheduler_ActionFactory->create($options = ['type' => 'async', 'hook' => 'rocket_preload_job_load_initial_sitemap', 'arguments' => [], 'group' => 'rocket-preload', 'unique' => FALSE, 'priority' => 10]) /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/functions.php:45
[27-Jan-2025 11:54:55 UTC] PHP 15. ActionScheduler::autoload($class = 'ActionScheduler_NullSchedule') /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/classes/ActionScheduler_ActionFactory.php:290
[27-Jan-2025 11:54:55 UTC] PHP 16. include() /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/classes/abstracts/ActionScheduler.php:164
[27-Jan-2025 11:54:55 UTC] PHP 17. ActionScheduler::autoload($class = 'ActionScheduler_SimpleSchedule') /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/classes/schedules/ActionScheduler_NullSchedule.php:6
[27-Jan-2025 11:54:55 UTC] PHP 18. include() /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/classes/abstracts/ActionScheduler.php:164
[27-Jan-2025 11:54:55 UTC] PHP 19. ActionScheduler::autoload($class = 'ActionScheduler_Abstract_Schedule') /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/classes/schedules/ActionScheduler_SimpleSchedule.php:6
[27-Jan-2025 11:54:55 UTC] PHP 20. include() /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/classes/abstracts/ActionScheduler.php:164
[27-Jan-2025 11:54:55 UTC] PHP 21. ActionScheduler::autoload($class = 'ActionScheduler_Schedule_Deprecated') /home/boyetesz/public_html/test/wp-content/plugins/wp-rocket/inc/Dependencies/ActionScheduler/classes/abstracts/ActionScheduler_Abstract_Schedule.php:6
[27-Jan-2025 11:54:56 UTC] Cron reschedule event error for hook: action_scheduler_run_queue, Error code: invalid_schedule, Error message: Event schedule does not exist., Data: {"schedule":"every_minute","args":["WP Cron"],"interval":60}

@wordpressfan
Copy link
Contributor Author

Last week, Action scheduler released 3.9.1 with some deprecation fixes, updated it now, and will open a github issue to check league container and see if they fixed that on their side or not without delaying this PR.

@jeawhanlee
Copy link
Contributor

With recent commit to update AS to 3.9.1, There's no more deprecation notice relating to AS, however, we still have deprecation notices for League Container & Mobile Detect packages. We are all good here, since this will not be handled in this PR so it can move forward.

@wordpressfan wordpressfan added this pull request to the merge queue Jan 27, 2025
Merged via the queue into develop with commit ef0a839 Jan 27, 2025
12 of 13 checks passed
@wordpressfan wordpressfan deleted the dev/use-php8.4-for-phpstan-workflow branch January 27, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants