---
title: "lint/laravel/prefer-constructor-injection"
pagination: false
---

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

<RuleId id="lint/laravel/prefer-constructor-injection" />

Not in any set. Unsafe fix: it can change behaviour. Runs when laravel is installed.

## What it does

Move help facade-like function calls to constructor injection

## Configuration

```toml title="pun.toml"
[lint.rules]
"laravel/prefer-constructor-injection" = "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

- [`ArgumentFuncCallToMethodCall`](https://getrector.com/rule-detail/argument-func-call-to-method-call-rector) (rector-laravel)

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