Apply conservative Rector cleanup#54
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #54 +/- ##
============================================
+ Coverage 86.94% 87.43% +0.49%
+ Complexity 232 231 -1
============================================
Files 18 18
Lines 789 780 -9
============================================
- Hits 686 682 -4
+ Misses 103 98 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Applies a conservative Rector-driven cleanup pass across src/ and tests/, aiming for behavior-neutral simplifications and modern PHP idioms consistent with PHP >=8.2 in this plugin.
Changes:
- Modernizes syntax (e.g.,
catchwithout variable,str_starts_with(),match, ternaries) and simplifies boolean-returning conditionals. - Refactors some controller view variable passing from
compact()to explicit arrays. - Minor string concatenation/return simplifications in helpers/behaviors.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/schema.php | Removes unused exception variable via PHP 8+ catch syntax. |
| tests/bootstrap.php | Replaces substr() OS check with str_starts_with(). |
| src/View/Helper/CaptchaHelper.php | Simplifies concatenation/return when appending passive field HTML. |
| src/Model/Behavior/PassiveCaptchaBehavior.php | Removes redundant (string) cast in log message concatenation. |
| src/Model/Behavior/CaptchaBehavior.php | Simplifies min/max time validations and small UUID assignment refactor. |
| src/Engine/MathEngine.php | Replaces switch with match for output format handling. |
| src/Engine/Math/SimpleMath.php | Simplifies operator conditional to a ternary. |
| src/Controller/CaptchaController.php | Switches $this->set(compact(...)) to explicit array. |
| src/Controller/Admin/IpsController.php | Switches $this->set(compact(...)) to explicit arrays. |
| src/Controller/Admin/CaptchaController.php | Switches $this->set(compact(...)) to explicit arrays. |
Comments suppressed due to low confidence (1)
src/Engine/MathEngine.php:90
- The new
matcharms are indented with spaces while the surrounding file uses tabs. This can cause inconsistent formatting and potentially fail coding-standard checks; please align indentation with the rest of the file.
match ($this->_config['imageFormat']) {
static::FORMAT_JPEG => imagejpeg($formula->image),
static::FORMAT_PNG => imagepng($formula->image),
default => ob_get_clean() ?: '',
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.