laracon-2024-rector-demo

Laracon talk for Amsterdam 2024 - Slides are here ↓

Stars
9

Laracon 2024 Amsterdam Rector demo

A small introduction to Rector 0.19.7 - released during Laracon :)

It requires PHP 7.2 as the lowest version to run. 8.0 and 8.1 to test all the features demoed on the stage.

Usage

Fork this repository, clone locally and then install dependencies:

composer update

List of examples

  1. Upgrade PHP

    • based on composer.json
    • go one version at a time
    • control version in the withPhpSets()
    • promoted properties
    • readonly classes
  2. Type coverage

    • Add return types
    • Add property types based on constructor
    • Show withTypeCoverageLevel() (coming soon)
  3. Dead code removal

    • Remove unused properties
    • Show withDeadCodeLevel() (coming soon)
  4. Create a custom Rector rule

    • Create a rule
    • Hook into a FuncCall node
    • Rename the function
  5. Make use of Laravel extension package

composer require driftingly/rector-laravel --dev
  1. Bonus: Laravel types
    • Clone laravel framework and run type coverage level there :)

Resources

People around Rector & Laravel to follow