DX: Introduce `composer run lint` that runs PHPCS + PHPStan (sibling to `npm run lint`)
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3591245. --> Reported by: [wim leers](https://www.drupal.org/user/99777) Related to !1138 >>> <h3 id="overview">Overview</h3> <ol> <li><strong>One command (<code>npm run lint</code>) does <strong>six things</strong> for Canvas: it lints TS, lints JS, lints CSS, lints YAML, validates OpenAPI spec, checks spelling. <li>&hellip; but for the PHP side, one has to manually run <strong>two commands</strong>: <code>composer run phpcs</code> + <code>composer run phpstan</code> (that each do one thing) </li></strong></li></ol> <p>Everybody frequently working on Canvas knows this now. CI runs it. But &hellip; it still is a barrier to entry.</p> <h3 id="proposed-resolution">Proposed resolution</h3> <p><strong>Only require running <code>composer run lint</code> + <code>npm run lint</code>.</strong></p> <ol> <li>Introduce <code>composer run lint</code> that runs both. </li><li>Add <a href="https://getcomposer.org/doc/articles/scripts.md#custom-descriptions">descriptions</a> so that <code>composer run --list</code> and <code>composer run</code> provide a helpful description. </li><li>Rename <code>composer run phpstan</code> to <code>composer run lint:phpstan</code> etc, for consistency with how the node/NPM scripts are organized &mdash;&nbsp;but don't break existing workflows by adding aliases (EDIT: not <a href="https://getcomposer.org/doc/articles/scripts.md#custom-aliases"><code>script-aliases</code></a>, those are apparently to be able to do <code>composer X</code>, not for doing <code>composer run X</code> &mdash; docs are misleading &#128556;). </li><li>Same for <code>composer run phpcbf</code>: rename to <code>composer run fix</code>. </li><li>But pave the path for more "fixers": PHPStan is working on this, and we may soon adopt Rector: <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3589155" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3589155</a></span>, so make <code>fix</code> call <code>fix:phpcbf</code>, which allows it to also call <code>fix:rector</code> in the future. </li></ol> <p>Resulting DX:<br> <img src="https://www.drupal.org/files/issues/2026-05-21/Screenshot%202026-05-21%20at%2010.34.10%E2%80%AFAM.png"><br> <img src="https://www.drupal.org/files/issues/2026-05-21/Screenshot%202026-05-21%20at%2010.34.29%E2%80%AFAM.png"></p> <h3 id="ui-changes">User interface changes</h3> <p>None.</p>
issue