1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

放棄された静的解析ツールLarastanを削除し推奨されているLarastanを導入

Last updated at Posted at 2024-07-23

はじめに

This package is abandoned and no longer maintained. The author suggests using the larastan/larastan package instead.

  • 私はcomposer.jsonの警告にて気がつくことができました。

環境

  • sail v8.3
  • Laravel 11.14.0
  • VSCode

前提条件

  • 拡張機能PHPStanが導入されていること
  • settings.jsonにこちらの設定があること
    "phpstan.enabled": true,
    "phpstan.configFile": "phpstan.neon",
    "phpstan.memoryLimit": "1G",
    "phpstan.checkValidity": false,

手順

(使用していれば)こちらのコマンドでnunomaduro/larastanを削除

sail composer remove nunomaduro/larastan     

こちらのコマンドでlarastan/larastanを導入

sail composer require --dev larastan/larastan

プロジェクトルートのphpstan.neonを編集(無ければ新規作成)

includes:
    - ./vendor/larastan/larastan/extension.neon

parameters:
    level: 5
    paths:
        - app
        - bootstrap
        - config
        - database
        - packages
        - routes
        - tests

VSCode再起動!

除外設定

        if ($request->user()->markEmailAsVerified()) {
            /** @phpstan-ignore-next-line */
            event(new Verified($request->user()));
        }
Artisan::command('inspire', function () {
    /* @phpstan-ignore-next-line */
    $this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote')->hourly();

余談

  • 動いているか不安でしたらこちらのコマンドでも実行可能です。
./vendor/bin/phpstan analyse --memory-limit=1G  

参考にさせていただきました:bow:

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?