phpstan-magento
phpstan-magento copied to clipboard
Feature Request: Add rule for "resource models should be used directly"
trafficstars
Add a PHPStan rule to detect calls for getResource() in Model classes. Calling getResource() is marked as deprecated since it's not considered a good practice any more, see this thread on StackOverflow.
In the Magento source code, you'll find a few deprecated notices like "@deprecated 102.0.6 because resource models should be used directly". Those could be used to find out how to properly implement this rule.