---
title: "lint/types/prefer-generic-collection-phpdoc"
pagination: false
---

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

<RuleId id="lint/types/prefer-generic-collection-phpdoc" />

In the [`types`](/docs/rules/sets/types) set. Unsafe fix: it can change behaviour.

## What it does

Change @return "Type[]&#124;ArrayCollection" union docblock to a generic "ArrayCollection&lt;int, Type>"

## Configuration

```toml title="pun.toml"
[lint.rules]
"types/prefer-generic-collection-phpdoc" = "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

- [`NarrowArrayCollectionUnionReturnDocblock`](https://getrector.com/rule-detail/narrow-array-collection-union-return-docblock-rector) (rector)

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