Apply conservative Rector cleanup#170
Conversation
There was a problem hiding this comment.
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.
|
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
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.
src/andtests/This was generated with a temporary local Rector config and followed with CS fixes where needed.