vaimo/composer-patches

View on GitHub
src/Plugin.php

Summary

Maintainability
A
1 hr
Test Coverage

Method postInstall has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function postInstall(\Composer\Script\Event $event)
    {
        if (!$this->bootstrap) {
            $this->lockSanitizer->sanitize();

Severity: Minor
Found in src/Plugin.php - About 1 hr to fix

    Missing class import via use statement (line '103', column '29').
    Open

            $runtimeUtils = new \Vaimo\ComposerPatches\Utils\RuntimeUtils();
    Severity: Minor
    Found in src/Plugin.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '50', column '31').
    Open

            $contextFactory = new \Vaimo\ComposerPatches\Factories\ComposerContextFactory($composer);
    Severity: Minor
    Found in src/Plugin.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '53', column '30').
    Open

            $configFactory = new \Vaimo\ComposerPatches\Factories\ConfigFactory($composerContext);
    Severity: Minor
    Found in src/Plugin.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '55', column '40').
    Open

            $this->operationAnalyser = new \Vaimo\ComposerPatches\Package\OperationAnalyser();
    Severity: Minor
    Found in src/Plugin.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '58', column '40').
    Open

            $this->bootstrapStrategy = new \Vaimo\ComposerPatches\Strategies\BootstrapStrategy($composerContext);
    Severity: Minor
    Found in src/Plugin.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '104', column '29').
    Open

            $compExecutor = new \Vaimo\ComposerPatches\Compatibility\Executor();
    Severity: Minor
    Found in src/Plugin.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '57', column '36').
    Open

            $this->lockSanitizer = new \Vaimo\ComposerPatches\Repository\Lock\Sanitizer($appIO);
    Severity: Minor
    Found in src/Plugin.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '56', column '39').
    Open

            $this->bootstrapFactory = new \Vaimo\ComposerPatches\Factories\BootstrapFactory($composerContext, $appIO);
    Severity: Minor
    Found in src/Plugin.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '62', column '32').
    Open

            $pluginBootstrap = new \Vaimo\ComposerPatches\Composer\Plugin\Bootstrap($composer, $composerContext);
    Severity: Minor
    Found in src/Plugin.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Rename "$bootstrap" which has the same name as the field declared at line 36.
    Open

            $bootstrap = $this->bootstrap;
    Severity: Major
    Found in src/Plugin.php by sonar-php

    Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

    Noncompliant Code Example

    class Foo {
      public $myField;
    
      public function doSomething() {
        $myField = 0;
        ...
      }
    }
    

    See

    Rename "$lockSanitizer" which has the same name as the field declared at line 41.
    Open

            $lockSanitizer = $this->lockSanitizer;
    Severity: Major
    Found in src/Plugin.php by sonar-php

    Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

    Noncompliant Code Example

    class Foo {
      public $myField;
    
      public function doSomething() {
        $myField = 0;
        ...
      }
    }
    

    See

    Class implements undeclared interface \Composer\EventDispatcher\EventSubscriberInterface
    Open

    class Plugin implements
    Severity: Critical
    Found in src/Plugin.php by phan

    Call to method isDevMode from undeclared class \Composer\Script\Event (Did you mean class \Vaimo\ComposerPatches\Patch\Event)
    Open

                    return $bootstrap->applyPatches($event->isDevMode());
    Severity: Critical
    Found in src/Plugin.php by phan

    Parameter $appIO has undeclared type \Composer\IO\IOInterface
    Open

        public function deactivate(\Composer\Composer $composer, \Composer\IO\IOInterface $appIO)
    Severity: Minor
    Found in src/Plugin.php by phan

    Call to method __construct from undeclared class \Composer\EventDispatcher\ScriptExecutionException
    Open

            throw new ScriptExecutionException('Execution halted due to composer-patch failure', 1);
    Severity: Critical
    Found in src/Plugin.php by phan

    Reference to constant PRE_AUTOLOAD_DUMP from undeclared class \Composer\Script\ScriptEvents
    Open

                \Composer\Script\ScriptEvents::PRE_AUTOLOAD_DUMP => 'postInstall',
    Severity: Critical
    Found in src/Plugin.php by phan

    Class implements undeclared interface \Composer\Plugin\Capable
    Open

    class Plugin implements
    Severity: Critical
    Found in src/Plugin.php by phan

    Call to method isDevMode from undeclared class \Composer\Script\Event (Did you mean class \Vaimo\ComposerPatches\Patch\Event)
    Open

                    $compExecutor->repositoryWrite($repository, $installationManager, $event->isDevMode());
    Severity: Critical
    Found in src/Plugin.php by phan

    Parameter $composer has undeclared type \Composer\Composer
    Open

        public function deactivate(\Composer\Composer $composer, \Composer\IO\IOInterface $appIO)
    Severity: Minor
    Found in src/Plugin.php by phan

    Class implements undeclared interface \Composer\Plugin\PluginInterface
    Open

    class Plugin implements
    Severity: Critical
    Found in src/Plugin.php by phan

    Parameter $appIO has undeclared type \Composer\IO\IOInterface
    Open

        public function uninstall(\Composer\Composer $composer, \Composer\IO\IOInterface $appIO)
    Severity: Minor
    Found in src/Plugin.php by phan

    Parameter $composer has undeclared type \Composer\Composer
    Open

        public function uninstall(\Composer\Composer $composer, \Composer\IO\IOInterface $appIO)
    Severity: Minor
    Found in src/Plugin.php by phan

    Reference to constant PRE_PACKAGE_UNINSTALL from undeclared class \Composer\Installer\PackageEvents
    Open

                \Composer\Installer\PackageEvents::PRE_PACKAGE_UNINSTALL => 'resetPackages'
    Severity: Critical
    Found in src/Plugin.php by phan

    Parameter $event has undeclared type \Composer\Script\Event (Did you mean class \Vaimo\ComposerPatches\Patch\Event)
    Open

        public function postInstall(\Composer\Script\Event $event)
    Severity: Minor
    Found in src/Plugin.php by phan

    Parameter $composer has undeclared type \Composer\Composer
    Open

        public function activate(\Composer\Composer $composer, \Composer\IO\IOInterface $appIO)
    Severity: Minor
    Found in src/Plugin.php by phan

    Call to method getComposer from undeclared class \Composer\Script\Event (Did you mean class \Vaimo\ComposerPatches\Patch\Event)
    Open

                    $installationManager = $event->getComposer()->getInstallationManager();
    Severity: Critical
    Found in src/Plugin.php by phan

    Parameter $event has undeclared type \Composer\Installer\PackageEvent
    Open

        public function resetPackages(\Composer\Installer\PackageEvent $event)
    Severity: Minor
    Found in src/Plugin.php by phan

    Parameter $appIO has undeclared type \Composer\IO\IOInterface
    Open

        public function activate(\Composer\Composer $composer, \Composer\IO\IOInterface $appIO)
    Severity: Minor
    Found in src/Plugin.php by phan

    Call to method getComposer from undeclared class \Composer\Script\Event (Did you mean class \Vaimo\ComposerPatches\Patch\Event)
    Open

                    $repository = $event->getComposer()->getRepositoryManager()->getLocalRepository();
    Severity: Critical
    Found in src/Plugin.php by phan

    Assigning null to property but \Vaimo\ComposerPatches\Plugin->bootstrap is \Vaimo\ComposerPatches\Bootstrap
    Open

            $this->bootstrap = null;
    Severity: Minor
    Found in src/Plugin.php by phan

    Call to method getOperation from undeclared class \Composer\Installer\PackageEvent
    Open

            if (!$this->operationAnalyser->isPatcherUninstallOperation($event->getOperation())) {
    Severity: Critical
    Found in src/Plugin.php by phan

    There are no issues that match your filters.

    Category
    Status