Skip to content

Add : void return type to test setUp() methods - #35

Merged
mikelittle merged 1 commit into
masterfrom
fix-phpunit-setup-void-return
May 22, 2026
Merged

mikelittle merged 1 commit into
masterfrom
fix-phpunit-setup-void-return

Conversation

@mikelittle

Copy link
Copy Markdown
Contributor

PHPUnit 8+ and PHPUnitPolyfills declare TestCase::setUp(): void; subclass overrides without the matching return type fatal under LSP.

Currently breaks nightly cross-version tests in humanmade/product-dev with:

```
Fatal error: Declaration of Altis\Security\Browser\Test_Content_Security_Policies::setUp()
must be compatible with Yoast\PHPUnitPolyfills\TestCases\TestCase::setUp(): void
```

Touches tests/class-test-content-security-policies.php and tests/class-test-rest-allow-origins.php. PHP 7.1+ compatible (matches module floor).

Required by PHPUnit 8+ and PHPUnit polyfills' LSP check. Nightly currently
fails on this module with a setUp() signature mismatch. PHP 7.1+ compatible.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@ferschubert-hm ferschubert-hm left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice catch, LGTM, approving.

@mikelittle
mikelittle merged commit 82f1080 into master May 22, 2026
0 of 2 checks passed
@mikelittle
mikelittle deleted the fix-phpunit-setup-void-return branch May 22, 2026 16:25
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