Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
[ci-review] Rector Rectify
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizen-ci authored and TomasVotruba committed Feb 20, 2021
1 parent 59120f7 commit 7c4a231
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@

final class EasyCodingStandardConsoleApplication extends AbstractSymplifyConsoleApplication
{
/**
* @var Configuration
*/
private $configuration;

/**
* @var NoCheckersLoaderReporter
*/
Expand All @@ -34,16 +29,10 @@ final class EasyCodingStandardConsoleApplication extends AbstractSymplifyConsole
/**
* @param Command[] $commands
*/
public function __construct(
Configuration $configuration,
NoCheckersLoaderReporter $noCheckersLoaderReporter,
array $commands
) {
public function __construct(NoCheckersLoaderReporter $noCheckersLoaderReporter, array $commands) {
$version = PrettyVersions::getVersion('symplify/easy-coding-standard');

parent::__construct($commands, 'EasyCodingStandard', $version->getPrettyVersion());

$this->configuration = $configuration;
$this->noCheckersLoaderReporter = $noCheckersLoaderReporter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,13 @@ final class JsonOutputFormatter implements OutputFormatterInterface
*/
private const FILES = 'files';

/**
* @var Configuration
*/
private $configuration;

/**
* @var EasyCodingStandardStyle
*/
private $easyCodingStandardStyle;

public function __construct(Configuration $configuration, EasyCodingStandardStyle $easyCodingStandardStyle)
public function __construct(EasyCodingStandardStyle $easyCodingStandardStyle)
{
$this->configuration = $configuration;
$this->easyCodingStandardStyle = $easyCodingStandardStyle;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private function isFilePath(string $value): bool
/**
* @return String_|ClassConstFetch
*/
private function resolveClassType(bool $skipClassesToConstantReference, string $value)
private function resolveClassType(bool $skipClassesToConstantReference, string $value): Expr
{
if ($skipClassesToConstantReference) {
return new String_($value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Symplify\PHPStanRules\CognitiveComplexity\NodeAnalyzer;

use PhpParser\Node\Stmt;
use PhpParser\Node;
use PhpParser\Node\Expr\BinaryOp\BooleanAnd;
use PhpParser\Node\Expr\Ternary;
Expand All @@ -25,7 +26,7 @@ final class ComplexityAffectingNodeFinder
{
/**
* B1. Increments
* @var string[]
* @var array<class-string<Stmt>>
*/
private const BREAKING_NODE_TYPES = [Continue_::class, Goto_::class, Break_::class];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Symplify\PHPStanRules\NodeAnalyzer\Nette;

use Nette\Application\UI\Template;
use PhpParser\Node\Expr;
use PHPStan\Analyser\Scope;
use Symplify\Astral\Naming\SimpleNameResolver;
Expand All @@ -12,7 +13,7 @@
final class NetteTypeAnalyzer
{
/**
* @var array<class-string>
* @var class-string<Template>[]
*/
private const TEMPLATE_TYPES = [
'Nette\Application\UI\Template',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Symplify\PHPStanRules\Rules;

use PhpParser\Node\Expr;
use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
Expand All @@ -24,7 +25,7 @@ final class ForbiddenMethodOrStaticCallInForeachRule extends AbstractSymplifyRul
public const ERROR_MESSAGE = 'Method nor static call in foreach is not allowed. Extract expression to a new variable assign on line before';

/**
* @var string[]
* @var array<class-string<Expr>>
*/
private const CALL_CLASS_TYPES = [MethodCall::class, StaticCall::class];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class ForbiddenMethodOrStaticCallInIfRule extends AbstractSymplifyRule
public const ERROR_MESSAGE = 'Method nor static call in if() or elseif() is not allowed. Extract expression to a new variable assign on line before';

/**
* @var string[]
* @var class-string<Strings>[]|class-string<TrinaryLogic>[]
*/
private const ALLOWED_CLASS_TYPES = [Strings::class, TrinaryLogic::class];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ final class ForbiddenThisArgumentRule extends AbstractSymplifyRule
public const ERROR_MESSAGE = '$this as argument is not allowed. Refactor method to service composition';

/**
* @var string[]
* @var class-string<Kernel>[]
*/
private const ALLOWED_PARENT_CLASSES = [Kernel::class];

/**
* @var string[]
* @var class-string<PrivatesCaller>[]
*/
private const ALLOWED_CALLER_CLASSES = [
// workaround type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class NoArrayAccessOnObjectRule extends AbstractSymplifyRule
public const ERROR_MESSAGE = 'Use explicit methods over array access on object';

/**
* @var string[]
* @var class-string<SimpleXMLElement>[]|class-string<SplFixedArray>[]
*/
private const ALLOWED_CLASSES = [SplFixedArray::class, SimpleXMLElement::class];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class NoClassWithStaticMethodWithoutStaticNameRule extends AbstractSymplif
public const ERROR_MESSAGE = 'Class "%s" with static method must have "Static" in its name it explicit';

/**
* @var string[]
* @var class-string<Command>[]|class-string<EventSubscriberInterface>[]|class-string<ValueObjectInliner>[]
*/
private const ALLOWED_CLASS_TYPES = [
// symfony classes with static methods
Expand Down
2 changes: 1 addition & 1 deletion packages/phpstan-rules/src/Rules/NoStaticPropertyRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class NoStaticPropertyRule extends AbstractSymplifyRule
public const ERROR_MESSAGE = 'Do not use static property';

/**
* @var string[]
* @var class-string<Container>[]|class-string<ContainerInterface>[]|class-string<KernelInterface>[]
*/
private const CACHEABLE_TYPES = [ContainerInterface::class, Container::class, KernelInterface::class];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class PreventDuplicateClassMethodRule extends AbstractSymplifyRule
private const PHPSTAN_GET_NODE_TYPE_METHODS = ['getNodeType', 'getNodeTypes'];

/**
* @var string[]
* @var class-string<Extension>[]|class-string<Kernel>[]
*/
private const EXCLUDED_TYPES = [Kernel::class, Extension::class];

Expand Down
10 changes: 1 addition & 9 deletions packages/set-config-resolver/src/AbstractConfigResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@

abstract class AbstractConfigResolver
{
/**
* @var SmartFileInfo|null
*/
private $firstResolvedConfigFileInfo;

/**
* @var OptionValueResolver
*/
Expand Down Expand Up @@ -73,9 +68,6 @@ private function createFallbackFileInfoIfFound(array $fallbackFiles): ?SmartFile

private function createFileInfo(string $configValue): SmartFileInfo
{
$configFileInfo = new SmartFileInfo($configValue);
$this->firstResolvedConfigFileInfo = $configFileInfo;

return $configFileInfo;
return new SmartFileInfo($configValue);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ final class ControllerDumper
*/
private $smartFileSystem;

/**
* @var ProgressBar|null
*/
private $progressBar;

public function __construct(
ControllerWithDataProviderMatcher $controllerWithDataProviderMatcher,
ControllerContentResolver $controllerContentResolver,
Expand Down
8 changes: 0 additions & 8 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Rector\CodingStyle\Rector\MethodCall\PreferThisOrSelfMethodCallRector;
use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\ProjectType;
use Rector\DeadCode\Rector\Class_\RemoveUnusedClassesRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Privatization\Rector\ClassMethod\PrivatizeLocalOnlyMethodRector;
use Rector\Set\ValueObject\SetList;
Expand Down Expand Up @@ -89,13 +88,6 @@
__DIR__ . '/packages/phpstan-rules/tests/Rules/ForbiddenArrayWithStringKeysRule/FixturePhp80/SkipAttributeArrayKey.php',
],

RemoveUnusedClassesRector::class => [
__DIR__ . '/packages/easy-coding-standard/packages/changed-files-detector/tests/FileHashComputerSource',
__DIR__ . '/packages/easy-coding-standard/packages/sniff-runner/tests/Application/FixerSource/SomeFile.php',
__DIR__ . '/packages/phpstan-rules/tests/Rules/ForbiddenArrayWithStringKeysRule/FixturePhp80/SkipAttributeArrayKey.php',
__DIR__ . '/packages/template-checker/tests/SomeBundle/RealClassBundle.php',
],

__DIR__ . '/packages/sniffer-fixer-to-ecs-converter/stubs/Sniff.php',

MoveVariableDeclarationNearReferenceRector::class => [
Expand Down

0 comments on commit 7c4a231

Please sign in to comment.