Skip to content

Add support for PhpStorms unused public code detection #92

@uehler

Description

@uehler

Since PhpStorm 2019.1 there is a feature, which detects unused public code. But there are some places in the shopware plugin code which are not recognized properly. I am not 100% sure if this is a task for this plugin but I try it anyway:

Controller:

class Shopware_Controllers_Frontend_MyController extends \Enlight_Controller_Action {
// some code
}

The controller class name is marked as unused, the methods are recognized correct. This is only the case for "old" plugin controllers without namespaces.

Subscriber:
If you have a subscriber like

use Enlight_Controller_ActionEventArgs as ActionEventArgs;

public static function getSubscribedEvents(): array
    {
        return [
            'Enlight_Controller_Action_PostDispatchSecure_Frontend_Detail' => 'onPostDispatchSecureFrontendDetail',
        ];
    }

public function onPostDispatchSecureFrontendDetail(ActionEventArgs $args)
    {
       // some code
    }

the onPostDispatchSecureFrontendDetail-Method is marked as used, which is awesome. But if you register the subscriber like

ActionEventArgs::POST_SECURE_EVENT . '_Frontend_Detail' => 'onPostDispatchSecureFrontendDetail',

the method is marked as unused, and PhpStorm doesn't recognize the connection between the method and the subscriber anymore. The connection between those worked until PhpStorm 2018.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions