povils/phpmnd
PHPMND detects magic numbers in PHP code to improve readability and maintainability. Flags numeric literals that should be constants (0 and 1 ignored by default). Install via Composer and run vendor/bin/phpmnd locally or globally in CI and dev workflows.
Purpose Alignment (Updated):
phpmnd v3.6.1 retains its core focus on static analysis of magic numbers in PHP/Laravel, but now explicitly supports Symfony 8 and PHP 8.5, broadening its relevance for modern Laravel ecosystems (especially those integrating Symfony components like HTTP client, process, or security bundles).symfony/http-client, symfony/process) can now leverage phpmnd without compatibility concerns.Laravel-Specific Use Cases (Unchanged):
laravel/symfony-bridge), phpmnd can now scan Symfony-integrated code uniformly.Non-Fit Areas (Unchanged):
Tooling Compatibility (Expanded):
symfony/mailer, symfony/lock).phpunit/php-timer 9 support ensures compatibility with modern testing stacks (e.g., Laravel’s PHPUnit 10+).Output Formats (Unchanged):
Customization (Unchanged):
.phpmnd.yml configuration still applies; no new syntax or breaking changes.False Positives/Negatives (New Consideration):
class Foo { public const int BAR = 42; }) may trigger false positives if treated as "magic numbers." Mitigation: Test with .phpmnd.yml to exclude such patterns or update rules.symfony/http-foundation).Performance Overhead (Unchanged):
Dependency Conflicts (Unchanged):
app/Symfony/) or focus only on core Laravel code?phpmnd for PHP 8.5 features (e.g., typed constants)?vendor/symfony/) that should be whitelisted?phpunit/php-timer 9 support, should we integrate phpmnd into Laravel’s test suite scans?PHP/Laravel Ecosystem (Expanded):
symfony/mailer for email services).Complementary Tools (Unchanged):
Non-Fit (Unchanged):
Pilot Phase (Updated):
composer require --dev povils/phpmnd:^3.6
.phpmnd.yml to include/exclude Symfony paths (e.g., app/Symfony/).CI/CD Integration (Updated):
- name: PHP Magic Number Detection (PHP 8.5)
run: vendor/bin/phpmnd --config=.phpmnd.yml --format=github .
env:
PHP_VERSION: 8.5
env:
PHP_VERSION: 8.2
IDE Integration (Unchanged):
phpunit/php-timer 9 ensures no conflicts with Laravel’s testing stack.phpmnd on Symfony-integrated code before Laravel core to avoid false positives..phpmnd.yml and review after major updates.phpmnd updates.^3.6 for stability.--dry-run to test configurations with PHP 8.5 codebases.| Failure Mode | Impact | Recovery |
|---|---|---|
| Symfony-Specific False Positives | Blocks valid Symfony literals. | Whitelist Symfony paths in .phpmnd.yml. |
| PHP 8.5 Typed Constant Issues | Developers ignore tool due to noise. | Refine rules to exclude typed constants. |
| CI Fails on PHP 8.5 | Builds break if not configured. | Update CI to use correct PHP version. |
How can I help you explore Laravel packages today?