Inspectopedia Help

ObjectShape can be added

Reports public properties of an object with specified types. Suggests specifying the shape of the returned object via the #[ObjectShape] attribute or an object shape in the PHPDoc comment.

Example:

$a = new stdClass(); $a->name = "name"; $a->age = 2;

After the quick-fix is applied:

/** @var $a object{name: string, age: int} */ $a = new stdClass(); $a->name = "name"; $a->age = 2;

Inspection Details

Available in:

PhpStorm 2023.3, Qodana for PHP 2023.3

Plugin:

PHP, 233.SNAPSHOT

Last modified: 13 July 2023