---
title: "lint/phpunit/require-assertion-style"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/phpunit/require-assertion-style" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Unsafe fix: it can change behaviour. Runs when phpunit is installed.

## What it does

Calls to `PHPUnit\Framework\TestCase` static methods (like assertions) must all be of the same type, either `$this->`, `self::` or `static::`.

## Configuration

```toml title="pun.toml"
[lint.rules]
"phpunit/require-assertion-style" = "error"
```

To skip it in some files, add an [override](/docs/configuration/pun-toml#lint) or a [`@pun-ignore-file`](/docs/configuration/ignore-comments) comment.

## Options

| Name | Type | Allowed values | Default | Upstream name |
| --- | --- | --- | --- | --- |
| `call-type` | `enum` | `this`, `self`, `static` | `"static"` | `call_type` |
| `methods` | `map` | Any | `{  }` | `methods` |
| `target` | `enum` | `10.0`, `11.0`, `newest` | `"10.0"` | `target` |

## Replaces

- [`php_unit_test_case_static_method_calls`](https://cs.symfony.com/doc/rules/php_unit/php_unit_test_case_static_method_calls.html) (php-cs-fixer, risky)
- [`assertion-style`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#assertion-style) (mago-linter)

[More lint/phpunit rules](/docs/rules/lint/phpunit) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
