Skip to content

Apply conservative Rector cleanup#170

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

Apply conservative Rector cleanup#170
dereuromark merged 5 commits into
masterfrom
rector-cleanup-20260524

Conversation

@dereuromark
Copy link
Copy Markdown
Owner

Applies the same conservative, behavior-neutral Rector cleanup pass as used in dereuromark/cakephp-ide-helper#452, but without committing Rector config or dependency wiring here.

  • dead-code and code-quality simplifications only
  • excludes the same unsafe / opinionated ruleset areas
  • keeps the PR scope to generated cleanup changes in src/ and tests/

This was generated with a temporary local Rector config and followed with CS fixes where needed.

Copilot AI review requested due to automatic review settings May 24, 2026 17:02
Copy link
Copy Markdown

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 a conservative Rector-driven cleanup pass across src/ and tests/, aiming to simplify code paths and remove dead/verbose constructs without changing runtime behavior.

Changes:

  • Simplifies returns/conditionals (e.g., direct returns, ternaries) and adopts newer PHP helpers like str_contains().
  • Cleans up unused variables and modernizes exception catching where the exception variable is unused.
  • Adds a few type-safety casts around string operations (trim(), str_contains()).

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/TestCase/Controller/Component/AuthUserComponentTest.php Simplifies an intermediate variable by returning an anonymous ResultInterface implementation directly.
tests/TestCase/Controller/Component/AuthenticationComponentTest.php Updates the startup() call site to match the component signature.
tests/schema.php Uses catch-without-variable for an unused ReflectionException.
src/View/Helper/AuthUserHelper.php Refactors prefix/plugin normalization to an equivalent empty() ? null : value form.
src/View/Helper/AuthenticationHelper.php Same prefix/plugin normalization refactor as above.
src/Utility/TinyAuth.php Removes temporary variable, returning _getAvailableRoles() directly.
src/Sync/Syncer.php Refactors auth-allow initialization and simplifies _noAuthenticationNeeded() return logic.
src/Sync/Adder.php Uses str_contains() and simplifies _noAuthenticationNeeded() return logic.
src/Panel/AuthPanel.php Collapses an if/else into a ternary when preparing temporary users for access checks.
src/Controller/Component/AuthUserComponent.php Refactors prefix/plugin normalization to an equivalent empty() ? null : value form.
src/Controller/Component/AuthenticationComponent.php Refactors prefix/plugin normalization to an equivalent empty() ? null : value form.
src/Auth/AuthUserTrait.php Simplifies role retrieval and refactors hasRole(s) control flow.
src/Auth/AllowTrait.php Refactors _isActionAllowed() to a single return expression.
src/Auth/AclTrait.php Simplifies prefix-map computation and adds a string cast before str_contains().
src/Auth/AclAdapter/AbstractAclAdapter.php Adds string cast before trimming roles.

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

Comment thread tests/TestCase/Controller/Component/AuthenticationComponentTest.php Outdated
Comment thread src/Sync/Syncer.php Outdated
Comment thread src/Sync/Adder.php Outdated
Comment thread src/Auth/AuthUserTrait.php Outdated
Comment thread src/Auth/AllowTrait.php Outdated
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 24, 2026

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

Codecov Report

❌ Patch coverage is 76.47059% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.65%. Comparing base (609b2af) to head (6f0e82f).

Files with missing lines Patch % Lines
src/Sync/Adder.php 0.00% 3 Missing ⚠️
src/Sync/Syncer.php 50.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #170      +/-   ##
============================================
- Coverage     77.65%   77.65%   -0.01%     
+ Complexity      494      490       -4     
============================================
  Files            32       32              
  Lines          1329     1311      -18     
============================================
- Hits           1032     1018      -14     
+ Misses          297      293       -4     

☔ 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 24, 2026 18:13
Copy link
Copy Markdown

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 15 out of 15 changed files in this pull request and generated 2 comments.

Comment thread src/Auth/AclTrait.php
Comment thread src/Auth/AllowTrait.php Outdated
Copilot AI review requested due to automatic review settings May 25, 2026 13:31
Copy link
Copy Markdown

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 11 out of 11 changed files in this pull request and generated no new comments.

@dereuromark dereuromark merged commit 1f4b5fb into master May 25, 2026
17 checks passed
@dereuromark dereuromark deleted the rector-cleanup-20260524 branch May 25, 2026 13:37
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