phpstan-drupal, drupal-check, drupal-rector, upgrade_status — OH MY 🚀

But, first… did you know?

A tool for a specific job

  • Should I run drupal-check or Upgrade Status?
  • Why do I need Upgrade Status if I have drupal-rector?
  • Is drupal-check required, or can I only use PHPStan?
  • Do I need all of these tools? What can I run in my continuous integration builds?

PHPStan & phpstan-drupal

composer require  --dev phpstan/phpstan \
phpstan/extension-installer \
mglaman/phpstan-drupal \
phpstan/phpstan-deprecation-rules
parameters:
level: 5
php vendor/bin/phpstan.phar analyze web/modules/custom

drupal-check (a PHPStan wrapper)

composer require --dev mglaman/drupal-check

The Upgrade Status module

$output = [];
$error_filename = $this->temporaryDirectory . '/phpstan_error_output';
$command = $this->binPath . '/phpstan analyse --memory-limit=-1 --error-format=json -c ' . $this->phpstanNeonPath . ' ' . $project_dir . ' 2> ' . $error_filename;
exec($command, $output);
php vendor/bin/drush upgrade_status:analyze --all --ignore-uninstalled
phpcs:
docker:
- image: circleci/php:7.3-cli
steps:
- setup-build
- install-composer
- run:
name: phpcs
command: ./bin/phpcs web/modules/custom
phpstan:
docker:
- image: circleci/php:7.3-cli
steps:
- setup-build
- install-composer
- run:
name: phpstan
command: ./bin/phpstan analyse web/modules/custom --debug
upgrade_status:
docker:
- image: circleci/php:7.3-cli
steps:
- setup-build
- install-composer
- run:
name: Install backend
command: ./bin/drush -y site-install --account-pass=admin
- run:
name: upgrade_status
command: ./bin/drush upgrade_status:analyze --all --ignore-uninstalled

Rector / drupal-rector

composer require --dev palantirnet/drupal-rector
cp vendor/palantirnet/drupal-rector/rector.php .
php vendor/bin/rector process web/modules/custom

What is next with these tools, are we done?

PHP 8 readiness

Drupal 10

Contributions & end-user testing

Funding.

Thanks for reading!

--

--

--

Open source developer, working with Drupal and building Drupal Commerce.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

RFPs and the Problem with Web Project Proposals

NFDI4Ing — National Research Data Infrastructure for the Engineering Sciences

Does your Salesforce team have low productivity? Switch to Smart Work with BOFC

Pointer — Declaration, Initialization, Arithmetic, and Comparison

4 Recommendations of Arduino Types for Beginners

Uno R3 DIP Arduino

Apps and Containers and Clusters, Oh, My!

Day — 13: Components

Illustration of design components

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matt Glaman

Matt Glaman

Open source developer, working with Drupal and building Drupal Commerce.

More from Medium

Hacking Wordle through automation and cryptanalysis

𝘾𝙖𝙣 𝙬𝙚 𝙧𝙖𝙞𝙨𝙚 𝙩𝙝𝙚 𝙗𝙖𝙧?

A Review of The Outer Worlds: A Parrot wearing the skin of Fallout: New Vegas

What is Cloudflare?