Skip to content

MIR1106

UndefinedThrowsDocblock

A @throws docblock references an exception class that does not exist or is not imported.

<?php
/**
* @throws UndefinedException
*/
function process(): void {
// No such class exists
}

Ensure the exception class exists and is properly imported:

<?php
use InvalidArgumentException;
/**
* @throws InvalidArgumentException
*/
function process(string $value): void {
if ($value === '') {
throw new InvalidArgumentException('Value cannot be empty');
}
}