Skip to content

Apply conservative Rector cleanup#501

Merged
dereuromark merged 7 commits into
masterfrom
rector-cleanup-20260524
May 25, 2026
Merged

Apply conservative Rector cleanup#501
dereuromark merged 7 commits into
masterfrom
rector-cleanup-20260524

Conversation

@dereuromark
Copy link
Copy Markdown
Owner

Cleanup-only Rector follow-up PR. No Rector dependency or config is added here; this keeps the branch focused on conservative code cleanup only.

Copilot AI review requested due to automatic review settings May 25, 2026 12:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR applies conservative, cleanup-only refactors consistent with Rector-style modernization across the Queue plugin and its test suite, primarily to leverage PHP 8.2+ language features and reduce legacy patterns without changing intended behavior.

Changes:

  • Replace legacy string functions (strpos(), substr()) with PHP 8+ helpers (str_contains(), str_starts_with()) and add safe casts where helpful.
  • Simplify control flow and boolean/ternary logic (early returns, inline returns, null-coalescing assignment, first-class callables).
  • Add/adjust a few PHPDoc type hints to improve static analysis in table/query result handling.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/TestCase/View/Helper/QueueProgressHelperTest.php Modernizes driver detection using str_contains() for skip logic.
tests/TestCase/Queue/Task/EmailTaskTest.php Uses str_contains() to simplify Postgres skip condition.
tests/TestCase/Queue/ProcessorTest.php Modernizes driver detection using str_contains() for skip logic.
tests/TestCase/Model/Table/QueuedJobsTableTest.php Fixes test docblock return type and modernizes driver detection.
tests/TestCase/Controller/Admin/QueuedJobsControllerTest.php Modernizes driver detection using str_contains() for skip logic.
tests/TestCase/Controller/Admin/QueueControllerTest.php Modernizes driver detection using str_contains() for skip logic.
tests/TestCase/Command/RunCommandTest.php Modernizes driver detection using str_contains() for skip logic.
tests/schema.php Uses catch-without-variable for ReflectionException.
tests/bootstrap.php Replaces OS prefix check with str_starts_with().
src/View/Helper/QueueHelper.php Simplifies boolean return logic for job state helpers.
src/Queue/TaskFinder.php Removes unused foreach value variable.
src/Queue/Task/ProgressExampleTask.php Simplifies ternary assignment for duration.
src/Queue/Task/MonitorExampleTask.php Replaces strpos() check with str_contains().
src/Queue/Task/ExecuteTask.php Simplifies conditional command escaping into a ternary.
src/Queue/Task/EmailTask.php Casts method key to string before building setter name.
src/Queue/Processor.php Uses first-class callables for signal handlers; removes unused exception variables; simplifies PID retrieval.
src/Queue/Config.php Uses null-coalescing assignment for default timeout.
src/Model/Table/QueueProcessesTable.php Adds a result-shape PHPDoc for improved static analysis.
src/Model/Table/QueuedJobsTable.php Adds PHPDoc for query results, minor style simplifications, and safer string handling.
src/Model/Behavior/JsonableBehavior.php Flattens nested conditionals in JSON input handling.
src/Mailer/Transport/SimpleQueueTransport.php Removes redundant check when pruning empty message settings.
src/Generator/Task/QueuedJobTask.php Simplifies iteration to keys only; inlines return from TaskFinder.
src/Controller/Admin/QueueProcessesController.php Uses catch-without-variable for generic exception handling.
src/Controller/Admin/QueuedJobsController.php Iterates task keys directly where values are unused.
src/Controller/Admin/QueueController.php Adds string casts for mb_substr() inputs in referer validation.
src/Controller/Admin/LoadHelperTrait.php Simplifies helper selection into a ternary.
src/Command/InfoCommand.php Iterates task keys directly where values are unused.
src/Command/BakeQueueTaskCommand.php Uses str_contains() and returns heredoc directly.
src/Command/AddCommand.php Iterates task keys directly where values are unused.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 25, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.32%. Comparing base (d01d1a4) to head (1a2132d).
⚠️ Report is 1 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #501   +/-   ##
=========================================
  Coverage     78.32%   78.32%           
  Complexity      977      977           
=========================================
  Files            45       45           
  Lines          3313     3313           
=========================================
  Hits           2595     2595           
  Misses          718      718           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings May 25, 2026 13:31
@dereuromark dereuromark force-pushed the rector-cleanup-20260524 branch from f4f7b73 to e84f370 Compare May 25, 2026 13:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/Model/Table/QueueProcessesTable.php Outdated
Copilot AI review requested due to automatic review settings May 25, 2026 13:50
@dereuromark dereuromark merged commit c941aea into master May 25, 2026
16 of 17 checks passed
@dereuromark dereuromark deleted the rector-cleanup-20260524 branch May 25, 2026 13:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/Model/Table/QueueProcessesTable.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants