Skip to content

Commit

Permalink
[ci-review] Rector Rectify
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizen-ci committed May 17, 2021
1 parent 57098c3 commit 37219bf
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function refactor(Node $node): ?Node
}

if (! $node instanceof Assign) {
return ! (bool) $this->betterNodeFinder->find($node, function (Node $n) use ($arrayVariable) {
return ! (bool) $this->betterNodeFinder->find($node, function (Node $n) use ($arrayVariable): bool {
return $this->nodeComparator->areNodesEqual($arrayVariable, $n);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public function refactor(Node $node): ?Node

private function createAnonymousClassName(): string
{
$fileInfo = $this->file->getSmartFileInfo();
$smartFileInfo = $this->file->getSmartFileInfo();

return self::ANONYMOUS_CLASS_PREFIX . md5($fileInfo->getRealPath()) . '__' . count($this->classes);
return self::ANONYMOUS_CLASS_PREFIX . md5($smartFileInfo->getRealPath()) . '__' . count($this->classes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ public function getNodeTypes(): array
*/
public function refactor(Node $node): ?Node
{
$fileInfo = $this->file->getSmartFileInfo();
$smartFileInfo = $this->file->getSmartFileInfo();

// this rule is parsing strings, so it heavy on performance; to lower it, we'll process only known opt-in files
if (! $this->isRelevantFileInfo($fileInfo)) {
if (! $this->isRelevantFileInfo($smartFileInfo)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ final class SetCookieOptionsArrayToArgumentsRector extends AbstractRector
6 => false,
];

/**
* @var int
*/
private $highestIndex = 1;
private int $highestIndex = 1;

public function getRuleDefinition(): RuleDefinition
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class AddDefaultValueForUndefinedVariableRector extends AbstractRector
/**
* @var string[]
*/
private $definedVariables = [];
private array $definedVariables = [];

public function getRuleDefinition(): RuleDefinition
{
Expand Down
2 changes: 1 addition & 1 deletion rules/Php71/Rector/Name/ReservedObjectRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class ReservedObjectRector extends AbstractRector implements ConfigurableR
/**
* @var array<string, string>
*/
private $reservedKeywordsToReplacements = [];
private array $reservedKeywordsToReplacements = [];

public function getRuleDefinition(): RuleDefinition
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,9 @@ final class PseudoNamespaceToNamespaceRector extends AbstractRector implements C
/**
* @var PseudoNamespaceToNamespace[]
*/
private $pseudoNamespacesToNamespaces = [];
private array $pseudoNamespacesToNamespaces = [];

/**
* @var string|null
*/
private $newNamespace;
private ?string $newNamespace = null;

public function __construct(
private PhpDocTypeRenamer $phpDocTypeRenamer
Expand Down

0 comments on commit 37219bf

Please sign in to comment.