Larastan v0.5 is out!

Larastan v0.5 is out!

Today, @can__vural, @szepeviktor and I are proud to announce the release of Larastan v0.5.

⚗️ Adds static analysis to Laravel improving developer productivity and code quality - nunomaduro/larastan

You don't know what Larastan is? It's a console tool that adds static analysis to Laravel improving developer productivity and code quality. Static analysis is the art of trying to spot problems in your source code before it’s run.

As example, if you try to assign a string instead of a array on the User::$guard model you will get this:

class User extends Model
    protected $guarded = ''; // Error

This new version includes several bug fixes, adds support to Laravel 7, and is built on top of PHPStan 0.12. Note that, PHPStan 0.12 is a massive release that has been in the works for the past six months by the PHPStan team and introduces all the features detailed here:

Note: Are you using Larastan 0.4? Here is the upgrade guide:

Getting Started in 3 Steps


1: First, you may use Composer to install Larastan as a development dependency into your Laravel project:

composer require --dev nunomaduro/larastan
Using Larastan for analyzing Laravel packages? You may need to install orchestra/testbench.

2: Then, create a phpstan.neon or phpstan.neon.dist file in the root of your application. It might look like this:

    - ./vendor/nunomaduro/larastan/extension.neon


        - app

    # The level 7 is the highest level
    level: 5

        - '#Unsafe usage of new static#'

        - ./*/*/FileToBeExcluded.php

    checkMissingIterableValueType: false

For all available options, please take a look at the PHPStan documentation:

3: Finally, you may start analyzing your code using the PHPStan console command:

./vendor/bin/phpstan analyse

Thanks, we hope you enjoy this new release! 🎉

Show Comments