---
title: "lint/laravel/prefer-container-method-call"
pagination: false
---

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

<RuleId id="lint/laravel/prefer-container-method-call" />

Not in any preset. In Rector's [`rector-laravel/laravel-arrayaccess-to-method-call`](/docs/rules/sets/rector-laravel/laravel-arrayaccess-to-method-call) set. Needs the [`laravel` extension](/docs/configuration/pun-toml#extensions). Unsafe fix: it can change behavior.

## What it does

Change array access on the container to the matching method call, as the contract does not extend ArrayAccess

## Configuration

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

- [`ContainerArrayAccessToMethodCall`](https://getrector.com/rule-detail/container-array-access-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)
