---
title: "lint/phpunit/prefer-create-stub-argument"
pagination: false
---

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

<RuleId id="lint/phpunit/prefer-create-stub-argument" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Safe fix. Runs when phpunit is installed.

## What it does

Use createStub() over createMock() when used as argument or array value and does not add any mock requirements

## Configuration

```toml title="pun.toml"
[lint.rules]
"phpunit/prefer-create-stub-argument" = "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

- [`CreateStubOverCreateMockArg`](https://getrector.com/rule-detail/create-stub-over-create-mock-arg-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)
