- How do I install Gyro Coding Standard for Laravel projects?
- Add the package to your `composer.json` under `require-dev`: `"gyro/coding-standard": "^1.2"`, then run `composer update`. Configure PHPCS to use the Gyro standard by setting `<config name="standard" value="Gyro"/>` in your `phpcs.xml` or via CLI with `--standard=Gyro`.
- Does Gyro Coding Standard support Laravel-specific rules like Blade templates or Eloquent?
- No, Gyro focuses on general PHP standards (forked from Doctrine/Tideways) and doesn’t include Laravel-specific rules. You’ll need to exclude Blade files or manually configure exceptions for Laravel idioms like protected model attributes.
- Will Gyro Coding Standard work with Laravel 10 and PHP 8.2?
- Gyro supports PHP 8.1+, so it’s compatible with Laravel 10 and PHP 8.2. However, test it thoroughly in your project, as some Tideways-specific rules (e.g., property hooks) might conflict with Laravel’s conventions.
- Can I integrate Gyro into Laravel’s pre-commit hooks (e.g., Husky)?
- Yes, use Husky to run PHPCS with Gyro’s standard as a pre-commit hook. Example: Add a script in `package.json` like `"phpcs": "vendor/bin/phpcs --standard=Gyro src/"` and trigger it via Husky’s `prepare` or `pre-commit` events.
- How do I handle false positives for Laravel-specific patterns (e.g., Route::get callbacks)?
- Exclude problematic files/directories in `phpcs.xml` using `<arg name="exclude" value="app/Http/Controllers/RouteClosures.php"/>`. Alternatively, suppress specific rules with `@codingStandardsIgnoreStart`/`End` annotations in your code.
- Is Gyro Coding Standard actively maintained? Should I use it long-term?
- Gyro has no active community (0 stars/dependents) and is a fork with potential maintenance gaps. Use it as a temporary standard or hybridize it with PSR-12 if you need stricter rules, but monitor for upstream updates from Doctrine/Tideways.
- Can I combine Gyro with PHP-CS-Fixer for auto-fixing?
- No, Gyro is PHPCS-only and doesn’t support auto-fixing like PHP-CS-Fixer. Use PHPCS for linting and PHP-CS-Fixer separately for automated fixes, or consider a hybrid ruleset if Gyro’s rules are too restrictive.
- How do I add Gyro to GitHub Actions for CI checks?
- Add a step to your workflow using the `phpcs` action or a custom script. Example: `run: vendor/bin/phpcs --standard=Gyro --warning-severity=0 src/`. Set `--warning-severity=0` to fail builds on violations.
- Does Gyro Coding Standard conflict with Laravel’s PSR-12 baseline?
- Yes, Gyro enforces stricter rules (e.g., property visibility) that may conflict with Laravel’s PSR-12 conventions. Run a pilot check (`vendor/bin/phpcs --standard=Gyro src/`) to identify conflicts before full adoption.
- What’s the performance impact of running Gyro in CI for large Laravel apps?
- PHPCS adds overhead, especially for large codebases. Mitigate this by caching results with `--cache-file=.phpcs.cache` or running it selectively (e.g., only on changed files). For CI, prioritize critical paths like `app/` and `routes/`.