- Can I use ssch/typo3-rector to modernize Laravel PHP code?
- Technically yes, but with severe limitations. The package is designed for TYPO3’s TypoScript, extbase, and GeneralUtility patterns, which are incompatible with Laravel’s Eloquent, DI container, and routing. You’d need to manually disable all TYPO3-specific rules (e.g., TYPO310, TYPO311) and keep only generic PHP/Rector rules like CodeQuality or TypeDeclaration.
- Will this package break my Laravel application if I run it?
- Yes, unless you prune TYPO3-specific rules. Rules like `GeneralUtilityMakeInstanceToConstructorPropertyRector` assume TYPO3’s singleton pattern and will fail or produce errors in Laravel. Always run a dry-run first (`vendor/bin/rector process --dry-run`) and review the diffs before applying changes.
- How do I install ssch/typo3-rector in a Laravel project?
- Run `composer require --dev ssch/typo3-rector` to install it as a dev dependency. Then generate a config with `vendor/bin/typo3-init`, but immediately disable all TYPO3-specific rulesets in `rector.php` to avoid conflicts. Laravel projects typically use PHP-CS-Fixer, so align your toolchain accordingly.
- Does this package support Laravel’s PHP 8.x features?
- The package itself supports PHP 7.4–8.x, but its TYPO3-specific rules are irrelevant to Laravel. If you’re using Laravel’s modern PHP features (e.g., typed properties, attributes), focus on generic Rector rules like `TypeDeclaration` or `Strict` instead of TYPO3-centric ones.
- Are there Laravel-native alternatives to this package?
- For Laravel, consider `roave/security-advisories` for dependency updates or `phpstan/extension-installer` for static analysis. If you need PHP refactoring, use `rector/rector` with Laravel-specific rulesets (e.g., `laravel-rector`) instead of TYPO3-focused ones.
- How do I disable TYPO3-specific rules in the rector.php config?
- Explicitly set TYPO3 rule categories to empty arrays. For example, add `TYPO310::class => [], TYPO311::class => []` to your `rector.php` config. Keep only generic rules like `CodeQuality` or `PHPUnit` that align with Laravel’s coding standards.
- Can I integrate this into Laravel’s CI/CD pipeline?
- Only if you’ve pruned TYPO3 rules and confirmed no false positives. Even then, the package adds ~60MB of dependencies (rector/rector + nikic/php-parser) for zero Laravel-specific benefit. For CI, use lightweight tools like `pestphp/pest` or `laravel-pint` instead.
- Will this package help with legacy Laravel code using GeneralUtility patterns?
- No. GeneralUtility is a TYPO3-specific singleton class for dependency injection, which Laravel replaces with its own DI container. Rules targeting `GeneralUtility` will fail or produce incorrect refactors. Use Laravel’s built-in service container or packages like `spatie/laravel-ignition` for debugging instead.
- Does this package work with Laravel’s Eloquent ORM or Blade templates?
- No. The package’s rules focus on TYPO3’s extbase (a different ORM) and TypoScript/Fluid templates, which are incompatible with Laravel’s Eloquent and Blade. Avoid running it on files like `app/Models/` or `resources/views/`—it will generate errors or irrelevant changes.
- How do I test if this package is safe for my Laravel project?
- Run `vendor/bin/rector process --dry-run` and inspect the output for TYPO3-specific changes (e.g., `ext_emconf.php`, `ExtensionUtility`). If you see unrelated files or errors, disable all TYPO3 rulesets. For a true Laravel-safe test, use a package like `rector/rector` with a minimal config targeting only your legacy PHP syntax.