Closed
Description
Description
The purpose of this inspection is to find places where there is called a method that is not declared in the interface.
For example:
The client has Magento V1 and wants to upgrade it to the V2 (versions are abstract to describe the idea). In Some class there is called a method from the class TestClass. That class implements interface TestInterface. Called method does not exist in the interface. That method is an implementation detail. We should highlight such method calling and describe the issue.
The UML diagram of the example case:
/**
* @api
*/
interface TestInterface {
public function testMethod1();
public function testMethod2();
}
class TestClass implements TestInterface
{
public function testMethod1();
public function testMethod2();
public function method();
}
class SomeClass
{
public function __construct(
TestInterface $object
) {
$object->method(); // Call to non-interface method (that is present in implementation but not in the TestInterface)
}
}
Severity level: ERROR
Key points for implementation
- all PHP inspections should be grouped under the
com.magento.idea.magento2uct.inspections
package. - all PHP inspections must be inherited from the com.jetbrains.php.lang.inspections.PhpInspection
- all inspections should have checking if it should be run with the current tool configurations
- all inspections should cover cases for running from the UCT tool run option and from the PHPStorm itself
- if covered area is not already supported it should be checked and added to the
com.magento.idea.magento2uct.inspections.UctInspectionManager
- each new inspection must be registered in PHPStorm way in the plugin.xml file
- each new inspection must be described in the appropriate html file:
resources/inspectionDescriptions/FileName.html
(to be available in the inspections enable/disable menu) - each new inspection must be registered for running from the UCT tool run option in the
com.magento.idea.magento2uct.packages.SupportedIssue
Approximate time to develop: 5h ~ 6h