WordPress / twentytwentytwo

Twenty Twenty-Two, the default WordPress theme that will launch with WordPress 5.9.
406 stars 91 forks source link

Add static analysis to GitHub Actions workflows #305

Closed schlessera closed 2 years ago

schlessera commented 2 years ago

Description

The static analyzer PHPStan was already being pulled into the project as a Composer dependency, but it was not being used.

This PR configures PHPStan to work correctly and fixes the few issues it found.

Screenshots

Static analysis running locally with detected issues: _ 2021-12-16 at 9 06 00 AM entytwentytwo

Static analysis running within GitHub Actions: Fix static analysis issues · WordPress_twentytwentytwo@3d66ce7 - Google Chr  2021-12-16 at 9 05 11 AM

Testing Instructions

  1. Run composer analyze to manually trigger the PHPStan analysis.