---
title: "lint/phpunit/prefer-assert-null-true-false"
pagination: false
---

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

<RuleId id="lint/phpunit/prefer-assert-null-true-false" />

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

## What it does

Turns same bool and null comparisons to their method name alternatives in PHPUnit TestCase

## Configuration

```toml title="pun.toml"
[lint.rules]
"phpunit/prefer-assert-null-true-false" = "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

- [`AssertSameBoolNullToSpecificMethod`](https://getrector.com/rule-detail/assert-same-bool-null-to-specific-method-rector) (rector-phpunit)

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