Skip to content

Replace PHPStan and PHPCS with Mago - #35

Merged
mathroc merged 1 commit into
mainfrom
mathroc/replace-phpstan-phpcs-with
Nov 15, 2026
Merged

mathroc merged 1 commit into
mainfrom
mathroc/replace-phpstan-phpcs-with

Conversation

@mathroc

@mathroc mathroc commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Replace phpstan/*, squizlabs/php_codesniffer and slevomat/coding-standard with carthage-software/mago (composer.lock updated; the only change is swapping these tools)
  • Add mago.toml:
    • formatter uses default style, except the opening tag and declare stay on one line
    • mago fmt and mago lint cover src/ and tests/
    • mago analyze covers src/ only, as PHPStan did, and is stricter than Mago's defaults (checked exceptions, missing type hints, missing #[Override], unused parameters, array-key checks); it fails on warnings
  • CI runs mago fmt --check, mago lint and mago analyze in place of PHPCS and PHPStan
  • Reaper::watch(): small rewrite so the analyzer can infer the WeakMap entry type (same behaviour, still returns the new reaper)
  • Reformat tests/ReaperTest.php with mago fmt
  • Update .gitattributes and the devcontainer extension list

Test plan

  • mago fmt --check, mago lint, mago analyze pass locally
  • composer validate --strict
  • vendor/bin/doctest (4) and vendor/bin/phpunit (4 tests) pass on PHP 8.2

🤖 Generated with Claude Code

Use Mago for formatting (mago fmt), linting and static analysis,
and run all three in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mathroc
mathroc force-pushed the mathroc/replace-phpstan-phpcs-with branch from 72ec463 to 415de0f Compare November 15, 2026 22:00
@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (679dfdc) to head (415de0f).

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #35   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity         5         5           
===========================================
  Files              1         1           
  Lines             12        15    +3     
===========================================
+ Hits              12        15    +3     

☔ View full report in Codecov by Harness.
📢 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.

@mathroc
mathroc merged commit 4c1b69b into main Nov 15, 2026
7 checks passed
@mathroc
mathroc deleted the mathroc/replace-phpstan-phpcs-with branch November 15, 2026 22:24
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.

1 participant