# Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 1 passed and exactly 2 expected

**Code:** `ArgumentCountError` · **Category:** PHP · **Seen on:** PHP

A function was called with fewer arguments than it requires.

## Meaning

Since PHP 7.1 missing required arguments throw ArgumentCountError. Common after adding a parameter to a function or constructor without updating every caller — including dependency-injection containers.

## Common causes

- New required parameter added; old callers not updated
- Constructor injection missing a dependency
- Callback invoked with fewer arguments than it declares

## Quick fix

1. Update callers or give the new parameter a default value
2. Register the missing dependency in your DI container
3. Make callback parameters optional

## Detailed fix by platform

### PHP

1. Search the codebase for the function name after changing a signature; PHPStan reports mismatched calls

## How to diagnose

1. **Function** — Name and expected count in the message
2. **Caller** — The stack trace's next frame

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/php/argumentcounterror-too-few-arguments)
