vaimo/composer-patches

View on GitHub
src/Package/InfoResolver.php

Summary

Maintainability
A
2 hrs
Test Coverage

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

    public function getInstallPath(PackageInterface $package, $resolveMode)
    {
        $key = $package->getName() . '|' . $resolveMode;

        if (!isset($this->installPathCache[$key])) {
Severity: Minor
Found in src/Package/InfoResolver.php - About 1 hr to fix

    Function resolveNamesFromPaths has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function resolveNamesFromPaths(array $packagesByName, array $paths)
        {
            $paths = array_unique(
                array_map('dirname', $paths)
            );
    Severity: Minor
    Found in src/Package/InfoResolver.php - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function getInstallPath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getInstallPath(PackageInterface $package, $resolveMode)
        {
            $key = $package->getName() . '|' . $resolveMode;
    
            if (!isset($this->installPathCache[$key])) {
    Severity: Minor
    Found in src/Package/InfoResolver.php - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Parameter $package has undeclared type \Composer\Package\PackageInterface
    Open

        public function getAutoLoadPaths(PackageInterface $package)
    Severity: Minor
    Found in src/Package/InfoResolver.php by phan

    Call to method getInstallPath from undeclared class \Composer\Installer\InstallationManager
    Open

                ? $this->installationManager->getInstallPath($package)
    Severity: Critical
    Found in src/Package/InfoResolver.php by phan

    Call to method getComposerFile from undeclared class \Composer\Factory
    Open

                : realpath(dirname(\Composer\Factory::getComposerFile()));
    Severity: Critical
    Found in src/Package/InfoResolver.php by phan

    Call to method getAutoload from undeclared class \Composer\Package\PackageInterface
    Open

                        $autoloadConfig = $package->getAutoload();
    Severity: Critical
    Found in src/Package/InfoResolver.php by phan

    Call to method getAutoload from undeclared class \Composer\Package\PackageInterface
    Open

            $autoloadConfig = $package->getAutoload();
    Severity: Critical
    Found in src/Package/InfoResolver.php by phan

    Property \Vaimo\ComposerPatches\Package\InfoResolver->installationManager has undeclared type \Composer\Installer\InstallationManager
    Open

        private $installationManager;
    Severity: Minor
    Found in src/Package/InfoResolver.php by phan

    Parameter $package has undeclared type \Composer\Package\PackageInterface
    Open

        public function getSourcePath(PackageInterface $package)
    Severity: Minor
    Found in src/Package/InfoResolver.php by phan

    Parameter $installationManager has undeclared type \Composer\Installer\InstallationManager
    Open

        public function __construct(
    Severity: Minor
    Found in src/Package/InfoResolver.php by phan

    Checking instanceof against undeclared class \Composer\Package\RootPackageInterface
    Open

            return !$package instanceof \Composer\Package\RootPackageInterface
    Severity: Critical
    Found in src/Package/InfoResolver.php by phan

    Parameter $package has undeclared type \Composer\Package\PackageInterface
    Open

        public function getInstallPath(PackageInterface $package, $resolveMode)
    Severity: Minor
    Found in src/Package/InfoResolver.php by phan

    Checking instanceof against undeclared class \Composer\Package\RootPackageInterface
    Open

                        $this->installPathCache[$key] = $package instanceof \Composer\Package\RootPackageInterface
    Severity: Critical
    Found in src/Package/InfoResolver.php by phan

    Call to method getName from undeclared class \Composer\Package\PackageInterface
    Open

            $key = $package->getName() . '|' . $resolveMode;
    Severity: Critical
    Found in src/Package/InfoResolver.php by phan

    There are no issues that match your filters.

    Category
    Status