Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

lint/phpunit/prefer-expect-exception

In the lint-strict preset. In Rector’s rector-phpunit/composer-based set. Needs the phpunit extension. Unsafe fix: it can change behavior.

What it does

Replace setExpectedException*() with expectException*().

Configuration

[lint.rules]
"phpunit/prefer-expect-exception" = "error"

To skip it in some files, add an override or a @pun-ignore-file comment.

Options

Name Type Allowed values Default Upstream name
target enum 5.2, 5.6, 8.4, newest "newest" target

Replaces

More lint/phpunit rules · Edit this page

Last updated on

Was this page helpful?