- Can I use typo3/coding-standards in a Laravel project that integrates with TYPO3 extensions?
- Yes, this package is designed for PHP projects, including Laravel applications that interact with TYPO3. It enforces TYPO3-specific coding conventions (like naming, PHPDoc, and formatting) while working alongside Laravel’s PSR standards. Just configure PHPCS to include both Laravel and TYPO3 rulesets in your `phpcs.xml`.
- What Laravel versions or PHP versions does typo3/coding-standards support?
- The package itself doesn’t target Laravel directly but requires PHP 7.4+ and PHPCS 3.7+. For Laravel projects, ensure your PHP version aligns with TYPO3’s LTS support (e.g., TYPO3 11.x/12.x typically require PHP 8.1+). Test compatibility by running `vendor/bin/phpcs` against your codebase after installation.
- How do I integrate typo3/coding-standards into Laravel’s CI pipeline (e.g., GitHub Actions)?
- Add `typo3/coding-standards` to your `composer.json`, then configure a CI step to run PHPCS. Example GitHub Actions snippet: `php vendor/bin/phpcs --standard=vendor/typo3/coding-standards src/ tests/`. Use `phpcbf` for auto-fixing if needed. Ensure your `phpcs.xml` points to the correct ruleset path.
- Will this package conflict with Laravel’s built-in PHPStan or Psalm static analysis tools?
- No direct conflicts, but PHPCS focuses on coding style while PHPStan/Psalm handle type safety. Run both tools in CI for comprehensive checks. Configure PHPCS to exclude Laravel-specific files (e.g., `vendor/`, `bootstrap/`) if they don’t need TYPO3-style validation.
- Does typo3/coding-standards support custom TYPO3 extension conventions beyond the default rules?
- The package provides TYPO3’s official standards, but you can extend it by creating a custom `phpcs.xml` that overrides or adds rules. For extension-specific needs, use PHPCS’s `exclude-patterns` or `custom-rules` directives. Document deviations in your project’s `CONTRIBUTING.md`.
- How do I configure typo3/coding-standards to work with Laravel’s IDE helper generation (e.g., barryvdh/laravel-ide-helper)?
- Exclude IDE-generated files (e.g., `app/Helpers/`, `bootstrap/cache/`) from PHPCS checks in your `phpcs.xml` using `<exclude-pattern>*.php</exclude-pattern>`. Focus validation on custom extension code and TYPO3 integration layers. Run PHPCS only on `src/`, `app/Extensions/`, or similar paths.
- Are there alternatives to typo3/coding-standards for Laravel-TYPO3 projects?
- For Laravel-specific linting, use `php-cs-fixer` with PSR-12 rules. For TYPO3, this package is the official choice, but you could combine it with `dealerdirect/phpcodesniffer-composer-installer` to auto-load rulesets. Avoid mixing multiple PHPCS standards unless you explicitly configure rule precedence in `phpcs.xml`.
- How often is typo3/coding-standards updated, and how do I stay informed about breaking changes?
- Updates align with TYPO3’s release cycle (e.g., major versions for TYPO3 11.x/12.x). Monitor the [TYPO3 Coding Guidelines](https://docs.typo3.org/) and check the package’s GitHub repo (if available) for changelogs. Enable Composer’s `update-notifier` or set up a GitHub watch for the package.
- Can I use typo3/coding-standards locally with Laravel Sail or Dockerized environments?
- Yes, install the package globally in your Docker container (`RUN composer require typo3/coding-standards`) or add it to your `docker-compose.yml` services. Run PHPCS via `php vendor/bin/phpcs` in your container’s working directory. Ensure your Dockerfile includes PHP 7.4+ and PHPCS 3.7+.
- What are common PHPCS errors I’ll encounter in Laravel projects using this package, and how do I fix them?
- Typical issues include TYPO3-specific PHPDoc formatting (e.g., `@var` vs. `@param`), class naming (e.g., `PascalCase` for extensions), or line-length limits. Use `phpcbf` to auto-fix simple errors, then manually adjust complex cases. For Laravel-TYPO3 hybrids, prioritize TYPO3 rules in extension directories and Laravel rules in core app files.