PHPStan: automate `in_array(strict: TRUE)` etc
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3567961. -->
Reported by: [wim leers](https://www.drupal.org/user/99777)
Related to !478
>>>
<h3 id="overview">Overview</h3>
<p><a href="https://github.com/phpstan/phpstan-strict-rules">https://github.com/phpstan/phpstan-strict-rules</a> offers a number of interesting additional rules that PHPStan level 8 does not complain about, but which we in the Drupal community (or in Canvas) do keep pointing out in reviews.</p>
<p>This is avoidable noise in the review process: automated feedback increases velocity.</p>
<ol>
<li>Drupal core convention, but not yet automated: <code>strictFunctionCalls</code></li>
<li>Canvas (I'm often asking for methods to be <code>static</code>, so we should call it in that way too to make it obvious throughout): <code>dynamicCallOnStaticMethod</code> </li>
<li>I wish we'd been checking this: <code>switchConditionsMatchingType</code>, <code>disallowedEmpty</code>, and more! → that'd be for follow-ups</li>
</ol>
<h3 id="proposed-resolution">Proposed resolution</h3>
<ol>
<li>Adopt <code>phpstan/phpstan-strict-rules</code></li>
<li>Enable only <code>strictFunctionCalls</code> <del>and <code>dynamicCallOnStaticMethod</code></del> here (EDIT: this one alone triggers more strictness checks that already make this quite big, see #3)</li>
<li>Create novice follow-ups for any others we may want to adopt</li>
</ol>
<h3 id="ui-changes">User interface changes</h3>
<p>None.</p>
issue