search
LoginSignup
2

posted at

updated at

Laravel Larastan のインストール

Larastanの解説をこの記事に移しました。

Larastan

Larastanは静的解析ツールPHPStanのLaravel用のラッパーライブラリです。

環境

  • PHP: 8.1.5
  • Laravel: 9.12.2
  • Larastan: 2.1.6

インストール

$ composer require nunomaduro/larastan --dev

設定ファイルを作成します。

$ touch phpstan.neon
phpstan.neon
includes:
  - ./vendor/nunomaduro/larastan/extension.neon

parameters:
  paths:
    - app
  level: 6

Larastan 実行

$ ./vendor/bin/phpstan analyse

GitHub Actions

.github/workflows/larastan.yml
name: Larastan

on:
  - pull_request

jobs:
  larastan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.1

      - name: Install Dependencies
        working-directory: ./src
        run: |
          composer install -q --no-ansi --no-interaction --no-scripts --prefer-dist

      - name: PHPStan Analyse
        working-directory: ./src
        run: ./vendor/bin/phpstan analyse

参考

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
What you can do with signing up
2