---
title: "lint/phpunit/prefer-with-is-instance-of"
pagination: false
---

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

<RuleId id="lint/phpunit/prefer-with-is-instance-of" />

In the [`lint-recommended`](/docs/rules/presets/lint-recommended) preset and every stricter one. In Rector's [`rector-phpunit/phpunit-code-quality`](/docs/rules/sets/rector-phpunit/phpunit-code-quality) set. Needs the [`phpunit` extension](/docs/configuration/pun-toml#extensions). Safe fix.

## What it does

Replaces use of with, callable and instance assert to simple isInstanceOf() method

## Configuration

```toml title="pun.toml"
[lint.rules]
"phpunit/prefer-with-is-instance-of" = "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

- [`SimplerWithIsInstanceOf`](https://getrector.com/rule-detail/simpler-with-is-instance-of-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)
