■P282

────────────────
sail composer require --dev "larastan/larastan:3.9.3"
────────────────

●phpstan.neon
────────────────
includes:
    - vendor/larastan/larastan/extension.neon
    - vendor/nesbot/carbon/extension.neon

parameters:

    paths:
        - app/

    # Level 10 is the highest level
    level: 5

#    ignoreErrors:
#        - '#PHPDoc tag @var#'
#
#    excludePaths:
#        - ./*/*/FileToBeExcluded.php
────────────────

────────────────
sail bin phpstan
────────────────


■P283

●app/Services/TweetService.php
────────────────
use Illuminate\Database\Eloquent\Collection;

…略…

    /**
     * @return Collection<int, Tweet>
     */
    public function getTweets(): Collection
    {
        return Tweet::with('images')->orderBy('created_at', 'DESC')->get();
    }
────────────────

────────────────
sail bin phpstan analyze ./app/Services/TweetService.php
────────────────

────────────────
sail bin phpstan --generate-baseline
────────────────


■P285

●phpstan.neon
────────────────
includes:
    - vendor/larastan/larastan/extension.neon
    - vendor/nesbot/carbon/extension.neon
    - phpstan-baseline.neon

parameters:

    paths:
        - app/

    # Level 10 is the highest level
    level: 6

#    ignoreErrors:
#        - '#PHPDoc tag @var#'
#
#    excludePaths:
#        - ./*/*/FileToBeExcluded.php
────────────────

────────────────
sail bin phpstan
────────────────

