File ValidateCommand.php
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Copyright © Vaimo Group. All rights reserved.
* See LICENSE_VAIMO.txt for license details.
*/
Method collectPatchFilesFromPackages
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function collectPatchFilesFromPackages(array $matches, Config $pluginConfig)
{
$composer = $this->getComposer();
$composerConfig = $composer->getConfig();
Method execute
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('<info>Scanning packages for orphan patches</info>');
$composer = $this->getComposer();
Missing class import via use statement (line '57', column '34'). Open
$patchListAnalyser = new \Vaimo\ComposerPatches\Patch\DefinitionList\Analyser();
- Read upRead up
- Exclude checks
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 '144', column '36'). Open
$configReaderFactory = new \Vaimo\ComposerPatches\Factories\PatcherConfigReaderFactory($composer);
- Read upRead up
- Exclude checks
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 '207', column '33'). Open
$packageListUtils = new \Vaimo\ComposerPatches\Utils\PackageListUtils();
- Read upRead up
- Exclude checks
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 '63', column '31'). Open
$contextFactory = new \Vaimo\ComposerPatches\Factories\ComposerContextFactory($composer);
- Read upRead up
- Exclude checks
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 '206', column '35'). Open
$srcResolverFactory = new \Vaimo\ComposerPatches\Factories\SourcesResolverFactory($composer);
- Read upRead up
- Exclude checks
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 '147', column '32'). Open
$fileSystemUtils = new \Vaimo\ComposerPatches\Utils\FileSystemUtils();
- Read upRead up
- Exclude checks
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 '66', column '30'). Open
$configFactory = new \Vaimo\ComposerPatches\Factories\ConfigFactory($composerContext, array(
- Read upRead up
- Exclude checks
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 '146', column '28'). Open
$filterUtils = new \Vaimo\ComposerPatches\Utils\FilterUtils();
- Read upRead up
- Exclude checks
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 '213', column '32'). Open
$repositoryUtils = new \Vaimo\ComposerPatches\Utils\RepositoryUtils();
- Read upRead up
- Exclude checks
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 '145', column '26'). Open
$dataUtils = new \Vaimo\ComposerPatches\Utils\DataUtils();
- Read upRead up
- Exclude checks
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 '202', column '32'). Open
$packageResolver = new \Vaimo\ComposerPatches\Composer\Plugin\PackageResolver(
- Read upRead up
- Exclude checks
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 '237', column '30'). Open
$loaderFactory = new \Vaimo\ComposerPatches\Factories\PatchesLoaderFactory($composer);
- Read upRead up
- Exclude checks
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
Avoid using static access to class '\Vaimo\ComposerPatches\Utils\PathUtils' in method 'findWithMissingConfig'. Open
'path' => $config[Patch::URL] ?: PathUtils::reducePathLeft($path, $installPath)
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vaimo\ComposerPatches\Utils\PathUtils' in method 'findWithMissingFile'. Open
'path' => $config[Patch::URL] ?: PathUtils::reducePathLeft($path, $installPath)
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Define a constant instead of duplicating this literal "issue" 3 times. Open
'issue' => 'NO CONFIG',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to undeclared method \Vaimo\ComposerPatches\Composer\Commands\ValidateCommand::getComposer
Open
$composer = $this->getComposer();
- Exclude checks
Call to undeclared method \Vaimo\ComposerPatches\Composer\Commands\ValidateCommand::getComposer
Open
$composer = $this->getComposer();
- Exclude checks
Call to undeclared method \Vaimo\ComposerPatches\Composer\Commands\ValidateCommand::addOption
Open
$this->addOption(
- Exclude checks
Call to method writeln
from undeclared class \Symfony\Component\Console\Output\OutputInterface
Open
$output->writeln('<info>Scanning packages for orphan patches</info>');
- Exclude checks
Call to method writeln
from undeclared class \Symfony\Component\Console\Output\OutputInterface
Open
$output->writeln($line);
- Exclude checks
Call to undeclared method \Vaimo\ComposerPatches\Composer\Commands\ValidateCommand::setName
Open
$this->setName('patch:validate');
- Exclude checks
Reference to constant VALUE_NONE
from undeclared class \Symfony\Component\Console\Input\InputOption
Open
InputOption::VALUE_NONE,
- Exclude checks
Call to undeclared method \Vaimo\ComposerPatches\Composer\Commands\ValidateCommand::addOption
Open
$this->addOption(
- Exclude checks
Call to method writeln
from undeclared class \Symfony\Component\Console\Output\OutputInterface
Open
$output->writeln(
- Exclude checks
Checking instanceof against undeclared class \Composer\Package\RootPackageInterface
Open
$installPaths[$packageName] = $package instanceof \Composer\Package\RootPackageInterface
- Exclude checks
Call to method getName
from undeclared class \Composer\Package\PackageInterface
Open
$pluginName = $pluginPackage->getName();
- Exclude checks
Call to undeclared method \Vaimo\ComposerPatches\Composer\Commands\ValidateCommand::getIO
Open
$appIO = $this->getIO();
- Exclude checks
Parameter $output
has undeclared type \Symfony\Component\Console\Output\OutputInterface
Open
private function outputOrphans(OutputInterface $output, array $groups)
- Exclude checks
Reference to undeclared class \Composer\Command\BaseCommand
Open
parent::configure();
- Exclude checks
Parameter $input
has undeclared type \Symfony\Component\Console\Input\InputInterface
Open
protected function execute(InputInterface $input, OutputInterface $output)
- Exclude checks
Call to method getCanonicalPackages
from undeclared class \Composer\Repository\WritableRepositoryInterface
Open
$repository->getCanonicalPackages(),
- Exclude checks
Call to undeclared method \Vaimo\ComposerPatches\Composer\Commands\ValidateCommand::getComposer
Open
$composer = $this->getComposer();
- Exclude checks
Call to method getOption
from undeclared class \Symfony\Component\Console\Input\InputInterface
Open
Config::PATCHER_FROM_SOURCE => (bool)$input->getOption('from-source')
- Exclude checks
Parameter $repository
has undeclared type \Composer\Repository\WritableRepositoryInterface
Open
private function resolveValidationTargets(PackageRepository $repository, Config $pluginConfig)
- Exclude checks
Class extends undeclared class \Composer\Command\BaseCommand
Open
class ValidateCommand extends \Composer\Command\BaseCommand
- Exclude checks
Parameter $output
has undeclared type \Symfony\Component\Console\Output\OutputInterface
Open
protected function execute(InputInterface $input, OutputInterface $output)
- Exclude checks
Call to method getOption
from undeclared class \Symfony\Component\Console\Input\InputInterface
Open
$localOnly = $input->getOption('local');
- Exclude checks
Call to undeclared method \Vaimo\ComposerPatches\Composer\Commands\ValidateCommand::getComposer
Open
$composer = $this->getComposer();
- Exclude checks
Call to undeclared method \Vaimo\ComposerPatches\Composer\Commands\ValidateCommand::getComposer
Open
$composer = $this->getComposer();
- Exclude checks
Call to undeclared method \Vaimo\ComposerPatches\Composer\Commands\ValidateCommand::setDescription
Open
$this->setDescription('Validate that all patches have proper target configuration');
- Exclude checks
Reference to constant VALUE_NONE
from undeclared class \Symfony\Component\Console\Input\InputOption
Open
InputOption::VALUE_NONE,
- Exclude checks