ossobuffo/drupal-phpstan-check

Composer command to run Drupal-specific phpstan check on Drupal 11+, based on mglaman/drupal-check.

Maintainers

Package info

codeberg.org/ossobuffo/drupal-phpstan-check

Issues

Type:composer-plugin

pkg:composer/ossobuffo/drupal-phpstan-check

Transparency log

Statistics

Installs: 9

Dependents: 0

Suggesters: 0

0.1.0 2026-08-27 15:04 UTC

This package is not auto-updated.

Last update: 2026-08-28 17:23:06 UTC


README

This package provides a composer command to run PHPStan against your Drupal codebase, using Drupal-specific rulesets developed by Matt Glaman. This is intended to replace mglaman/drupal-check, which, at the time of this writing, has not had an update in over two years.

Installation

Just install this as you would any other composer package. You probably want to install this as a dev dependency, since it shouldn’t run in production.

composer install --dev ossobuffo/drupal-phpstan-check

Invocation

composer drupal-phpstan:check path/to/file.php

This will invoke PHPStan to run Drupal-specific checks on file.php. You can specify a directory rather than a singular file, and PHPStan will run against all PHP files it finds within that directory. You can also specify multiple files and/or directories, and PHPStan will run against each one.

Options

--format=[raw|table|checkstyle|json|junit] : Affects how output is displayed on the screen. If no --format option is specified, it will default to ‘table’.

--no-progress : Suppresses the progress bar.

GrumPHP Integration

This package has built-in integration for GrumPHP, which was forked from johnatas-x/grumphp-drupal-check. To configure for use with GrumPHP, you will need to edit your root grumphp.yml file. Under the top grumphp key, add the following:

  extensions:
    - ossobuffo\DrupalPhpstanCheck\GrumPhp\ExtensionLoader

Then under the grumphp.tasks key:

    drupal_phpstan_check:
      triggered_by: ['php', 'module', 'inc', 'install', 'theme']

Then whenever you make a git commit, composer drupal-phpstan:check will be run against all of the PHP files in the commit.