magento_find_dataobject_issues
Identify setX(null) anti-pattern in Magento DataObject where hasX() returns true but getX() is null. Correct with unsetData().
Instructions
Detect DataObject::setX(null) anti-pattern calls. In Magento, classes extending DataObject store values in a _data array. Calling setX(null) stores the key with a null value — so hasX()/hasData('x') (which use array_key_exists) return true even though the value is null. Downstream guard conditions silently pass, but getX() returns null. The correct way to clear is unsetData('x'). Use this during field-lifecycle audits or when debugging "value persists but shouldn't" bugs. ⚡ For multi-query workflows use magento_batch.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Subdirectory to search (relative to MAGENTO_ROOT). Default: entire codebase. Example: "vendor/acme/" | |
| maxResults | No | Maximum matches to return (default: 100, max: 500) |