---
title: "lint/laravel/prefer-closure-only-bind"
pagination: false
---

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

<RuleId id="lint/laravel/prefer-closure-only-bind" />

Not in any set. Safe fix. Runs when laravel is installed.

## What it does

Drop the specified abstract class from the bind method and replace it with a closure that returns the abstract class.

## Configuration

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

- [`ContainerBindConcreteWithClosureOnly`](https://getrector.com/rule-detail/container-bind-concrete-with-closure-only-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)
