From 61a3d77637063f0c232254e890c251b2c098346d Mon Sep 17 00:00:00 2001 From: Imani Manyara Date: Fri, 30 Oct 2026 09:19:01 -0400 Subject: [PATCH] chore(phpstan): analyse at level max Raise phpstan.neon.dist from level 0 to max, in icon-sets-bundled's shape. The only finding at max is the two HasIconSetVariants hooks reported as unused, because the trait calls them through static::; they carry one counted, path-scoped ignore with reportUnmatchedIgnoredErrors on, so it fails if either stops occurring. No baseline and no source change. PhpstanLevelTest reads the config and fails when the level is not max or a baseline appears. --- CHANGELOG.md | 1 + phpstan.neon.dist | 13 ++++++++++- tests/Unit/PhpstanLevelTest.php | 39 +++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 tests/Unit/PhpstanLevelTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 431660c..fd2cebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to `ichava/icon-sets-flag` follow [Keep a Changelog](https:/ ### Changed +- **PHPStan analyses at level `max`, up from 0.** `phpstan.neon.dist` now has icon-sets-bundled's shape: one counted, path-scoped ignore for the two `HasIconSetVariants` hooks PHPStan reports as unused because the trait calls them through `static::`, with `reportUnmatchedIgnoredErrors` failing the run if either stops occurring. No baseline, and no source change was needed. `PhpstanLevelTest` reads the config and fails if the level is anything but `max` or a baseline appears. - **`sync-upstream.yml` commits as the github-actions bot's noreply address** instead of a personal GitHub login, matching packs scaffolded since icon-sets-package-scaffolder#60 and icon-sets-sync's default. The personal-contact guard now also reads `.github/` and `.dev/`. - **The package author is Simtabi LLC, not a person.** `composer.json` named a personal maintainer and mailbox as author; it now names `Simtabi LLC` with the role address `ichava@simtabi.com` (no personal contact is published, decided 2026-10-28). `NoPersonalContactTest` reads `composer.json`, `README.md`, `LICENSE`, `docs/` and `src/`, fails on a personal name or address, and fails when it reads fewer files than it did when written. - **`sync-upstream.yml`'s header describes what the workflow runs.** It said the image bundles Python and that a release ships to Packagist. The image is icon-sets-sync's Go binary with git, gh and Node, built from the toolkit's `main`, and a release is the GitHub release that release-please and `release.yml` make; nothing is published to Packagist. Comments only: the workflow runs the same steps. diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c82af78..6290973 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,6 +1,17 @@ parameters: - level: 0 + level: max paths: - src tmpDir: .phpstan.cache treatPhpDocTypesAsCertain: false + ignoreErrors: + # Variant implements HasIconSetVariants' two abstract hooks, which the trait + # calls through static::. PHPStan does not follow that call and reports both + # as unused. Pint's protected_to_private fixer makes them private in a final + # enum, so they cannot be protected either. Two errors, measured 2026-10-30; + # reportUnmatched fails the run if either stops occurring. + - + identifier: method.unused + path: src/Enums/Variant.php + count: 2 + reportUnmatchedIgnoredErrors: true diff --git a/tests/Unit/PhpstanLevelTest.php b/tests/Unit/PhpstanLevelTest.php new file mode 100644 index 0000000..0b2c96f --- /dev/null +++ b/tests/Unit/PhpstanLevelTest.php @@ -0,0 +1,39 @@ +assertFileExists($path); + + $count = preg_match_all('/^\s*level:\s*(\S+)\s*$/m', (string) file_get_contents($path), $matches); + + $this->assertSame(1, $count, 'phpstan.neon.dist must set exactly one level.'); + $this->assertSame('max', $matches[1][0], 'phpstan.neon.dist must analyse at level max.'); +}); + +it('analyses without a baseline', function (): void { + $root = dirname(__DIR__, 2); + + $this->assertFileDoesNotExist($root . '/phpstan-baseline.neon'); + $this->assertStringNotContainsString( + 'baseline', + (string) file_get_contents($root . '/phpstan.neon.dist'), + 'phpstan.neon.dist must not include a baseline.', + ); +});