Skip to content

Fix PHPStan errors and run phpcs and PHPStan in CI - #130

Merged
conatus merged 1 commit into
masterfrom
phpstan-ci
Oct 17, 2026
Merged

conatus merged 1 commit into
masterfrom
phpstan-ci

Conversation

@conatus

@conatus conatus commented Oct 17, 2026

Copy link
Copy Markdown
Member

What

  • Fixes the PHPStan errors on master (3 reported, all in MailchimpService). Guzzle 7's ClientException::getResponse() is declared to always return a response, never null, and the installed 7.15.5 confirms it. So the $e->getResponse() ? … : $e->getMessage() fallbacks, and the $response && check, were dead code. Two copies were already being hidden by an entry in phpstan-baseline.neon. All three are removed, along with that baseline entry; nothing new is added to the baseline. Behaviour is unchanged: the fallback branch could never run.
  • Adds a PHP lint job to php-tests.yml that runs the repo's existing composer lint, i.e. phpcs and then PHPStan (level 5). It runs on pull requests and pushes to master. The release workflow reuses this file, so lint errors also block a release. phpcs is configured to fail only on errors, not warnings (ignore_warnings_on_exit), and has no errors today.
  • Readme: documents composer lint, and says to fix new PHPStan errors rather than add them to the baseline.

Checks

  • composer lint: passes on a clean checkout of this branch. Putting the dead fallback back makes it fail ("Ternary operator condition is always true", exit 1).
  • PHPUnit: OK (205 tests, 333 assertions).

Companion PR for frontend formatting: #129. The two may conflict in the readme's Testing section; whichever merges second will need a quick merge.


Generated by Claude Code

- MailchimpService: Guzzle 7's ClientException::getResponse() never
  returns null, so the `$response ? ... : $e->getMessage()` fallbacks
  were dead code. PHPStan reported the third copy as an error and the
  other two were hidden in the baseline. Remove all three and the
  baseline entry.
- Add a PHP lint job to php-tests.yml running `composer lint` (phpcs,
  then PHPStan), so pull requests, pushes to master and releases fail on
  new errors.
- Document `composer lint` in the readme.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BL2bFrTk84JMy3CPAsCTV9

@conatus conatus left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems good, but I am concerned that if this code was added, then it was needed, so double check in, writing some scrap code to make sure it is right if you need to.

Comment thread packages/join-block/src/Services/MailchimpService.php
@conatus
conatus merged commit 720c67b into master Oct 17, 2026
4 checks passed
@conatus
conatus deleted the phpstan-ci branch October 17, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants