---
title: "lint/classes/no-explicit-constructor-call"
pagination: false
---

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

<RuleId id="lint/classes/no-explicit-constructor-call" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Report only. Intent: suspicious. Upstream gates: `strictRules.illegalConstructorMethodCall`.

## What it does

Disallows calling `__construct()` on an existing object outside a constructor.

## Configuration

```toml title="pun.toml"
[lint.rules]
"classes/no-explicit-constructor-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

- [`IllegalConstructorMethodCallRule`](https://github.com/phpstan/phpstan-strict-rules#readme) (phpstan-classes)
- [`constructor.call`](https://phpstan.org/error-identifiers/constructor.call) (phpstan-strict-rules)

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