---
title: "lint/phpunit/prefer-dedicated-assertion"
pagination: false
---

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

<RuleId id="lint/phpunit/prefer-dedicated-assertion" />

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

## What it does

Use dedicated PHPUnit assertions such as assertFileExists() instead of assertTrue(file_exists()).

## Configuration

```toml title="pun.toml"
[lint.rules]
"phpunit/prefer-dedicated-assertion" = "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 |
| --- | --- | --- | --- | --- |
| `target` | `enum` | `3.0`, `3.5`, `5.0`, `5.6`, `newest` | `"newest"` | `target` |

## Replaces

- [`php_unit_dedicate_assert`](https://cs.symfony.com/doc/rules/php_unit/php_unit_dedicate_assert.html) (php-cs-fixer, risky)

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