---
title: "lint/phpunit/prefer-self-call"
pagination: false
---

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

<RuleId id="lint/phpunit/prefer-self-call" />

Not in any preset. Needs the [`phpunit` extension](/docs/configuration/pun-toml#extensions). Safe fix.

## What it does

Changes PHPUnit calls from $this->assert*() to self::assert*()

## Configuration

```toml title="pun.toml"
[lint.rules]
"phpunit/prefer-self-call" = "error"
```

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

## Replaces

- [`PreferPHPUnitSelfCall`](https://getrector.com/rule-detail/prefer-p-h-p-unit-self-call-rector) (rector-phpunit)

## Linked rules

- Conflicts with [`lint/phpunit/prefer-this-call`](/docs/rules/lint/phpunit/prefer-this-call). You cannot enable both.

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