Updated Rector to commit 97ca45aade

97ca45aade skip private method
This commit is contained in:
Tomas Votruba 2021-07-05 23:06:30 +00:00
parent 3b8c600786
commit b7686ac9ad
245 changed files with 743 additions and 2560 deletions

View File

@ -40,10 +40,7 @@ final class DoctrineAnnotationTagValueNode extends \Rector\BetterPhpDocParser\Va
$itemContents = $this->printValuesContent($this->values);
return \sprintf('(%s)', $itemContents);
}
/**
* @param string $className
*/
public function hasClassName($className) : bool
public function hasClassName(string $className) : bool
{
$annotationName = \trim($this->identifierTypeNode->name, '@');
if ($annotationName === $className) {

View File

@ -19,10 +19,7 @@ final class ArrayTypePhpDocNodeVisitor extends \RectorPrefix20210705\Symplify\Si
{
$this->attributeMirrorer = $attributeMirrorer;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode) {
return null;

View File

@ -19,10 +19,7 @@ final class CallableTypePhpDocNodeVisitor extends \RectorPrefix20210705\Symplify
{
$this->attributeMirrorer = $attributeMirrorer;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\CallableTypeNode) {
return null;

View File

@ -12,17 +12,11 @@ final class ChangedPhpDocNodeVisitor extends \RectorPrefix20210705\Symplify\Simp
* @var bool
*/
private $hasChanged = \false;
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function beforeTraverse($node) : void
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void
{
$this->hasChanged = \false;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
{
$origNode = $node->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::ORIG_NODE);
if ($origNode === null) {

View File

@ -19,10 +19,7 @@ final class IntersectionTypeNodePhpDocNodeVisitor extends \RectorPrefix20210705\
{
$this->attributeMirrorer = $attributeMirrorer;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode) {
return null;

View File

@ -19,10 +19,7 @@ final class ParamPhpDocNodeVisitor extends \RectorPrefix20210705\Symplify\Simple
{
$this->attributeMirrorer = $attributeMirrorer;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode) {
return null;

View File

@ -30,10 +30,7 @@ final class TemplatePhpDocNodeVisitor extends \RectorPrefix20210705\Symplify\Sim
$this->currentTokenIteratorProvider = $currentTokenIteratorProvider;
$this->attributeMirrorer = $attributeMirrorer;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode) {
return null;
@ -51,11 +48,7 @@ final class TemplatePhpDocNodeVisitor extends \RectorPrefix20210705\Symplify\Sim
$this->attributeMirrorer->mirror($node, $spacingAwareTemplateTagValueNode);
return $spacingAwareTemplateTagValueNode;
}
/**
* @param \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $betterTokenIterator
* @param \Rector\BetterPhpDocParser\ValueObject\StartAndEnd $startAndEnd
*/
private function resolvePreposition($betterTokenIterator, $startAndEnd) : string
private function resolvePreposition(\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $betterTokenIterator, \Rector\BetterPhpDocParser\ValueObject\StartAndEnd $startAndEnd) : string
{
$partialTokens = $betterTokenIterator->partialTokens($startAndEnd->getStart(), $startAndEnd->getEnd());
foreach ($partialTokens as $partialToken) {

View File

@ -30,10 +30,7 @@ final class UnionTypeNodePhpDocNodeVisitor extends \RectorPrefix20210705\Symplif
$this->currentTokenIteratorProvider = $currentTokenIteratorProvider;
$this->attributeMirrorer = $attributeMirrorer;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode) {
return null;
@ -52,11 +49,7 @@ final class UnionTypeNodePhpDocNodeVisitor extends \RectorPrefix20210705\Symplif
$this->attributeMirrorer->mirror($node, $bracketsAwareUnionTypeNode);
return $bracketsAwareUnionTypeNode;
}
/**
* @param \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $betterTokenProvider
* @param \Rector\BetterPhpDocParser\ValueObject\StartAndEnd $startAndEnd
*/
private function isWrappedInCurlyBrackets($betterTokenProvider, $startAndEnd) : bool
private function isWrappedInCurlyBrackets(\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $betterTokenProvider, \Rector\BetterPhpDocParser\ValueObject\StartAndEnd $startAndEnd) : bool
{
$previousPosition = $startAndEnd->getStart() - 1;
if ($betterTokenProvider->isTokenTypeOnPosition(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_OPEN_PARENTHESES, $previousPosition)) {

View File

@ -87,9 +87,8 @@ final class BetterPhpDocParser extends \PHPStan\PhpDocParser\Parser\PhpDocParser
}
/**
* @return PhpDocTextNode|PhpDocTagNode
* @param \PHPStan\PhpDocParser\Parser\TokenIterator $tokenIterator
*/
private function parseChildAndStoreItsPositions($tokenIterator) : \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode
private function parseChildAndStoreItsPositions(\PHPStan\PhpDocParser\Parser\TokenIterator $tokenIterator) : \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode
{
$betterTokenIterator = $this->tokenIteratorFactory->createFromTokenIterator($tokenIterator);
$startPosition = $betterTokenIterator->currentPosition();
@ -100,10 +99,7 @@ final class BetterPhpDocParser extends \PHPStan\PhpDocParser\Parser\PhpDocParser
$phpDocNode->setAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END, $startAndEnd);
return $phpDocNode;
}
/**
* @param \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $tokenIterator
*/
private function resolveTag($tokenIterator) : string
private function resolveTag(\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $tokenIterator) : string
{
$tag = $tokenIterator->currentTokenValue();
$tokenIterator->next();

View File

@ -41,10 +41,7 @@ abstract class AbstractValuesAwareNode implements \PHPStan\PhpDocParser\Ast\PhpD
$this->originalContent = $originalContent;
$this->silentKey = $silentKey;
}
/**
* @param string $key
*/
public function removeValue($key) : void
public function removeValue(string $key) : void
{
$quotedKey = '"' . $key . '"';
// isset?
@ -77,9 +74,8 @@ abstract class AbstractValuesAwareNode implements \PHPStan\PhpDocParser\Ast\PhpD
}
/**
* @param mixed $value
* @param string $key
*/
public function changeValue($key, $value) : void
public function changeValue(string $key, $value) : void
{
// is quoted?
if (isset($this->values[$key])) {
@ -173,7 +169,7 @@ abstract class AbstractValuesAwareNode implements \PHPStan\PhpDocParser\Ast\PhpD
* @param mixed[] $values
* @return array<int|string, mixed>
*/
protected function removeQuotesFromArray($values) : array
protected function removeQuotesFromArray(array $values) : array
{
$unquotedArray = [];
foreach ($values as $key => $value) {
@ -186,7 +182,7 @@ abstract class AbstractValuesAwareNode implements \PHPStan\PhpDocParser\Ast\PhpD
/**
* @param mixed[] $values
*/
protected function printValuesContent($values) : string
protected function printValuesContent(array $values) : string
{
$itemContents = '';
\end($values);

View File

@ -29,7 +29,7 @@ final class CurlyListNode extends \Rector\BetterPhpDocParser\ValueObject\PhpDoc\
/**
* @param mixed[] $array
*/
private function implode($array) : string
private function implode(array $array) : string
{
$itemContents = '';
\end($array);

View File

@ -28,10 +28,7 @@ final class SpacingAwareArrayTypeNode extends \PHPStan\PhpDocParser\Ast\Type\Arr
}
return $typeAsString . '[]';
}
/**
* @param \PHPStan\PhpDocParser\Ast\Type\TypeNode $typeNode
*/
private function isGenericArrayCandidate($typeNode) : bool
private function isGenericArrayCandidate(\PHPStan\PhpDocParser\Ast\Type\TypeNode $typeNode) : bool
{
$hasGenericTypeParent = (bool) $this->getAttribute(\Rector\PHPStanStaticTypeMapper\TypeMapper\ArrayTypeMapper::HAS_GENERIC_TYPE_PARENT);
if (!$hasGenericTypeParent) {
@ -39,10 +36,7 @@ final class SpacingAwareArrayTypeNode extends \PHPStan\PhpDocParser\Ast\Type\Arr
}
return $typeNode instanceof \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode || $typeNode instanceof \PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode $arrayTypeNode
*/
private function printArrayType($arrayTypeNode) : string
private function printArrayType(\PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode $arrayTypeNode) : string
{
$typeAsString = (string) $arrayTypeNode;
$singleTypesAsString = \explode('|', $typeAsString);
@ -51,10 +45,7 @@ final class SpacingAwareArrayTypeNode extends \PHPStan\PhpDocParser\Ast\Type\Arr
}
return \implode('|', $singleTypesAsString);
}
/**
* @param \Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode $bracketsAwareUnionTypeNode
*/
private function printUnionType($bracketsAwareUnionTypeNode) : string
private function printUnionType(\Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode $bracketsAwareUnionTypeNode) : string
{
$unionedTypes = [];
if ($bracketsAwareUnionTypeNode->isWrappedInBrackets()) {

View File

@ -38,11 +38,7 @@ final class SpacingAwareCallableTypeNode extends \PHPStan\PhpDocParser\Ast\Type\
$parameterTypeString = \implode(', ', $parameterTypeStrings);
return \trim($parameterTypeString);
}
/**
* @param string $parameterTypeString
* @param string $returnTypeAsString
*/
private function normalizeParameterType($parameterTypeString, $returnTypeAsString) : string
private function normalizeParameterType(string $parameterTypeString, string $returnTypeAsString) : string
{
if ($parameterTypeString !== '') {
return '(' . $parameterTypeString . ')';
@ -55,11 +51,7 @@ final class SpacingAwareCallableTypeNode extends \PHPStan\PhpDocParser\Ast\Type\
}
return '()';
}
/**
* @param string $parameterTypeString
* @param string $returnTypeAsString
*/
private function normalizeReturnType($parameterTypeString, $returnTypeAsString) : string
private function normalizeReturnType(string $parameterTypeString, string $returnTypeAsString) : string
{
if ($returnTypeAsString !== 'mixed') {
return ':' . $returnTypeAsString;

View File

@ -59,7 +59,7 @@ final class ConsoleOutputFormatter implements \Rector\ChangesReporting\Contract\
/**
* @param FileDiff[] $fileDiffs
*/
private function reportFileDiffs($fileDiffs) : void
private function reportFileDiffs(array $fileDiffs) : void
{
if (\count($fileDiffs) <= 0) {
return;
@ -86,7 +86,7 @@ final class ConsoleOutputFormatter implements \Rector\ChangesReporting\Contract\
/**
* @param RectorError[] $errors
*/
private function reportErrors($errors) : void
private function reportErrors(array $errors) : void
{
foreach ($errors as $error) {
$errorMessage = $error->getMessage();
@ -98,10 +98,7 @@ final class ConsoleOutputFormatter implements \Rector\ChangesReporting\Contract\
$this->outputStyle->error($message);
}
}
/**
* @param \Rector\Core\ValueObject\ProcessResult $processResult
*/
private function reportRemovedFilesAndNodes($processResult) : void
private function reportRemovedFilesAndNodes(\Rector\Core\ValueObject\ProcessResult $processResult) : void
{
if ($processResult->getAddedFilesCount() !== 0) {
$message = \sprintf('%d files were added', $processResult->getAddedFilesCount());
@ -113,19 +110,13 @@ final class ConsoleOutputFormatter implements \Rector\ChangesReporting\Contract\
}
$this->reportRemovedNodes($processResult);
}
/**
* @param string $errorMessage
*/
private function normalizePathsToRelativeWithLine($errorMessage) : string
private function normalizePathsToRelativeWithLine(string $errorMessage) : string
{
$regex = '#' . \preg_quote(\getcwd(), '#') . '/#';
$errorMessage = \RectorPrefix20210705\Nette\Utils\Strings::replace($errorMessage, $regex, '');
return \RectorPrefix20210705\Nette\Utils\Strings::replace($errorMessage, self::ON_LINE_REGEX, ':');
}
/**
* @param \Rector\Core\ValueObject\ProcessResult $processResult
*/
private function reportRemovedNodes($processResult) : void
private function reportRemovedNodes(\Rector\Core\ValueObject\ProcessResult $processResult) : void
{
if ($processResult->getRemovedNodeCount() === 0) {
return;
@ -133,11 +124,7 @@ final class ConsoleOutputFormatter implements \Rector\ChangesReporting\Contract\
$message = \sprintf('%d nodes were removed', $processResult->getRemovedNodeCount());
$this->outputStyle->warning($message);
}
/**
* @param \Rector\Core\ValueObject\ProcessResult $processResult
* @param \Rector\Core\ValueObject\Configuration $configuration
*/
private function createSuccessMessage($processResult, $configuration) : string
private function createSuccessMessage(\Rector\Core\ValueObject\ProcessResult $processResult, \Rector\Core\ValueObject\Configuration $configuration) : string
{
$changeCount = \count($processResult->getFileDiffs()) + $processResult->getRemovedAndAddedFilesCount();
if ($changeCount === 0) {
@ -147,9 +134,8 @@ final class ConsoleOutputFormatter implements \Rector\ChangesReporting\Contract\
}
/**
* @return string[]
* @param \Rector\Core\ValueObject\Reporting\FileDiff $fileDiff
*/
private function createRectorChangelogLines($fileDiff) : array
private function createRectorChangelogLines(\Rector\Core\ValueObject\Reporting\FileDiff $fileDiff) : array
{
$rectorsChangelogs = $this->rectorsChangelogResolver->resolveIncludingMissing($fileDiff->getRectorClasses());
$rectorsChangelogsLines = [];

View File

@ -55,7 +55,7 @@ final class JsonOutputFormatter implements \Rector\ChangesReporting\Contract\Out
* @param mixed[] $errors
* @return mixed[]
*/
private function createErrorsData($errors) : array
private function createErrorsData(array $errors) : array
{
$errorsData = [];
foreach ($errors as $error) {

View File

@ -71,11 +71,7 @@ final class XmlFileFormatter implements \Rector\FileFormatter\Contract\Formatter
$editorConfigConfigurationBuilder->withIndent(\Rector\FileFormatter\ValueObject\Indent::createTab());
return $editorConfigConfigurationBuilder;
}
/**
* @param string $xml
* @param \Rector\FileFormatter\ValueObject\EditorConfigConfiguration $editorConfigConfiguration
*/
private function formatXml($xml, $editorConfigConfiguration) : string
private function formatXml(string $xml, \Rector\FileFormatter\ValueObject\EditorConfigConfiguration $editorConfigConfiguration) : string
{
$output = '';
$this->depth = 0;
@ -90,18 +86,13 @@ final class XmlFileFormatter implements \Rector\FileFormatter\Contract\Formatter
}
/**
* @return string[]
* @param string $xml
*/
private function getXmlParts($xml) : array
private function getXmlParts(string $xml) : array
{
$withNewLines = \RectorPrefix20210705\Nette\Utils\Strings::replace(\trim($xml), self::XML_PARTS_REGEX, "\$1\n\$2\$3");
return \explode("\n", $withNewLines);
}
/**
* @param string $part
* @param \Rector\FileFormatter\ValueObject\EditorConfigConfiguration $editorConfigConfiguration
*/
private function getOutputForPart($part, $editorConfigConfiguration) : string
private function getOutputForPart(string $part, \Rector\FileFormatter\ValueObject\EditorConfigConfiguration $editorConfigConfiguration) : string
{
$output = '';
$this->runPre($part);
@ -114,19 +105,13 @@ final class XmlFileFormatter implements \Rector\FileFormatter\Contract\Formatter
$this->runPost($part);
return $output;
}
/**
* @param string $part
*/
private function runPre($part) : void
private function runPre(string $part) : void
{
if ($this->isClosingTag($part)) {
--$this->depth;
}
}
/**
* @param string $part
*/
private function runPost($part) : void
private function runPost(string $part) : void
{
if ($this->isOpeningTag($part)) {
++$this->depth;
@ -138,38 +123,23 @@ final class XmlFileFormatter implements \Rector\FileFormatter\Contract\Formatter
$this->preserveWhitespace = \true;
}
}
/**
* @param string $part
*/
private function getPaddedString($part) : string
private function getPaddedString(string $part) : string
{
return \str_pad($part, \strlen($part) + $this->depth * $this->indent, $this->padChar, \STR_PAD_LEFT);
}
/**
* @param string $part
*/
private function isOpeningTag($part) : bool
private function isOpeningTag(string $part) : bool
{
return (bool) \RectorPrefix20210705\Nette\Utils\Strings::match($part, self::IS_OPENING_TAG_REGEX);
}
/**
* @param string $part
*/
private function isClosingTag($part) : bool
private function isClosingTag(string $part) : bool
{
return (bool) \RectorPrefix20210705\Nette\Utils\Strings::match($part, self::IS_CLOSING_TAG_REGEX);
}
/**
* @param string $part
*/
private function isOpeningCdataTag($part) : bool
private function isOpeningCdataTag(string $part) : bool
{
return \strpos($part, '<![CDATA[') !== \false;
}
/**
* @param string $part
*/
private function isClosingCdataTag($part) : bool
private function isClosingCdataTag(string $part) : bool
{
return \strpos($part, ']]>') !== \false;
}

View File

@ -16,9 +16,8 @@ final class ClassConstFetchNameResolver implements \Rector\NodeNameResolver\Cont
private $nodeNameResolver;
/**
* @required
* @param \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver
*/
public function autowireClassConstFetchNameResolver($nodeNameResolver) : void
public function autowireClassConstFetchNameResolver(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver) : void
{
$this->nodeNameResolver = $nodeNameResolver;
}
@ -30,9 +29,9 @@ final class ClassConstFetchNameResolver implements \Rector\NodeNameResolver\Cont
return \PhpParser\Node\Expr\ClassConstFetch::class;
}
/**
* @param \PhpParser\Node $node
* @param ClassConstFetch $node
*/
public function resolve($node) : ?string
public function resolve(\PhpParser\Node $node) : ?string
{
$class = $this->nodeNameResolver->getName($node->class);
$name = $this->nodeNameResolver->getName($node->name);

View File

@ -16,9 +16,8 @@ final class ClassConstNameResolver implements \Rector\NodeNameResolver\Contract\
private $nodeNameResolver;
/**
* @required
* @param \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver
*/
public function autowireClassConstNameResolver($nodeNameResolver) : void
public function autowireClassConstNameResolver(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver) : void
{
$this->nodeNameResolver = $nodeNameResolver;
}
@ -30,9 +29,9 @@ final class ClassConstNameResolver implements \Rector\NodeNameResolver\Contract\
return \PhpParser\Node\Stmt\ClassConst::class;
}
/**
* @param \PhpParser\Node $node
* @param ClassConst $node
*/
public function resolve($node) : ?string
public function resolve(\PhpParser\Node $node) : ?string
{
if ($node->consts === []) {
return null;

View File

@ -17,9 +17,8 @@ final class ClassNameResolver implements \Rector\NodeNameResolver\Contract\NodeN
private $nodeNameResolver;
/**
* @required
* @param \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver
*/
public function autowireClassNameResolver($nodeNameResolver) : void
public function autowireClassNameResolver(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver) : void
{
$this->nodeNameResolver = $nodeNameResolver;
}
@ -31,9 +30,9 @@ final class ClassNameResolver implements \Rector\NodeNameResolver\Contract\NodeN
return \PhpParser\Node\Stmt\ClassLike::class;
}
/**
* @param \PhpParser\Node $node
* @param Class_ $node
*/
public function resolve($node) : ?string
public function resolve(\PhpParser\Node $node) : ?string
{
if (\property_exists($node, 'namespacedName')) {
return $node->namespacedName->toString();

View File

@ -16,9 +16,9 @@ final class EmptyNameResolver implements \Rector\NodeNameResolver\Contract\NodeN
return \PhpParser\Node\Expr\Empty_::class;
}
/**
* @param \PhpParser\Node $node
* @param Empty_ $node
*/
public function resolve($node) : ?string
public function resolve(\PhpParser\Node $node) : ?string
{
return 'empty';
}

View File

@ -31,9 +31,9 @@ final class FuncCallNameResolver implements \Rector\NodeNameResolver\Contract\No
* If some function is namespaced, it will be used over global one.
* But only if it really exists.
*
* @param \PhpParser\Node $node
* @param FuncCall $node
*/
public function resolve($node) : ?string
public function resolve(\PhpParser\Node $node) : ?string
{
if ($node->name instanceof \PhpParser\Node\Expr) {
return null;

View File

@ -18,9 +18,9 @@ final class FunctionNameResolver implements \Rector\NodeNameResolver\Contract\No
return \PhpParser\Node\Stmt\Function_::class;
}
/**
* @param \PhpParser\Node $node
* @param Function_ $node
*/
public function resolve($node) : ?string
public function resolve(\PhpParser\Node $node) : ?string
{
$bareName = (string) $node->name;
$scope = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);

View File

@ -27,9 +27,9 @@ final class NameNameResolver implements \Rector\NodeNameResolver\Contract\NodeNa
return \PhpParser\Node\Name::class;
}
/**
* @param \PhpParser\Node $node
* @param Name $node
*/
public function resolve($node) : ?string
public function resolve(\PhpParser\Node $node) : ?string
{
// possible function parent
$parent = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);

View File

@ -16,9 +16,8 @@ final class ParamNameResolver implements \Rector\NodeNameResolver\Contract\NodeN
private $nodeNameResolver;
/**
* @required
* @param \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver
*/
public function autowireParamNameResolver($nodeNameResolver) : void
public function autowireParamNameResolver(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver) : void
{
$this->nodeNameResolver = $nodeNameResolver;
}
@ -30,9 +29,9 @@ final class ParamNameResolver implements \Rector\NodeNameResolver\Contract\NodeN
return \PhpParser\Node\Param::class;
}
/**
* @param \PhpParser\Node $node
* @param Param $node
*/
public function resolve($node) : ?string
public function resolve(\PhpParser\Node $node) : ?string
{
return $this->nodeNameResolver->getName($node->var);
}

View File

@ -16,9 +16,8 @@ final class PropertyNameResolver implements \Rector\NodeNameResolver\Contract\No
private $nodeNameResolver;
/**
* @required
* @param \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver
*/
public function autowirePropertyNameResolver($nodeNameResolver) : void
public function autowirePropertyNameResolver(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver) : void
{
$this->nodeNameResolver = $nodeNameResolver;
}
@ -30,9 +29,9 @@ final class PropertyNameResolver implements \Rector\NodeNameResolver\Contract\No
return \PhpParser\Node\Stmt\Property::class;
}
/**
* @param \PhpParser\Node $node
* @param Property $node
*/
public function resolve($node) : ?string
public function resolve(\PhpParser\Node $node) : ?string
{
if ($node->props === []) {
return null;

View File

@ -16,9 +16,8 @@ final class UseNameResolver implements \Rector\NodeNameResolver\Contract\NodeNam
private $nodeNameResolver;
/**
* @required
* @param \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver
*/
public function autowireUseNameResolver($nodeNameResolver) : void
public function autowireUseNameResolver(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver) : void
{
$this->nodeNameResolver = $nodeNameResolver;
}
@ -30,9 +29,9 @@ final class UseNameResolver implements \Rector\NodeNameResolver\Contract\NodeNam
return \PhpParser\Node\Stmt\Use_::class;
}
/**
* @param \PhpParser\Node $node
* @param Use_ $node
*/
public function resolve($node) : ?string
public function resolve(\PhpParser\Node $node) : ?string
{
if ($node->uses === []) {
return null;

View File

@ -20,9 +20,9 @@ final class VariableNameResolver implements \Rector\NodeNameResolver\Contract\No
return \PhpParser\Node\Expr\Variable::class;
}
/**
* @param \PhpParser\Node $node
* @param Variable $node
*/
public function resolve($node) : ?string
public function resolve(\PhpParser\Node $node) : ?string
{
$parentNode = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
// skip $some->$dynamicMethodName()

View File

@ -46,9 +46,8 @@ final class NameTypeResolver implements \Rector\NodeTypeResolver\Contract\NodeTy
}
/**
* @return \PHPStan\Type\MixedType|\PHPStan\Type\ObjectType|\PHPStan\Type\UnionType
* @param \PhpParser\Node\Name $name
*/
private function resolveParent($name)
private function resolveParent(\PhpParser\Node\Name $name)
{
$className = $name->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NAME);
if ($className === null) {
@ -70,10 +69,7 @@ final class NameTypeResolver implements \Rector\NodeTypeResolver\Contract\NodeTy
}
return new \PHPStan\Type\UnionType($parentClassObjectTypes);
}
/**
* @param \PhpParser\Node\Name $name
*/
private function resolveFullyQualifiedName($name) : string
private function resolveFullyQualifiedName(\PhpParser\Node\Name $name) : string
{
$nameValue = $name->toString();
if (\in_array($nameValue, ['self', 'static', 'this'], \true)) {

View File

@ -67,10 +67,7 @@ final class NewTypeResolver implements \Rector\NodeTypeResolver\Contract\NodeTyp
}
return $scope->getType($node);
}
/**
* @param \PhpParser\Node\Expr\New_ $new
*/
private function resolveAnonymousClassType($new) : \PHPStan\Type\ObjectWithoutClassType
private function resolveAnonymousClassType(\PhpParser\Node\Expr\New_ $new) : \PHPStan\Type\ObjectWithoutClassType
{
if (!$new->class instanceof \PhpParser\Node\Stmt\Class_) {
return new \PHPStan\Type\ObjectWithoutClassType();

View File

@ -85,10 +85,7 @@ final class ParamTypeResolver implements \Rector\NodeTypeResolver\Contract\NodeT
}
return $this->resolveFromFunctionDocBlock($node);
}
/**
* @param \PhpParser\Node\Param $param
*/
private function resolveFromParamType($param) : \PHPStan\Type\Type
private function resolveFromParamType(\PhpParser\Node\Param $param) : \PHPStan\Type\Type
{
if ($param->type === null) {
return new \PHPStan\Type\MixedType();
@ -98,10 +95,7 @@ final class ParamTypeResolver implements \Rector\NodeTypeResolver\Contract\NodeT
}
return $this->staticTypeMapper->mapPhpParserNodePHPStanType($param->type);
}
/**
* @param \PhpParser\Node\Param $param
*/
private function resolveFromFirstVariableUse($param) : \PHPStan\Type\Type
private function resolveFromFirstVariableUse(\PhpParser\Node\Param $param) : \PHPStan\Type\Type
{
$classMethod = $param->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
@ -122,19 +116,13 @@ final class ParamTypeResolver implements \Rector\NodeTypeResolver\Contract\NodeT
});
return $paramStaticType;
}
/**
* @param \PhpParser\Node\Param $param
*/
private function resolveFromFunctionDocBlock($param) : \PHPStan\Type\Type
private function resolveFromFunctionDocBlock(\PhpParser\Node\Param $param) : \PHPStan\Type\Type
{
$phpDocInfo = $this->getFunctionLikePhpDocInfo($param);
$paramName = $this->nodeNameResolver->getName($param);
return $phpDocInfo->getParamType($paramName);
}
/**
* @param \PhpParser\Node\Param $param
*/
private function getFunctionLikePhpDocInfo($param) : \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
private function getFunctionLikePhpDocInfo(\PhpParser\Node\Param $param) : \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
{
$parentNode = $param->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
if (!$parentNode instanceof \PhpParser\Node\FunctionLike) {

View File

@ -92,10 +92,7 @@ final class PropertyFetchTypeResolver implements \Rector\NodeTypeResolver\Contra
}
return $scope->getType($node);
}
/**
* @param \PhpParser\Node\Expr\PropertyFetch $propertyFetch
*/
private function getVendorPropertyFetchType($propertyFetch) : \PHPStan\Type\Type
private function getVendorPropertyFetchType(\PhpParser\Node\Expr\PropertyFetch $propertyFetch) : \PHPStan\Type\Type
{
// 3rd party code
$propertyName = $this->nodeNameResolver->getName($propertyFetch->name);

View File

@ -82,12 +82,7 @@ final class StaticCallMethodCallTypeResolver implements \Rector\NodeTypeResolver
}
return new \PHPStan\Type\MixedType();
}
/**
* @param string $referencedClass
* @param string $methodName
* @param \PHPStan\Analyser\Scope $scope
*/
private function resolveClassMethodReturnType($referencedClass, $methodName, $scope) : \PHPStan\Type\Type
private function resolveClassMethodReturnType(string $referencedClass, string $methodName, \PHPStan\Analyser\Scope $scope) : \PHPStan\Type\Type
{
if (!$this->reflectionProvider->hasClass($referencedClass)) {
return new \PHPStan\Type\MixedType();

View File

@ -66,11 +66,7 @@ final class VariableTypeResolver implements \Rector\NodeTypeResolver\Contract\No
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
return $phpDocInfo->getVarType();
}
/**
* @param \PhpParser\Node\Expr\Variable $variable
* @param string $variableName
*/
private function resolveTypesFromScope($variable, $variableName) : \PHPStan\Type\Type
private function resolveTypesFromScope(\PhpParser\Node\Expr\Variable $variable, string $variableName) : \PHPStan\Type\Type
{
$scope = $this->resolveNodeScope($variable);
if (!$scope instanceof \PHPStan\Analyser\Scope) {
@ -82,10 +78,7 @@ final class VariableTypeResolver implements \Rector\NodeTypeResolver\Contract\No
// this → object type is easier to work with and consistent with the rest of the code
return $scope->getVariableType($variableName);
}
/**
* @param \PhpParser\Node\Expr\Variable $variable
*/
private function resolveNodeScope($variable) : ?\PHPStan\Analyser\Scope
private function resolveNodeScope(\PhpParser\Node\Expr\Variable $variable) : ?\PHPStan\Analyser\Scope
{
/** @var Scope|null $nodeScope */
$nodeScope = $variable->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
@ -104,10 +97,7 @@ final class VariableTypeResolver implements \Rector\NodeTypeResolver\Contract\No
}
return $this->resolveFromParentNodes($variable);
}
/**
* @param \PhpParser\Node\Expr\Variable $variable
*/
private function resolveFromParentNodes($variable) : ?\PHPStan\Analyser\Scope
private function resolveFromParentNodes(\PhpParser\Node\Expr\Variable $variable) : ?\PHPStan\Analyser\Scope
{
foreach (self::PARENT_NODE_ATTRIBUTES as $parentNodeAttribute) {
$parentNode = $variable->getAttribute($parentNodeAttribute);

View File

@ -64,10 +64,7 @@ final class FunctionMethodAndClassNodeVisitor extends \PhpParser\NodeVisitorAbst
}
return null;
}
/**
* @param \PhpParser\Node $node
*/
private function processClass($node) : void
private function processClass(\PhpParser\Node $node) : void
{
if ($node instanceof \PhpParser\Node\Stmt\ClassLike) {
$this->classStack[] = $this->classLike;
@ -76,10 +73,7 @@ final class FunctionMethodAndClassNodeVisitor extends \PhpParser\NodeVisitorAbst
$node->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NODE, $this->classLike);
$node->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NAME, $this->className);
}
/**
* @param \PhpParser\Node $node
*/
private function processMethod($node) : void
private function processMethod(\PhpParser\Node $node) : void
{
if ($node instanceof \PhpParser\Node\Stmt\ClassMethod) {
$this->methodStack[] = $this->classMethod;
@ -87,10 +81,7 @@ final class FunctionMethodAndClassNodeVisitor extends \PhpParser\NodeVisitorAbst
}
$node->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE, $this->classMethod);
}
/**
* @param \PhpParser\Node\Stmt\ClassLike|null $classLike
*/
private function setClassNodeAndName($classLike) : void
private function setClassNodeAndName(?\PhpParser\Node\Stmt\ClassLike $classLike) : void
{
$this->classLike = $classLike;
if (!$classLike instanceof \PhpParser\Node\Stmt\ClassLike || $classLike->name === null) {

View File

@ -34,19 +34,13 @@ final class ClassRenamePhpDocNodeVisitor extends \RectorPrefix20210705\Symplify\
$this->staticTypeMapper = $staticTypeMapper;
$this->currentNodeProvider = $currentNodeProvider;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function beforeTraverse($node) : void
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void
{
if ($this->oldToNewTypes === []) {
throw new \Rector\Core\Exception\ShouldNotHappenException('Configure "$oldToNewClasses" first');
}
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode) {
return null;
@ -77,7 +71,7 @@ final class ClassRenamePhpDocNodeVisitor extends \RectorPrefix20210705\Symplify\
/**
* @param OldToNewType[] $oldToNewTypes
*/
public function setOldToNewTypes($oldToNewTypes) : void
public function setOldToNewTypes(array $oldToNewTypes) : void
{
$this->oldToNewTypes = $oldToNewTypes;
}

View File

@ -48,19 +48,13 @@ final class NameImportingPhpDocNodeVisitor extends \RectorPrefix20210705\Symplif
$this->classNameImportSkipper = $classNameImportSkipper;
$this->useNodesToAddCollector = $useNodesToAddCollector;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function beforeTraverse($node) : void
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void
{
if ($this->currentPhpParserNode === null) {
throw new \Rector\Core\Exception\ShouldNotHappenException('Set "$currentPhpParserNode" first');
}
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if ($node instanceof \Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode) {
return $this->enterSpacelessPhpDocTagNode($node);
@ -82,19 +76,11 @@ final class NameImportingPhpDocNodeVisitor extends \RectorPrefix20210705\Symplif
}
return $this->processFqnNameImport($this->currentPhpParserNode, $node, $staticType);
}
/**
* @param PhpParserNode $phpParserNode
*/
public function setCurrentNode($phpParserNode) : void
public function setCurrentNode(\PhpParser\Node $phpParserNode) : void
{
$this->currentPhpParserNode = $phpParserNode;
}
/**
* @param PhpParserNode $phpParserNode
* @param \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $identifierTypeNode
* @param \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType $fullyQualifiedObjectType
*/
private function processFqnNameImport($phpParserNode, $identifierTypeNode, $fullyQualifiedObjectType) : ?\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode
private function processFqnNameImport(\PhpParser\Node $phpParserNode, \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $identifierTypeNode, \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType $fullyQualifiedObjectType) : ?\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode
{
if ($this->classNameImportSkipper->shouldSkipNameForFullyQualifiedObjectType($phpParserNode, $fullyQualifiedObjectType)) {
return $identifierTypeNode;
@ -122,10 +108,7 @@ final class NameImportingPhpDocNodeVisitor extends \RectorPrefix20210705\Symplif
}
return $identifierTypeNode;
}
/**
* @param \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType $fullyQualifiedObjectType
*/
private function shouldSkipShortClassName($fullyQualifiedObjectType) : bool
private function shouldSkipShortClassName(\Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType $fullyQualifiedObjectType) : bool
{
$importShortClasses = $this->parameterProvider->provideBoolParameter(\Rector\Core\Configuration\Option::IMPORT_SHORT_CLASSES);
if ($importShortClasses) {
@ -133,10 +116,7 @@ final class NameImportingPhpDocNodeVisitor extends \RectorPrefix20210705\Symplif
}
return \substr_count($fullyQualifiedObjectType->getClassName(), '\\') === 0;
}
/**
* @param \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode
*/
private function processDoctrineAnnotationTagValueNode($doctrineAnnotationTagValueNode) : void
private function processDoctrineAnnotationTagValueNode(\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode) : void
{
$identifierTypeNode = $doctrineAnnotationTagValueNode->identifierTypeNode;
$staticType = $this->staticTypeMapper->mapPHPStanPhpDocTypeNodeToPHPStanType($identifierTypeNode, $this->currentPhpParserNode);
@ -155,9 +135,8 @@ final class NameImportingPhpDocNodeVisitor extends \RectorPrefix20210705\Symplif
}
/**
* @return \Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode|null
* @param \Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode $spacelessPhpDocTagNode
*/
private function enterSpacelessPhpDocTagNode($spacelessPhpDocTagNode)
private function enterSpacelessPhpDocTagNode(\Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode $spacelessPhpDocTagNode)
{
if (!$spacelessPhpDocTagNode->value instanceof \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode) {
return null;

View File

@ -29,10 +29,7 @@ final class UnderscoreRenamePhpDocNodeVisitor extends \RectorPrefix20210705\Symp
{
$this->staticTypeMapper = $staticTypeMapper;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function beforeTraverse($node) : void
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void
{
if ($this->pseudoNamespaceToNamespace === null) {
throw new \Rector\Core\Exception\ShouldNotHappenException('Set PseudoNamespaceToNamespace first');
@ -41,10 +38,7 @@ final class UnderscoreRenamePhpDocNodeVisitor extends \RectorPrefix20210705\Symp
throw new \Rector\Core\Exception\ShouldNotHappenException('Set "$currentPhpParserNode" first');
}
}
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode) {
return null;
@ -61,26 +55,15 @@ final class UnderscoreRenamePhpDocNodeVisitor extends \RectorPrefix20210705\Symp
$slashedName = '\\' . \RectorPrefix20210705\Nette\Utils\Strings::replace($staticType->getClassName(), '#_#', '\\');
return new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode($slashedName);
}
/**
* @param \Rector\Renaming\ValueObject\PseudoNamespaceToNamespace $pseudoNamespaceToNamespace
*/
public function setPseudoNamespaceToNamespace($pseudoNamespaceToNamespace) : void
public function setPseudoNamespaceToNamespace(\Rector\Renaming\ValueObject\PseudoNamespaceToNamespace $pseudoNamespaceToNamespace) : void
{
$this->pseudoNamespaceToNamespace = $pseudoNamespaceToNamespace;
}
/**
* @param \PhpParser\Node $node
*/
public function setCurrentPhpParserNode($node) : void
public function setCurrentPhpParserNode(\PhpParser\Node $node) : void
{
$this->currentPhpParserNode = $node;
}
/**
* @param \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $identifierTypeNode
* @param \PhpParser\Node $phpParserNode
* @param \Rector\Renaming\ValueObject\PseudoNamespaceToNamespace $pseudoNamespaceToNamespace
*/
private function shouldSkip($identifierTypeNode, $phpParserNode, $pseudoNamespaceToNamespace) : bool
private function shouldSkip(\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $identifierTypeNode, \PhpParser\Node $phpParserNode, \Rector\Renaming\ValueObject\PseudoNamespaceToNamespace $pseudoNamespaceToNamespace) : bool
{
$staticType = $this->staticTypeMapper->mapPHPStanPhpDocTypeNodeToPHPStanType($identifierTypeNode, $phpParserNode);
if (!$staticType instanceof \PHPStan\Type\ObjectType) {

View File

@ -100,11 +100,7 @@ final class ArrayTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
{
return new \PhpParser\Node\Name('array');
}
/**
* @param \PHPStan\Type\UnionType $unionType
* @param \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind
*/
private function createArrayTypeNodeFromUnionType($unionType, $typeKind) : \Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode
private function createArrayTypeNodeFromUnionType(\PHPStan\Type\UnionType $unionType, \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind) : \Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode
{
$unionedArrayType = [];
foreach ($unionType->getTypes() as $unionedType) {
@ -118,10 +114,7 @@ final class ArrayTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
$arrayType = \array_shift($unionedArrayType);
return new \Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode($arrayType);
}
/**
* @param \PHPStan\Type\ArrayType $arrayType
*/
private function isGenericArrayCandidate($arrayType) : bool
private function isGenericArrayCandidate(\PHPStan\Type\ArrayType $arrayType) : bool
{
if ($arrayType->getKeyType() instanceof \PHPStan\Type\MixedType) {
return \false;
@ -151,12 +144,7 @@ final class ArrayTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
}
return \false;
}
/**
* @param \PHPStan\Type\ArrayType $arrayType
* @param \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind
* @param bool $withKey
*/
private function createGenericArrayType($arrayType, $typeKind, $withKey = \false) : \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode
private function createGenericArrayType(\PHPStan\Type\ArrayType $arrayType, \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind, bool $withKey = \false) : \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode
{
$itemTypeNode = $this->phpStanStaticTypeMapper->mapToPHPStanPhpDocTypeNode($arrayType->getItemType(), $typeKind);
$identifierTypeNode = new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode('array');
@ -178,22 +166,14 @@ final class ArrayTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
$identifierTypeNode->setAttribute(self::HAS_GENERIC_TYPE_PARENT, $withKey);
return new \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode($identifierTypeNode, $genericTypes);
}
/**
* @param \PHPStan\Type\ArrayType $arrayType
*/
private function isIntegerKeyAndNonNestedArray($arrayType) : bool
private function isIntegerKeyAndNonNestedArray(\PHPStan\Type\ArrayType $arrayType) : bool
{
if (!$arrayType->getKeyType() instanceof \PHPStan\Type\IntegerType) {
return \false;
}
return !$arrayType->getItemType() instanceof \PHPStan\Type\ArrayType;
}
/**
* @param \PHPStan\Type\ArrayType $arrayType
* @param \PHPStan\Type\Type $itemType
* @param \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind
*/
private function narrowConstantArrayTypeOfUnionType($arrayType, $itemType, $typeKind) : ?\PHPStan\PhpDocParser\Ast\Type\TypeNode
private function narrowConstantArrayTypeOfUnionType(\PHPStan\Type\ArrayType $arrayType, \PHPStan\Type\Type $itemType, \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind) : ?\PHPStan\PhpDocParser\Ast\Type\TypeNode
{
if ($arrayType instanceof \PHPStan\Type\Constant\ConstantArrayType && $itemType instanceof \PHPStan\Type\UnionType) {
$narrowedItemType = $this->unionTypeCommonTypeNarrower->narrowToSharedObjectType($itemType);
@ -208,11 +188,7 @@ final class ArrayTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
}
return null;
}
/**
* @param \PHPStan\Type\Generic\GenericClassStringType $genericClassStringType
* @param \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind
*/
private function createTypeNodeFromGenericClassStringType($genericClassStringType, $typeKind) : \PHPStan\PhpDocParser\Ast\Type\TypeNode
private function createTypeNodeFromGenericClassStringType(\PHPStan\Type\Generic\GenericClassStringType $genericClassStringType, \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind) : \PHPStan\PhpDocParser\Ast\Type\TypeNode
{
$genericType = $genericClassStringType->getGenericType();
if ($genericType instanceof \PHPStan\Type\ObjectType && !$this->reflectionProvider->hasClass($genericType->getClassName())) {
@ -221,10 +197,7 @@ final class ArrayTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
$itemTypeNode = $this->phpStanStaticTypeMapper->mapToPHPStanPhpDocTypeNode($genericClassStringType, $typeKind);
return new \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode(new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode('array'), [$itemTypeNode]);
}
/**
* @param \PHPStan\Type\ArrayType $arrayType
*/
private function isClassStringArrayType($arrayType) : bool
private function isClassStringArrayType(\PHPStan\Type\ArrayType $arrayType) : bool
{
if ($arrayType->getKeyType() instanceof \PHPStan\Type\MixedType) {
return $arrayType->getItemType() instanceof \PHPStan\Type\Generic\GenericClassStringType;

View File

@ -59,10 +59,7 @@ final class BooleanTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contrac
}
return new \PhpParser\Node\Name('bool');
}
/**
* @param \PHPStan\Type\Type $type
*/
private function isFalseBooleanTypeWithUnion($type) : bool
private function isFalseBooleanTypeWithUnion(\PHPStan\Type\Type $type) : bool
{
if (!$type instanceof \PHPStan\Type\Constant\ConstantBooleanType) {
return \false;

View File

@ -67,10 +67,7 @@ final class ClassStringTypeMapper implements \Rector\PHPStanStaticTypeMapper\Con
{
$this->phpStanStaticTypeMapper = $phpStanStaticTypeMapper;
}
/**
* @param string $classType
*/
private function normalizeType($classType) : string
private function normalizeType(string $classType) : string
{
if (\is_a($classType, \PhpParser\Node\Expr::class, \true)) {
return \PhpParser\Node\Expr::class;

View File

@ -60,10 +60,7 @@ final class IterableTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contra
{
return new \PhpParser\Node\Name('iterable');
}
/**
* @param \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode $unionTypeNode
*/
private function convertUnionArrayTypeNodesToArrayTypeOfUnionTypeNodes($unionTypeNode) : \Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode
private function convertUnionArrayTypeNodesToArrayTypeOfUnionTypeNodes(\PHPStan\PhpDocParser\Ast\Type\UnionTypeNode $unionTypeNode) : \Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode
{
$unionedArrayType = [];
foreach ($unionTypeNode->types as $unionedType) {

View File

@ -95,11 +95,7 @@ final class ObjectTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract
{
$this->phpStanStaticTypeMapper = $phpStanStaticTypeMapper;
}
/**
* @param \PHPStan\Type\Generic\GenericObjectType $genericObjectType
* @param \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind
*/
private function mapGenericObjectType($genericObjectType, $typeKind) : \PHPStan\PhpDocParser\Ast\Type\TypeNode
private function mapGenericObjectType(\PHPStan\Type\Generic\GenericObjectType $genericObjectType, \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind) : \PHPStan\PhpDocParser\Ast\Type\TypeNode
{
$name = $this->resolveGenericObjectTypeName($genericObjectType);
$identifierTypeNode = new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode($name);
@ -117,10 +113,7 @@ final class ObjectTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract
}
return new \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode($identifierTypeNode, $genericTypeNodes);
}
/**
* @param \PHPStan\Type\Generic\GenericObjectType $genericObjectType
*/
private function resolveGenericObjectTypeName($genericObjectType) : string
private function resolveGenericObjectTypeName(\PHPStan\Type\Generic\GenericObjectType $genericObjectType) : string
{
if ($genericObjectType instanceof \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedGenericObjectType) {
return '\\' . $genericObjectType->getClassName();

View File

@ -141,10 +141,7 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
}
return new \PhpParser\Node\NullableType($nullabledTypeNode);
}
/**
* @param \PHPStan\Type\UnionType $unionType
*/
private function shouldSkipIterable($unionType) : bool
private function shouldSkipIterable(\PHPStan\Type\UnionType $unionType) : bool
{
$unionTypeAnalysis = $this->unionTypeAnalyzer->analyseForNullableAndIterable($unionType);
if (!$unionTypeAnalysis instanceof \Rector\PHPStanStaticTypeMapper\ValueObject\UnionTypeAnalysis) {
@ -157,9 +154,8 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
}
/**
* @return \PhpParser\Node\Name|\PhpParser\Node\NullableType|null
* @param \PHPStan\Type\UnionType $unionType
*/
private function matchArrayTypes($unionType)
private function matchArrayTypes(\PHPStan\Type\UnionType $unionType)
{
$unionTypeAnalysis = $this->unionTypeAnalyzer->analyseForNullableAndIterable($unionType);
if (!$unionTypeAnalysis instanceof \Rector\PHPStanStaticTypeMapper\ValueObject\UnionTypeAnalysis) {
@ -171,10 +167,7 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
}
return new \PhpParser\Node\Name($type);
}
/**
* @param \PHPStan\Type\UnionType $unionType
*/
private function matchTypeForNullableUnionType($unionType) : ?\PHPStan\Type\Type
private function matchTypeForNullableUnionType(\PHPStan\Type\UnionType $unionType) : ?\PHPStan\Type\Type
{
if (\count($unionType->getTypes()) !== 2) {
return null;
@ -191,10 +184,8 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
}
/**
* @return Name|FullyQualified|PhpParserUnionType|null
* @param \PHPStan\Type\UnionType $unionType
* @param \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind
*/
private function matchTypeForUnionedObjectTypes($unionType, $typeKind) : ?\PhpParser\Node
private function matchTypeForUnionedObjectTypes(\PHPStan\Type\UnionType $unionType, \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind) : ?\PhpParser\Node
{
$phpParserUnionType = $this->matchPhpParserUnionType($unionType, $typeKind);
if ($phpParserUnionType !== null) {
@ -217,11 +208,7 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
}
return new \PhpParser\Node\Name\FullyQualified($compatibleObjectType->getClassName());
}
/**
* @param \PHPStan\Type\UnionType $unionType
* @param \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind
*/
private function matchPhpParserUnionType($unionType, $typeKind) : ?\PhpParser\Node\UnionType
private function matchPhpParserUnionType(\PHPStan\Type\UnionType $unionType, \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind $typeKind) : ?\PhpParser\Node\UnionType
{
if (!$this->phpVersionProvider->isAtLeastPhpVersion(\Rector\Core\ValueObject\PhpVersionFeature::UNION_TYPES)) {
return null;
@ -242,10 +229,7 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
$phpParserUnionedTypes = \array_unique($phpParserUnionedTypes);
return new \PhpParser\Node\UnionType($phpParserUnionedTypes);
}
/**
* @param \PHPStan\Type\UnionType $unionType
*/
private function resolveCompatibleObjectCandidate($unionType) : ?\PHPStan\Type\TypeWithClassName
private function resolveCompatibleObjectCandidate(\PHPStan\Type\UnionType $unionType) : ?\PHPStan\Type\TypeWithClassName
{
if ($this->doctrineTypeAnalyzer->isDoctrineCollectionWithIterableUnionType($unionType)) {
return new \PHPStan\Type\ObjectType('Doctrine\\Common\\Collections\\Collection');
@ -260,10 +244,7 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
// find least common denominator
return $this->unionTypeCommonTypeNarrower->narrowToSharedObjectType($unionType);
}
/**
* @param \PHPStan\Type\UnionType $unionType
*/
private function matchTwoObjectTypes($unionType) : ?\PHPStan\Type\TypeWithClassName
private function matchTwoObjectTypes(\PHPStan\Type\UnionType $unionType) : ?\PHPStan\Type\TypeWithClassName
{
/** @var TypeWithClassName $unionedType */
foreach ($unionType->getTypes() as $unionedType) {
@ -277,21 +258,14 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
}
return null;
}
/**
* @param \PHPStan\Type\TypeWithClassName $firstType
* @param \PHPStan\Type\TypeWithClassName $secondType
*/
private function areTypeWithClassNamesRelated($firstType, $secondType) : bool
private function areTypeWithClassNamesRelated(\PHPStan\Type\TypeWithClassName $firstType, \PHPStan\Type\TypeWithClassName $secondType) : bool
{
if ($firstType->accepts($secondType, \false)->yes()) {
return \true;
}
return $secondType->accepts($firstType, \false)->yes();
}
/**
* @param \PHPStan\Type\TypeWithClassName $typeWithClassName
*/
private function correctObjectType($typeWithClassName) : \PHPStan\Type\TypeWithClassName
private function correctObjectType(\PHPStan\Type\TypeWithClassName $typeWithClassName) : \PHPStan\Type\TypeWithClassName
{
if ($typeWithClassName->getClassName() === \PhpParser\NodeAbstract::class) {
return new \PHPStan\Type\ObjectType('PhpParser\\Node');
@ -301,10 +275,7 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
}
return $typeWithClassName;
}
/**
* @param \PHPStan\Type\UnionType $unionType
*/
private function isFalseBoolUnion($unionType) : bool
private function isFalseBoolUnion(\PHPStan\Type\UnionType $unionType) : bool
{
if (\count($unionType->getTypes()) !== 2) {
return \false;

View File

@ -129,10 +129,7 @@ final class NodesToAddCollector implements \Rector\PostRector\Contract\Collector
}
$this->rectorChangeCollector->notifyNodeFileInfo($positionNode);
}
/**
* @param \PhpParser\Node $node
*/
private function resolveNearestStmtPosition($node) : string
private function resolveNearestStmtPosition(\PhpParser\Node $node) : string
{
if ($node instanceof \PhpParser\Node\Stmt) {
return \spl_object_hash($node);

View File

@ -110,11 +110,7 @@ final class NodesToRemoveCollector implements \Rector\PostRector\Contract\Collec
{
unset($this->nodesToRemove[$key]);
}
/**
* @param \PhpParser\Node $node
* @param \PhpParser\Node $parentNode
*/
private function isUsedInArg($node, $parentNode) : bool
private function isUsedInArg(\PhpParser\Node $node, \PhpParser\Node $parentNode) : bool
{
if (!$node instanceof \PhpParser\Node\Param) {
return \false;
@ -137,10 +133,7 @@ final class NodesToRemoveCollector implements \Rector\PostRector\Contract\Collec
}
return \false;
}
/**
* @param \PhpParser\Node $node
*/
private function ensureIsNotPartOfChainMethodCall($node) : void
private function ensureIsNotPartOfChainMethodCall(\PhpParser\Node $node) : void
{
if (!$node instanceof \PhpParser\Node\Expr\MethodCall) {
return;

View File

@ -189,11 +189,7 @@ final class UseNodesToAddCollector implements \Rector\PostRector\Contract\Collec
$smartFileInfo = $file->getSmartFileInfo();
return $smartFileInfo->getRealPath();
}
/**
* @param string $filePath
* @param string $shortName
*/
private function isShortClassImported($filePath, $shortName) : bool
private function isShortClassImported(string $filePath, string $shortName) : bool
{
$fileUseImports = $this->useImportTypesInFilePath[$filePath] ?? [];
foreach ($fileUseImports as $fileUseImport) {

View File

@ -82,9 +82,8 @@ final class IdentifierTypeMapper implements \Rector\StaticTypeMapper\Contract\Ph
}
/**
* @return \PHPStan\Type\MixedType|\Rector\StaticTypeMapper\ValueObject\Type\SelfObjectType
* @param \PhpParser\Node $node
*/
private function mapSelf($node)
private function mapSelf(\PhpParser\Node $node)
{
/** @var string|null $className */
$className = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NAME);
@ -96,9 +95,8 @@ final class IdentifierTypeMapper implements \Rector\StaticTypeMapper\Contract\Ph
}
/**
* @return \Rector\StaticTypeMapper\ValueObject\Type\ParentStaticType|\PHPStan\Type\MixedType
* @param \PhpParser\Node $node
*/
private function mapParent($node)
private function mapParent(\PhpParser\Node $node)
{
$parentClassName = $this->parentClassScopeResolver->resolveParentClassName($node);
if ($parentClassName !== null) {
@ -108,9 +106,8 @@ final class IdentifierTypeMapper implements \Rector\StaticTypeMapper\Contract\Ph
}
/**
* @return \PHPStan\Type\MixedType|\PHPStan\Type\StaticType
* @param \PhpParser\Node $node
*/
private function mapStatic($node)
private function mapStatic(\PhpParser\Node $node)
{
/** @var string|null $className */
$className = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NAME);

View File

@ -32,11 +32,7 @@ final class FullyQualifiedNodeMapper implements \Rector\StaticTypeMapper\Contrac
}
return new \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType($fullyQualifiedName);
}
/**
* @param string $originalName
* @param string $fullyQualifiedName
*/
private function isAliasedName($originalName, $fullyQualifiedName) : bool
private function isAliasedName(string $originalName, string $fullyQualifiedName) : bool
{
if ($originalName === '') {
return \false;

View File

@ -56,10 +56,7 @@ final class NameNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParse
}
return $this->createScalarType($name);
}
/**
* @param string $name
*/
private function isExistingClass($name) : bool
private function isExistingClass(string $name) : bool
{
if ($this->reflectionProvider->hasClass($name)) {
return \true;
@ -70,10 +67,8 @@ final class NameNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParse
}
/**
* @return \PHPStan\Type\MixedType|\PHPStan\Type\StaticType|\PHPStan\Type\ThisType
* @param \PhpParser\Node\Name $name
* @param string $reference
*/
private function createClassReferenceType($name, $reference)
private function createClassReferenceType(\PhpParser\Node\Name $name, string $reference)
{
$className = $name->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NAME);
if ($className === null) {
@ -90,9 +85,8 @@ final class NameNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParse
}
/**
* @return \PHPStan\Type\ArrayType|\PHPStan\Type\IntegerType|\PHPStan\Type\FloatType|\PHPStan\Type\StringType|\PHPStan\Type\Constant\ConstantBooleanType|\PHPStan\Type\BooleanType|\PHPStan\Type\MixedType
* @param string $name
*/
private function createScalarType($name)
private function createScalarType(string $name)
{
if ($name === 'array') {
return new \PHPStan\Type\ArrayType(new \PHPStan\Type\MixedType(), new \PHPStan\Type\MixedType());

View File

@ -97,13 +97,7 @@ abstract class AbstractRectorTestCase extends \Rector\Testing\PHPUnit\AbstractTe
{
return \sys_get_temp_dir() . '/_temp_fixture_easy_testing';
}
/**
* @param \Symplify\SmartFileSystem\SmartFileInfo $originalFileInfo
* @param \Symplify\SmartFileSystem\SmartFileInfo $expectedFileInfo
* @param \Symplify\SmartFileSystem\SmartFileInfo $fixtureFileInfo
* @param bool $allowMatches
*/
private function doTestFileMatchesExpectedContent($originalFileInfo, $expectedFileInfo, $fixtureFileInfo, $allowMatches = \true) : void
private function doTestFileMatchesExpectedContent(\Symplify\SmartFileSystem\SmartFileInfo $originalFileInfo, \Symplify\SmartFileSystem\SmartFileInfo $expectedFileInfo, \Symplify\SmartFileSystem\SmartFileInfo $fixtureFileInfo, bool $allowMatches = \true) : void
{
$this->parameterProvider->changeParameter(\Rector\Core\Configuration\Option::SOURCE, [$originalFileInfo->getRealPath()]);
$changedContent = $this->processFileInfo($originalFileInfo);
@ -126,17 +120,11 @@ abstract class AbstractRectorTestCase extends \Rector\Testing\PHPUnit\AbstractTe
$this->assertStringMatchesFormat($contents, $changedContent, $relativeFilePathFromCwd);
}
}
/**
* @param string $string
*/
private function normalizeNewlines($string) : string
private function normalizeNewlines(string $string) : string
{
return \RectorPrefix20210705\Nette\Utils\Strings::replace($string, '#\\r\\n|\\r|\\n#', "\n");
}
/**
* @param \Symplify\SmartFileSystem\SmartFileInfo $fileInfo
*/
private function processFileInfo($fileInfo) : string
private function processFileInfo(\Symplify\SmartFileSystem\SmartFileInfo $fileInfo) : string
{
$this->dynamicSourceLocatorProvider->setFileInfo($fileInfo);
// needed for PHPStan, because the analyzed file is just created in /temp - need for trait and similar deps

View File

@ -60,7 +60,7 @@ abstract class AbstractTestCase extends \PHPUnit\Framework\TestCase
/**
* @param SmartFileInfo[] $configFileInfos
*/
private function createConfigsHash($configFileInfos) : string
private function createConfigsHash(array $configFileInfos) : string
{
$configHash = '';
foreach ($configFileInfos as $configFileInfo) {

View File

@ -76,10 +76,7 @@ final class ComposerFileProcessor implements \Rector\Core\Contract\Processor\Fil
{
return ['json'];
}
/**
* @param \Symplify\SmartFileSystem\SmartFileInfo $fileInfo
*/
private function isJsonInTests($fileInfo) : bool
private function isJsonInTests(\Symplify\SmartFileSystem\SmartFileInfo $fileInfo) : bool
{
if (!\Rector\Testing\PHPUnit\StaticPHPUnitEnvironment::isPHPUnitRun()) {
return \false;

View File

@ -69,10 +69,7 @@ abstract class AbstractRootExpr implements \Rector\Defluent\Contract\ValueObject
$assignExpr = $currentMethodCall;
return $this->createAssign($assignVar, $assignExpr);
}
/**
* @param \PhpParser\Node\Expr\MethodCall $currentMethodCall
*/
private function resolveLastMethodCall($currentMethodCall) : \PhpParser\Node\Expr\MethodCall
private function resolveLastMethodCall(\PhpParser\Node\Expr\MethodCall $currentMethodCall) : \PhpParser\Node\Expr\MethodCall
{
while ($currentMethodCall->var instanceof \PhpParser\Node\Expr\MethodCall) {
$currentMethodCall = $currentMethodCall->var;

View File

@ -105,6 +105,9 @@ CODE_SAMPLE
return null;
}
}
if ($node->isPrivate()) {
return null;
}
if ($this->skipClassMethod($node)) {
return null;
}

View File

@ -38,10 +38,7 @@ final class DateTimeAtNamingConventionGuard implements \Rector\Naming\Contract\G
{
return $this->isDateTimeAtNamingConvention($renameValueObject);
}
/**
* @param \Rector\Naming\ValueObject\PropertyRename $propertyRename
*/
private function isDateTimeAtNamingConvention($propertyRename) : bool
private function isDateTimeAtNamingConvention(\Rector\Naming\ValueObject\PropertyRename $propertyRename) : bool
{
$type = $this->nodeTypeResolver->resolve($propertyRename->getProperty());
$type = $this->typeUnwrapper->unwrapFirstObjectTypeFromUnionType($type);

View File

@ -42,10 +42,8 @@ final class PSR4NamespaceMatcher implements \Rector\PSR4\Contract\PSR4AutoloadNa
}
/**
* Get the extra path that is not included in root PSR-4 namespace
* @param \Symplify\SmartFileSystem\SmartFileInfo $smartFileInfo
* @param string $path
*/
private function resolveExtraNamespace($smartFileInfo, $path) : string
private function resolveExtraNamespace(\Symplify\SmartFileSystem\SmartFileInfo $smartFileInfo, string $path) : string
{
$extraNamespace = \RectorPrefix20210705\Nette\Utils\Strings::substring($smartFileInfo->getRelativeDirectoryPath(), \RectorPrefix20210705\Nette\Utils\Strings::length($path) + 1);
$extraNamespace = \RectorPrefix20210705\Nette\Utils\Strings::replace($extraNamespace, '#/#', '\\');

View File

@ -52,17 +52,15 @@ final class FunctionLikeDocParamTypeInferer implements \Rector\TypeDeclaration\C
}
/**
* @return ClassMethod|Function_|null
* @param \PhpParser\Node\Param $param
*/
private function resolveScopeNode($param) : ?\PhpParser\Node
private function resolveScopeNode(\PhpParser\Node\Param $param) : ?\PhpParser\Node
{
return $this->betterNodeFinder->findParentTypes($param, [\PhpParser\Node\Stmt\ClassMethod::class, \PhpParser\Node\Stmt\Function_::class]);
}
/**
* @param Type[] $paramWithTypes
* @param \PhpParser\Node\Param $param
*/
private function matchParamNodeFromDoc($paramWithTypes, $param) : \PHPStan\Type\Type
private function matchParamNodeFromDoc(array $paramWithTypes, \PhpParser\Node\Param $param) : \PHPStan\Type\Type
{
$paramNodeName = '$' . $this->nodeNameResolver->getName($param->var);
return $paramWithTypes[$paramNodeName] ?? new \PHPStan\Type\MixedType();

View File

@ -86,10 +86,7 @@ final class PHPUnitDataProviderParamTypeInferer implements \Rector\TypeDeclarati
$yields = $this->betterNodeFinder->findInstanceOf((array) $dataProviderClassMethod->stmts, \PhpParser\Node\Expr\Yield_::class);
return $this->resolveYieldStaticArrayTypeByParameterPosition($yields, $parameterPosition);
}
/**
* @param \PhpParser\Node\Param $param
*/
private function resolveDataProviderClassMethod($param) : ?\PhpParser\Node\Stmt\ClassMethod
private function resolveDataProviderClassMethod(\PhpParser\Node\Param $param) : ?\PhpParser\Node\Stmt\ClassMethod
{
$phpDocInfo = $this->getFunctionLikePhpDocInfo($param);
$phpDocTagNode = $phpDocInfo->getByName('@dataProvider');
@ -113,9 +110,8 @@ final class PHPUnitDataProviderParamTypeInferer implements \Rector\TypeDeclarati
}
/**
* @param Return_[] $returns
* @param int $parameterPosition
*/
private function resolveReturnStaticArrayTypeByParameterPosition($returns, $parameterPosition) : \PHPStan\Type\Type
private function resolveReturnStaticArrayTypeByParameterPosition(array $returns, int $parameterPosition) : \PHPStan\Type\Type
{
$firstReturnedExpr = $returns[0]->expr;
if (!$firstReturnedExpr instanceof \PhpParser\Node\Expr\Array_) {
@ -129,9 +125,8 @@ final class PHPUnitDataProviderParamTypeInferer implements \Rector\TypeDeclarati
}
/**
* @param Yield_[] $yields
* @param int $parameterPosition
*/
private function resolveYieldStaticArrayTypeByParameterPosition($yields, $parameterPosition) : \PHPStan\Type\Type
private function resolveYieldStaticArrayTypeByParameterPosition(array $yields, int $parameterPosition) : \PHPStan\Type\Type
{
$paramOnPositionTypes = [];
foreach ($yields as $yield) {
@ -156,9 +151,8 @@ final class PHPUnitDataProviderParamTypeInferer implements \Rector\TypeDeclarati
}
/**
* @return \PHPStan\Type\MixedType|\PHPStan\Type\Constant\ConstantArrayType
* @param \PhpParser\Node\Expr\Array_ $classMethodYieldArrayNode
*/
private function getTypeFromClassMethodYield($classMethodYieldArrayNode)
private function getTypeFromClassMethodYield(\PhpParser\Node\Expr\Array_ $classMethodYieldArrayNode)
{
$arrayTypes = $this->nodeTypeResolver->resolve($classMethodYieldArrayNode);
// impossible to resolve
@ -167,10 +161,7 @@ final class PHPUnitDataProviderParamTypeInferer implements \Rector\TypeDeclarati
}
return $arrayTypes;
}
/**
* @param \PhpParser\Node\Param $param
*/
private function getFunctionLikePhpDocInfo($param) : \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
private function getFunctionLikePhpDocInfo(\PhpParser\Node\Param $param) : \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
{
$parent = $param->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
if (!$parent instanceof \PhpParser\Node\FunctionLike) {
@ -180,10 +171,8 @@ final class PHPUnitDataProviderParamTypeInferer implements \Rector\TypeDeclarati
}
/**
* @return Type[]
* @param \PhpParser\Node\Expr\Array_ $array
* @param int $parameterPosition
*/
private function resolveParamOnPositionTypes($array, $parameterPosition) : array
private function resolveParamOnPositionTypes(\PhpParser\Node\Expr\Array_ $array, int $parameterPosition) : array
{
$paramOnPositionTypes = [];
foreach ($array->items as $singleDataProvidedSet) {

View File

@ -103,12 +103,7 @@ final class ConstructorPropertyTypeInferer implements \Rector\TypeDeclaration\Co
{
return 800;
}
/**
* @param \PhpParser\Node\Param $param
* @param \PhpParser\Node\Stmt\ClassMethod $classMethod
* @param string $propertyName
*/
private function resolveFromParamType($param, $classMethod, $propertyName) : \PHPStan\Type\Type
private function resolveFromParamType(\PhpParser\Node\Param $param, \PhpParser\Node\Stmt\ClassMethod $classMethod, string $propertyName) : \PHPStan\Type\Type
{
$type = $this->resolveParamTypeToPHPStanType($param);
if ($type instanceof \PHPStan\Type\MixedType) {
@ -126,10 +121,7 @@ final class ConstructorPropertyTypeInferer implements \Rector\TypeDeclaration\Co
}
return $this->typeFactory->createMixedPassedOrUnionType($types);
}
/**
* @param \PhpParser\Node\Param $param
*/
private function resolveParamTypeToPHPStanType($param) : \PHPStan\Type\Type
private function resolveParamTypeToPHPStanType(\PhpParser\Node\Param $param) : \PHPStan\Type\Type
{
if ($param->type === null) {
return new \PHPStan\Type\MixedType();
@ -149,11 +141,7 @@ final class ConstructorPropertyTypeInferer implements \Rector\TypeDeclaration\Co
}
return $this->staticTypeMapper->mapPhpParserNodePHPStanType($param->type);
}
/**
* @param \PhpParser\Node\Stmt\ClassMethod $classMethod
* @param string $propertyName
*/
private function getResolveParamStaticTypeAsPHPStanType($classMethod, $propertyName) : \PHPStan\Type\Type
private function getResolveParamStaticTypeAsPHPStanType(\PhpParser\Node\Stmt\ClassMethod $classMethod, string $propertyName) : \PHPStan\Type\Type
{
$paramStaticType = new \PHPStan\Type\ArrayType(new \PHPStan\Type\MixedType(), new \PHPStan\Type\MixedType());
$this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, function (\PhpParser\Node $node) use($propertyName, &$paramStaticType) : ?int {
@ -168,10 +156,7 @@ final class ConstructorPropertyTypeInferer implements \Rector\TypeDeclaration\Co
});
return $paramStaticType;
}
/**
* @param \PhpParser\Node\Param $param
*/
private function isParamNullable($param) : bool
private function isParamNullable(\PhpParser\Node\Param $param) : bool
{
if ($param->type instanceof \PhpParser\Node\NullableType) {
return \true;
@ -184,10 +169,7 @@ final class ConstructorPropertyTypeInferer implements \Rector\TypeDeclaration\Co
}
return \false;
}
/**
* @param \PhpParser\Node\Param $param
*/
private function resolveFullyQualifiedOrAliasedObjectType($param) : ?\PHPStan\Type\Type
private function resolveFullyQualifiedOrAliasedObjectType(\PhpParser\Node\Param $param) : ?\PHPStan\Type\Type
{
if ($param->type === null) {
return null;

View File

@ -67,11 +67,7 @@ final class DoctrineRelationPropertyTypeInferer implements \Rector\TypeDeclarati
{
return 2100;
}
/**
* @param \PhpParser\Node\Stmt\Property $property
* @param \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode
*/
private function processToManyRelation($property, $doctrineAnnotationTagValueNode) : \PHPStan\Type\Type
private function processToManyRelation(\PhpParser\Node\Stmt\Property $property, \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode) : \PHPStan\Type\Type
{
$types = [];
$targetEntity = $doctrineAnnotationTagValueNode->getValueWithoutQuotes('targetEntity');
@ -82,12 +78,7 @@ final class DoctrineRelationPropertyTypeInferer implements \Rector\TypeDeclarati
$types[] = new \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType(self::COLLECTION_TYPE);
return $this->typeFactory->createMixedPassedOrUnionType($types);
}
/**
* @param \PhpParser\Node\Stmt\Property $property
* @param \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode $toOneDoctrineAnnotationTagValueNode
* @param \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode|null $joinDoctrineAnnotationTagValueNode
*/
private function processToOneRelation($property, $toOneDoctrineAnnotationTagValueNode, $joinDoctrineAnnotationTagValueNode) : \PHPStan\Type\Type
private function processToOneRelation(\PhpParser\Node\Stmt\Property $property, \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode $toOneDoctrineAnnotationTagValueNode, ?\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode $joinDoctrineAnnotationTagValueNode) : \PHPStan\Type\Type
{
$targetEntity = $toOneDoctrineAnnotationTagValueNode->getValueWithoutQuotes('targetEntity');
if ($targetEntity === null) {
@ -105,10 +96,7 @@ final class DoctrineRelationPropertyTypeInferer implements \Rector\TypeDeclarati
}
return $this->typeFactory->createMixedPassedOrUnionType($types);
}
/**
* @param \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode|null $doctrineAnnotationTagValueNode
*/
private function shouldAddNullType($doctrineAnnotationTagValueNode) : bool
private function shouldAddNullType(?\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode) : bool
{
if ($doctrineAnnotationTagValueNode === null) {
return \true;

View File

@ -72,10 +72,7 @@ final class GetterPropertyTypeInferer implements \Rector\TypeDeclaration\Contrac
{
return 1700;
}
/**
* @param \PhpParser\Node\Stmt\ClassMethod $classMethod
*/
private function inferClassMethodReturnType($classMethod) : \PHPStan\Type\Type
private function inferClassMethodReturnType(\PhpParser\Node\Stmt\ClassMethod $classMethod) : \PHPStan\Type\Type
{
$returnTypeDeclarationType = $this->functionLikeReturnTypeResolver->resolveFunctionLikeReturnTypeToPHPStanType($classMethod);
if (!$returnTypeDeclarationType instanceof \PHPStan\Type\MixedType) {

View File

@ -67,11 +67,7 @@ final class SingleMethodAssignedNodePropertyTypeInferer implements \Rector\TypeD
{
return 750;
}
/**
* @param \PhpParser\Node\Stmt\ClassMethod $classMethod
* @param string $propertyName
*/
private function resolveAssignedNodeToProperty($classMethod, $propertyName) : ?\PhpParser\Node\Expr
private function resolveAssignedNodeToProperty(\PhpParser\Node\Stmt\ClassMethod $classMethod, string $propertyName) : ?\PhpParser\Node\Expr
{
$assignedNode = null;
$this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, function (\PhpParser\Node $node) use($propertyName, &$assignedNode) : ?int {

View File

@ -109,9 +109,8 @@ final class ReturnedNodesReturnTypeInferer implements \Rector\TypeDeclaration\Co
}
/**
* @return Return_[]
* @param \PhpParser\Node\FunctionLike $functionLike
*/
private function collectReturns($functionLike) : array
private function collectReturns(\PhpParser\Node\FunctionLike $functionLike) : array
{
$returns = [];
$this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $functionLike->getStmts(), function (\PhpParser\Node $node) use(&$returns) : ?int {
@ -129,10 +128,8 @@ final class ReturnedNodesReturnTypeInferer implements \Rector\TypeDeclaration\Co
}
/**
* @return \PHPStan\Type\VoidType|\PHPStan\Type\MixedType
* @param \PhpParser\Node\Stmt\ClassLike $classLike
* @param \PhpParser\Node\FunctionLike $functionLike
*/
private function resolveNoLocalReturnNodes($classLike, $functionLike)
private function resolveNoLocalReturnNodes(\PhpParser\Node\Stmt\ClassLike $classLike, \PhpParser\Node\FunctionLike $functionLike)
{
// void type
if (!$this->isAbstractMethod($classLike, $functionLike)) {
@ -140,11 +137,7 @@ final class ReturnedNodesReturnTypeInferer implements \Rector\TypeDeclaration\Co
}
return new \PHPStan\Type\MixedType();
}
/**
* @param \PhpParser\Node\Stmt\ClassLike $classLike
* @param \PhpParser\Node\FunctionLike $functionLike
*/
private function isAbstractMethod($classLike, $functionLike) : bool
private function isAbstractMethod(\PhpParser\Node\Stmt\ClassLike $classLike, \PhpParser\Node\FunctionLike $functionLike) : bool
{
if ($functionLike instanceof \PhpParser\Node\Stmt\ClassMethod && $functionLike->isAbstract()) {
return \true;
@ -154,11 +147,7 @@ final class ReturnedNodesReturnTypeInferer implements \Rector\TypeDeclaration\Co
}
return $classLike->isAbstract();
}
/**
* @param \PhpParser\Node\Stmt\Return_ $return
* @param \PhpParser\Node\FunctionLike $originalFunctionLike
*/
private function inferFromReturnedMethodCall($return, $originalFunctionLike) : \PHPStan\Type\Type
private function inferFromReturnedMethodCall(\PhpParser\Node\Stmt\Return_ $return, \PhpParser\Node\FunctionLike $originalFunctionLike) : \PHPStan\Type\Type
{
if (!$return->expr instanceof \PhpParser\Node\Expr\MethodCall) {
return new \PHPStan\Type\MixedType();
@ -169,10 +158,7 @@ final class ReturnedNodesReturnTypeInferer implements \Rector\TypeDeclaration\Co
}
return $this->resolveClassMethod($methodReflection, $originalFunctionLike);
}
/**
* @param \PHPStan\Type\Type $type
*/
private function isArrayTypeMixed($type) : bool
private function isArrayTypeMixed(\PHPStan\Type\Type $type) : bool
{
if (!$type instanceof \PHPStan\Type\ArrayType) {
return \false;
@ -182,12 +168,7 @@ final class ReturnedNodesReturnTypeInferer implements \Rector\TypeDeclaration\Co
}
return $type->getKeyType() instanceof \PHPStan\Type\MixedType;
}
/**
* @param \PHPStan\Type\Type $resolvedType
* @param \PhpParser\Node\Stmt\Return_ $return
* @param \PhpParser\Node\FunctionLike $functionLike
*/
private function correctWithNestedType($resolvedType, $return, $functionLike) : \PHPStan\Type\Type
private function correctWithNestedType(\PHPStan\Type\Type $resolvedType, \PhpParser\Node\Stmt\Return_ $return, \PhpParser\Node\FunctionLike $functionLike) : \PHPStan\Type\Type
{
if ($resolvedType instanceof \PHPStan\Type\MixedType || $this->isArrayTypeMixed($resolvedType)) {
$correctedType = $this->inferFromReturnedMethodCall($return, $functionLike);
@ -198,11 +179,7 @@ final class ReturnedNodesReturnTypeInferer implements \Rector\TypeDeclaration\Co
}
return $resolvedType;
}
/**
* @param \PHPStan\Reflection\MethodReflection $methodReflection
* @param \PhpParser\Node\FunctionLike $originalFunctionLike
*/
private function resolveClassMethod($methodReflection, $originalFunctionLike) : \PHPStan\Type\Type
private function resolveClassMethod(\PHPStan\Reflection\MethodReflection $methodReflection, \PhpParser\Node\FunctionLike $originalFunctionLike) : \PHPStan\Type\Type
{
$classMethod = $this->reflectionAstResolver->resolveClassMethodFromMethodReflection($methodReflection);
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {

View File

@ -73,9 +73,8 @@ final class YieldNodesReturnTypeInferer implements \Rector\TypeDeclaration\Contr
}
/**
* @return Yield_[]|YieldFrom[]
* @param \PhpParser\Node\FunctionLike $functionLike
*/
private function findCurrentScopeYieldNodes($functionLike) : array
private function findCurrentScopeYieldNodes(\PhpParser\Node\FunctionLike $functionLike) : array
{
$yieldNodes = [];
$this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $functionLike->getStmts(), function (\PhpParser\Node $node) use(&$yieldNodes) : ?int {

View File

@ -114,22 +114,14 @@ final class PhpFileProcessor implements \Rector\Core\Contract\Processor\FileProc
{
return ['php'];
}
/**
* @param \Rector\Core\ValueObject\Application\File $file
*/
private function refactorNodesWithRectors($file) : void
private function refactorNodesWithRectors(\Rector\Core\ValueObject\Application\File $file) : void
{
$this->currentFileProvider->setFile($file);
$this->tryCatchWrapper($file, function (\Rector\Core\ValueObject\Application\File $file) : void {
$this->fileProcessor->refactor($file);
}, \Rector\Core\Enum\ApplicationPhase::REFACTORING());
}
/**
* @param \Rector\Core\ValueObject\Application\File $file
* @param callable $callback
* @param \Rector\Core\Enum\ApplicationPhase $applicationPhase
*/
private function tryCatchWrapper($file, $callback, $applicationPhase) : void
private function tryCatchWrapper(\Rector\Core\ValueObject\Application\File $file, callable $callback, \Rector\Core\Enum\ApplicationPhase $applicationPhase) : void
{
$this->currentFileProvider->setFile($file);
$this->notifyPhase($file, $applicationPhase);
@ -157,11 +149,7 @@ final class PhpFileProcessor implements \Rector\Core\Contract\Processor\FileProc
$file->addRectorError($rectorError);
}
}
/**
* @param \Rector\Core\ValueObject\Application\File $file
* @param \Rector\Core\ValueObject\Configuration $configuration
*/
private function printFile($file, $configuration) : void
private function printFile(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void
{
$smartFileInfo = $file->getSmartFileInfo();
if ($this->removedAndAddedFilesCollector->isFileRemoved($smartFileInfo)) {
@ -172,11 +160,7 @@ final class PhpFileProcessor implements \Rector\Core\Contract\Processor\FileProc
$file->changeFileContent($newContent);
$this->fileDiffFileDecorator->decorate([$file]);
}
/**
* @param \Rector\Core\ValueObject\Application\File $file
* @param \Rector\Core\Enum\ApplicationPhase $applicationPhase
*/
private function notifyPhase($file, $applicationPhase) : void
private function notifyPhase(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\Enum\ApplicationPhase $applicationPhase) : void
{
if (!$this->symfonyStyle->isVerbose()) {
return;

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'e93a102b995b802999921b97e46c0975325a63ab';
public const PACKAGE_VERSION = '97ca45aadeb4d05cb23101b0f7b12f6a7befe97c';
/**
* @var string
*/
public const RELEASE_DATE = '2021-07-06 00:43:48';
public const RELEASE_DATE = '2021-07-06 00:57:20';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210705\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

View File

@ -69,10 +69,7 @@ final class InitCommand extends \RectorPrefix20210705\Symfony\Component\Console\
}
return \RectorPrefix20210705\Symplify\PackageBuilder\Console\ShellCode::SUCCESS;
}
/**
* @param string $templateType
*/
private function resolveTemplateFilePathByType($templateType) : string
private function resolveTemplateFilePathByType(string $templateType) : string
{
$rectorTemplateFilePath = null;
foreach ($this->templateResolvers as $templateResolver) {

View File

@ -156,20 +156,13 @@ final class ProcessCommand extends \RectorPrefix20210705\Symfony\Component\Conso
$this->changedFilesDetector->clear();
}
}
/**
* @param \Rector\Core\ValueObject\ProcessResult $processResult
*/
private function invalidateCacheChangedFiles($processResult) : void
private function invalidateCacheChangedFiles(\Rector\Core\ValueObject\ProcessResult $processResult) : void
{
foreach ($processResult->getChangedFileInfos() as $changedFileInfo) {
$this->changedFilesDetector->invalidateFile($changedFileInfo);
}
}
/**
* @param \Rector\Core\ValueObject\ProcessResult $processResult
* @param \Rector\Core\ValueObject\Configuration $configuration
*/
private function resolveReturnCode($processResult, $configuration) : int
private function resolveReturnCode(\Rector\Core\ValueObject\ProcessResult $processResult, \Rector\Core\ValueObject\Configuration $configuration) : int
{
// some errors were found → fail
if ($processResult->getErrors() !== []) {
@ -184,7 +177,7 @@ final class ProcessCommand extends \RectorPrefix20210705\Symfony\Component\Conso
/**
* @param File[] $files
*/
private function configurePHPStanNodeScopeResolver($files) : void
private function configurePHPStanNodeScopeResolver(array $files) : void
{
$filePaths = [];
foreach ($files as $file) {

View File

@ -55,10 +55,7 @@ final class ShowCommand extends \RectorPrefix20210705\Symfony\Component\Console\
$this->reportLoadedRectors($outputFormat);
return \RectorPrefix20210705\Symplify\PackageBuilder\Console\ShellCode::SUCCESS;
}
/**
* @param string $outputFormat
*/
private function reportLoadedRectors($outputFormat) : void
private function reportLoadedRectors(string $outputFormat) : void
{
$rectors = \array_filter($this->rectors, function (\Rector\Core\Contract\Rector\RectorInterface $rector) : bool {
return !$rector instanceof \Rector\PostRector\Contract\Rector\PostRectorInterface;

View File

@ -77,10 +77,7 @@ final class ConsoleApplication extends \RectorPrefix20210705\Symfony\Component\C
$this->addCustomOptions($defaultInputDefinition);
return $defaultInputDefinition;
}
/**
* @param \Symfony\Component\Console\Input\InputInterface $input
*/
private function getNewWorkingDir($input) : string
private function getNewWorkingDir(\RectorPrefix20210705\Symfony\Component\Console\Input\InputInterface $input) : string
{
$workingDir = $input->getParameterOption('--working-dir');
if ($workingDir !== \false && !\is_dir($workingDir)) {
@ -89,10 +86,7 @@ final class ConsoleApplication extends \RectorPrefix20210705\Symfony\Component\C
}
return (string) $workingDir;
}
/**
* @param \Symfony\Component\Console\Input\InputInterface $input
*/
private function shouldPrintMetaInformation($input) : bool
private function shouldPrintMetaInformation(\RectorPrefix20210705\Symfony\Component\Console\Input\InputInterface $input) : bool
{
$hasNoArguments = $input->getFirstArgument() === null;
if ($hasNoArguments) {
@ -105,19 +99,13 @@ final class ConsoleApplication extends \RectorPrefix20210705\Symfony\Component\C
$outputFormat = $input->getParameterOption(['-o', '--output-format']);
return $outputFormat === \Rector\ChangesReporting\Output\ConsoleOutputFormatter::NAME;
}
/**
* @param \Symfony\Component\Console\Input\InputDefinition $inputDefinition
*/
private function removeUnusedOptions($inputDefinition) : void
private function removeUnusedOptions(\RectorPrefix20210705\Symfony\Component\Console\Input\InputDefinition $inputDefinition) : void
{
$options = $inputDefinition->getOptions();
unset($options['quiet'], $options['no-interaction']);
$inputDefinition->setOptions($options);
}
/**
* @param \Symfony\Component\Console\Input\InputDefinition $inputDefinition
*/
private function addCustomOptions($inputDefinition) : void
private function addCustomOptions(\RectorPrefix20210705\Symfony\Component\Console\Input\InputDefinition $inputDefinition) : void
{
$inputDefinition->addOption(new \RectorPrefix20210705\Symfony\Component\Console\Input\InputOption(\Rector\Core\Configuration\Option::CONFIG, 'c', \RectorPrefix20210705\Symfony\Component\Console\Input\InputOption::VALUE_REQUIRED, 'Path to config file', $this->getDefaultConfigPath()));
$inputDefinition->addOption(new \RectorPrefix20210705\Symfony\Component\Console\Input\InputOption(\Rector\Core\Configuration\Option::DEBUG, null, \RectorPrefix20210705\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Enable debug verbosity (-vvv)'));

View File

@ -30,11 +30,7 @@ final class MergeImportedRectorConfigureCallValuesCompilerPass implements \Recto
$this->completeCollectedArguments($id, $definition);
}
}
/**
* @param string $serviceClass
* @param \Symfony\Component\DependencyInjection\Definition $definition
*/
private function completeCollectedArguments($serviceClass, $definition) : void
private function completeCollectedArguments(string $serviceClass, \RectorPrefix20210705\Symfony\Component\DependencyInjection\Definition $definition) : void
{
$configureCallValues = $this->configureCallValuesCollector->getConfigureCallValues($serviceClass);
if ($configureCallValues === []) {

View File

@ -31,9 +31,8 @@ final class RemoveSkippedRectorsCompilerPass implements \RectorPrefix20210705\Sy
}
/**
* @return string[]
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $containerBuilder
*/
private function resolveSkippedRectorClasses($containerBuilder) : array
private function resolveSkippedRectorClasses(\RectorPrefix20210705\Symfony\Component\DependencyInjection\ContainerBuilder $containerBuilder) : array
{
$skipParameters = (array) $containerBuilder->getParameter(\Rector\Core\Configuration\Option::SKIP);
return \array_filter($skipParameters, function ($element) : bool {

View File

@ -59,9 +59,8 @@ final class ConstantArrayTypeToCallReflectionResolver implements \Rector\Core\Co
}
/**
* @see https://github.com/phpstan/phpstan-src/blob/b1fd47bda2a7a7d25091197b125c0adf82af6757/src/Type/Constant/ConstantArrayType.php#L209
* @param \PHPStan\Type\Constant\ConstantArrayType $constantArrayType
*/
private function findTypeAndMethodName($constantArrayType) : ?\PHPStan\Type\Constant\ConstantArrayTypeAndMethod
private function findTypeAndMethodName(\PHPStan\Type\Constant\ConstantArrayType $constantArrayType) : ?\PHPStan\Type\Constant\ConstantArrayTypeAndMethod
{
if (!$this->areKeyTypesValid($constantArrayType)) {
return null;
@ -93,10 +92,7 @@ final class ConstantArrayTypeToCallReflectionResolver implements \Rector\Core\Co
}
return null;
}
/**
* @param \PHPStan\Type\Constant\ConstantArrayType $constantArrayType
*/
private function areKeyTypesValid($constantArrayType) : bool
private function areKeyTypesValid(\PHPStan\Type\Constant\ConstantArrayType $constantArrayType) : bool
{
$keyTypes = $constantArrayType->getKeyTypes();
if (\count($keyTypes) !== 2) {

View File

@ -363,7 +363,7 @@ final class BetterStandardPrinter extends \PhpParser\PrettyPrinter\Standard
* @param Node[] $stmts
* @return Node[]|mixed[]
*/
private function resolveNewStmts($stmts) : array
private function resolveNewStmts(array $stmts) : array
{
if (\count($stmts) === 1 && $stmts[0] instanceof \Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace) {
return $stmts[0]->stmts;
@ -373,7 +373,7 @@ final class BetterStandardPrinter extends \PhpParser\PrettyPrinter\Standard
/**
* @param array<Node|null> $nodes
*/
private function moveCommentsFromAttributeObjectToCommentsAttribute($nodes) : void
private function moveCommentsFromAttributeObjectToCommentsAttribute(array $nodes) : void
{
// move phpdoc from node to "comment" attribute
foreach ($nodes as $node) {
@ -386,7 +386,7 @@ final class BetterStandardPrinter extends \PhpParser\PrettyPrinter\Standard
/**
* @param Node[] $nodes
*/
private function containsNop($nodes) : bool
private function containsNop(array $nodes) : bool
{
foreach ($nodes as $node) {
if ($node instanceof \PhpParser\Node\Stmt\Nop) {
@ -395,11 +395,7 @@ final class BetterStandardPrinter extends \PhpParser\PrettyPrinter\Standard
}
return \false;
}
/**
* @param \PhpParser\Node\Scalar\String_ $string
* @param string $wrap
*/
private function wrapValueWith($string, $wrap) : string
private function wrapValueWith(\PhpParser\Node\Scalar\String_ $string, string $wrap) : string
{
return $wrap . $string->value . $wrap;
}

View File

@ -49,10 +49,7 @@ final class RenamedClassesSourceLocator implements \PHPStan\BetterReflection\Sou
{
return [];
}
/**
* @param string $oldClass
*/
private function createFakeReflectionClassFromClassName($oldClass) : \PHPStan\BetterReflection\Reflection\ReflectionClass
private function createFakeReflectionClassFromClassName(string $oldClass) : \PHPStan\BetterReflection\Reflection\ReflectionClass
{
$classBuilder = new \RectorPrefix20210705\Symplify\Astral\ValueObject\NodeBuilder\ClassBuilder($oldClass);
$class = $classBuilder->getNode();

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitd95323afd696e1609bd370dd38d47c9a::getLoader();
return ComposerAutoloaderInitdb62b621edd5783626e68c5fb2f60b44::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitd95323afd696e1609bd370dd38d47c9a
class ComposerAutoloaderInitdb62b621edd5783626e68c5fb2f60b44
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInitd95323afd696e1609bd370dd38d47c9a
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitd95323afd696e1609bd370dd38d47c9a', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitdb62b621edd5783626e68c5fb2f60b44', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInitd95323afd696e1609bd370dd38d47c9a', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitdb62b621edd5783626e68c5fb2f60b44', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitd95323afd696e1609bd370dd38d47c9a::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitdb62b621edd5783626e68c5fb2f60b44::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInitd95323afd696e1609bd370dd38d47c9a
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitd95323afd696e1609bd370dd38d47c9a::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitdb62b621edd5783626e68c5fb2f60b44::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequired95323afd696e1609bd370dd38d47c9a($fileIdentifier, $file);
composerRequiredb62b621edd5783626e68c5fb2f60b44($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequired95323afd696e1609bd370dd38d47c9a($fileIdentifier, $file)
function composerRequiredb62b621edd5783626e68c5fb2f60b44($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitd95323afd696e1609bd370dd38d47c9a
class ComposerStaticInitdb62b621edd5783626e68c5fb2f60b44
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3866,9 +3866,9 @@ class ComposerStaticInitd95323afd696e1609bd370dd38d47c9a
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitd95323afd696e1609bd370dd38d47c9a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd95323afd696e1609bd370dd38d47c9a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitd95323afd696e1609bd370dd38d47c9a::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitdb62b621edd5783626e68c5fb2f60b44::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitdb62b621edd5783626e68c5fb2f60b44::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitdb62b621edd5783626e68c5fb2f60b44::$classMap;
}, null, ClassLoader::class);
}

View File

@ -206,7 +206,7 @@ class MultiConstraint implements \RectorPrefix20210705\Composer\Semver\Constrain
*
* @phpstan-return array{0: list<ConstraintInterface>, 1: bool}|null
*/
private static function optimizeConstraints($constraints, $conjunctive)
private static function optimizeConstraints(array $constraints, $conjunctive)
{
// parse the two OR groups and if they are contiguous we collapse
// them into one constraint

View File

@ -244,9 +244,8 @@ class Intervals
* @param bool $stopOnFirstValidInterval
*
* @phpstan-return array{'numeric': Interval[], 'branches': array{'names': string[], 'exclude': bool}}
* @param \Composer\Semver\Constraint\ConstraintInterface $constraint
*/
private static function generateIntervals($constraint, $stopOnFirstValidInterval = \false)
private static function generateIntervals(\RectorPrefix20210705\Composer\Semver\Constraint\ConstraintInterface $constraint, $stopOnFirstValidInterval = \false)
{
if ($constraint instanceof \RectorPrefix20210705\Composer\Semver\Constraint\MatchAllConstraint) {
return array('numeric' => array(new \RectorPrefix20210705\Composer\Semver\Interval(\RectorPrefix20210705\Composer\Semver\Interval::fromZero(), \RectorPrefix20210705\Composer\Semver\Interval::untilPositiveInfinity())), 'branches' => \RectorPrefix20210705\Composer\Semver\Interval::anyDev());
@ -371,9 +370,8 @@ class Intervals
}
/**
* @phpstan-return array{'numeric': Interval[], 'branches': array{'names': string[], 'exclude': bool}}}
* @param \Composer\Semver\Constraint\Constraint $constraint
*/
private static function generateSingleConstraintIntervals($constraint)
private static function generateSingleConstraintIntervals(\RectorPrefix20210705\Composer\Semver\Constraint\Constraint $constraint)
{
$op = $constraint->getOperator();
// handle branch constraints first

View File

@ -78,7 +78,7 @@ class Semver
*
* @return string[]
*/
private static function usort($versions, $direction)
private static function usort(array $versions, $direction)
{
if (null === self::$versionParser) {
self::$versionParser = new \RectorPrefix20210705\Composer\Semver\VersionParser();

View File

@ -438,7 +438,7 @@ class VersionParser
*
* @phpstan-param string[] $matches
*/
private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
private function manipulateVersionString(array $matches, $position, $increment = 0, $pad = '0')
{
for ($i = 4; $i > 0; --$i) {
if ($i > $position) {

View File

@ -233,7 +233,7 @@ class XdebugHandler
*
* @param array $command
*/
private function doRestart($command)
private function doRestart(array $command)
{
$this->tryEnableSignals();
$this->notify(\RectorPrefix20210705\Composer\XdebugHandler\Status::RESTARTING, \implode(' ', $command));
@ -309,7 +309,7 @@ class XdebugHandler
*
* @return bool
*/
private function writeTmpIni($iniFiles, $tmpDir, &$error)
private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
{
if (!($this->tmpIni = @\tempnam($tmpDir, ''))) {
return \false;
@ -362,7 +362,7 @@ class XdebugHandler
*
* @return bool
*/
private function setEnvironment($scannedInis, $iniFiles)
private function setEnvironment($scannedInis, array $iniFiles)
{
$scanDir = \getenv('PHP_INI_SCAN_DIR');
$phprc = \getenv('PHPRC');
@ -398,7 +398,7 @@ class XdebugHandler
*
* @return string
*/
private function mergeLoadedConfig($loadedConfig, $iniConfig)
private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
{
$content = '';
foreach ($loadedConfig as $name => $value) {
@ -450,7 +450,7 @@ class XdebugHandler
*
* @param array $settings
*/
private function syncSettings($settings)
private function syncSettings(array $settings)
{
if (\false === \getenv($this->envOriginalInis)) {
// Called by another app, so make original inis available

View File

@ -85,7 +85,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
* @return void
* @throws ParseError
*/
private function parseToken($state) : void
private function parseToken(\RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParserState $state) : void
{
switch ($state->token()->getType()) {
case \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_OBJECT_IDENTIFIER:
@ -117,13 +117,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
throw new \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParseError(\sprintf('Unexpected token %s in line %d.', $state->token()->getType(), $state->token()->getLine()), 1403011202, $state->token()->getLine());
}
}
/**
* @param bool $condition
* @param string $message
* @param int $code
* @param int $line
*/
private function triggerParseErrorIf($condition, $message, $code, $line) : void
private function triggerParseErrorIf(bool $condition, string $message, int $code, int $line) : void
{
if ($condition) {
throw new \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParseError($message, $code, $line);
@ -135,7 +129,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
* @return void
* @throws ParseError
*/
private function parseNestedStatements($state, $startLine = null) : void
private function parseNestedStatements(\RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParserState $state, ?int $startLine = null) : void
{
$startLine = $startLine ?: $state->token()->getLine();
$statements = new \ArrayObject();
@ -162,7 +156,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
* @param ParserState $state
* @throws ParseError
*/
private function parseCondition($state) : void
private function parseCondition(\RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParserState $state) : void
{
if ($state->context()->depth() !== 0) {
throw new \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParseError('Found condition statement inside nested assignment.', 1403011203, $state->token()->getLine());
@ -202,7 +196,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
/**
* @param ParserState $state
*/
private function parseInclude($state) : void
private function parseInclude(\RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParserState $state) : void
{
$token = $state->token();
$extensions = null;
@ -225,7 +219,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
* @return array
* @throws ParseError
*/
private function parseIncludeOptionals($optional, $token) : array
private function parseIncludeOptionals(string $optional, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface $token) : array
{
if (!\preg_match_all('/((?<key>[a-z]+)="(?<value>[^"]*)\\s*)+"/', $optional, $matches)) {
return [null, null];
@ -255,7 +249,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
* @param ParserState $state
* @throws ParseError
*/
private function parseValueOperation($state) : void
private function parseValueOperation(\RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParserState $state) : void
{
switch ($state->token(1)->getType()) {
case \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_OPERATOR_ASSIGNMENT:
@ -279,7 +273,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
/**
* @param ParserState $state
*/
private function parseAssignment($state) : void
private function parseAssignment(\RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParserState $state) : void
{
switch ($state->token(2)->getType()) {
case \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_OBJECT_CONSTRUCTOR:
@ -301,7 +295,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
* @param ParserState $state
* @throws ParseError
*/
private function parseCopyOrReference($state) : void
private function parseCopyOrReference(\RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParserState $state) : void
{
$targetToken = $state->token(2);
$this->validateCopyOperatorRightValue($targetToken);
@ -315,7 +309,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
* @param ParserState $state
* @throws ParseError
*/
private function parseModification($state) : void
private function parseModification(\RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParserState $state) : void
{
$token = $state->token(2);
$this->validateModifyOperatorRightValue($token);
@ -328,7 +322,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
* @param ParserState $state
* @throws ParseError
*/
private function parseDeletion($state) : void
private function parseDeletion(\RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParserState $state) : void
{
$allowedTypesInDeletion = [\RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_WHITESPACE, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_EMPTY_LINE, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_COMMENT_ONELINE];
if (!\in_array($state->token(2)->getType(), $allowedTypesInDeletion, \true)) {
@ -340,7 +334,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
/**
* @param ParserState $state
*/
private function parseMultilineAssigment($state) : void
private function parseMultilineAssigment(\RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParserState $state) : void
{
$state->statements()->append($this->builder->op()->assignment($state->context(), $this->builder->scalar($state->token(1)->getValue()), $state->token(1)->getLine()));
$state->next();
@ -349,7 +343,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
* @param TokenInterface $token
* @throws ParseError
*/
private function validateModifyOperatorRightValue($token) : void
private function validateModifyOperatorRightValue(\RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface $token) : void
{
if ($token->getType() !== \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_OBJECT_MODIFIER) {
throw new \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParseError('Unexpected token ' . $token->getType() . ' after modify operator.', 1403010294, $token->getLine());
@ -359,7 +353,7 @@ class Parser implements \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\Pa
* @param TokenInterface $token
* @throws ParseError
*/
private function validateCopyOperatorRightValue($token) : void
private function validateCopyOperatorRightValue(\RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface $token) : void
{
if ($token->getType() !== \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_OBJECT_IDENTIFIER) {
throw new \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\ParseError('Unexpected token ' . $token->getType() . ' after copy operator.', 1403010294, $token->getLine());

View File

@ -57,7 +57,7 @@ class PrettyPrinter implements \RectorPrefix20210705\Helmich\TypoScriptParser\Pa
* @param int $nesting
* @return void
*/
private function printStatementList($statements, $output, $nesting = 0) : void
private function printStatementList(array $statements, \RectorPrefix20210705\Symfony\Component\Console\Output\OutputInterface $output, int $nesting = 0) : void
{
$indent = $this->getIndent($nesting);
$count = \count($statements);
@ -88,19 +88,11 @@ class PrettyPrinter implements \RectorPrefix20210705\Helmich\TypoScriptParser\Pa
}
}
}
/**
* @param int $nesting
*/
private function getIndent($nesting) : string
private function getIndent(int $nesting) : string
{
return \str_repeat($this->prettyPrinterConfiguration->getIndentation(), $nesting);
}
/**
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Helmich\TypoScriptParser\Parser\AST\Operator\BinaryObjectOperator $operator
* @param int $nesting
*/
private function printBinaryObjectOperator($output, $operator, $nesting) : void
private function printBinaryObjectOperator(\RectorPrefix20210705\Symfony\Component\Console\Output\OutputInterface $output, \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\AST\Operator\BinaryObjectOperator $operator, int $nesting) : void
{
$targetObjectPath = $operator->target->relativeName;
if ($operator instanceof \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\AST\Operator\Copy) {
@ -109,11 +101,7 @@ class PrettyPrinter implements \RectorPrefix20210705\Helmich\TypoScriptParser\Pa
$output->writeln($this->getIndent($nesting) . $operator->object->relativeName . ' =< ' . $targetObjectPath);
}
}
/**
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Helmich\TypoScriptParser\Parser\AST\IncludeStatement $statement
*/
private function printIncludeStatement($output, $statement) : void
private function printIncludeStatement(\RectorPrefix20210705\Symfony\Component\Console\Output\OutputInterface $output, \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\AST\IncludeStatement $statement) : void
{
if ($statement instanceof \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\AST\FileIncludeStatement) {
$this->printFileIncludeStatement($output, $statement);
@ -121,11 +109,7 @@ class PrettyPrinter implements \RectorPrefix20210705\Helmich\TypoScriptParser\Pa
$this->printDirectoryIncludeStatement($output, $statement);
}
}
/**
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Helmich\TypoScriptParser\Parser\AST\FileIncludeStatement $statement
*/
private function printFileIncludeStatement($output, $statement) : void
private function printFileIncludeStatement(\RectorPrefix20210705\Symfony\Component\Console\Output\OutputInterface $output, \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\AST\FileIncludeStatement $statement) : void
{
if ($statement->newSyntax) {
$output->writeln('@import \'' . $statement->filename . '\'');
@ -137,11 +121,7 @@ class PrettyPrinter implements \RectorPrefix20210705\Helmich\TypoScriptParser\Pa
$output->writeln('<INCLUDE_TYPOSCRIPT: source="FILE:' . $statement->filename . '"' . $attributes . '>');
}
}
/**
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Helmich\TypoScriptParser\Parser\AST\DirectoryIncludeStatement $statement
*/
private function printDirectoryIncludeStatement($output, $statement) : void
private function printDirectoryIncludeStatement(\RectorPrefix20210705\Symfony\Component\Console\Output\OutputInterface $output, \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\AST\DirectoryIncludeStatement $statement) : void
{
$attributes = "";
if ($statement->extensions) {
@ -158,7 +138,7 @@ class PrettyPrinter implements \RectorPrefix20210705\Helmich\TypoScriptParser\Pa
* @param int $nesting
* @param NestedAssignment $statement
*/
private function printNestedAssignment($output, $nesting, $statement) : void
private function printNestedAssignment(\RectorPrefix20210705\Symfony\Component\Console\Output\OutputInterface $output, $nesting, \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\AST\NestedAssignment $statement) : void
{
$output->writeln($this->getIndent($nesting) . $statement->object->relativeName . ' {');
$this->printStatementList($statement->statements, $output, $nesting + 1);
@ -171,7 +151,7 @@ class PrettyPrinter implements \RectorPrefix20210705\Helmich\TypoScriptParser\Pa
* @param bool $hasNext
* @param bool $hasPrevious
*/
private function printConditionalStatement($output, $nesting, $statement, $hasNext = \false, $hasPrevious = \false) : void
private function printConditionalStatement(\RectorPrefix20210705\Symfony\Component\Console\Output\OutputInterface $output, int $nesting, \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\AST\ConditionalStatement $statement, bool $hasNext = \false, bool $hasPrevious = \false) : void
{
if (!$hasPrevious) {
$output->writeln('');
@ -191,7 +171,7 @@ class PrettyPrinter implements \RectorPrefix20210705\Helmich\TypoScriptParser\Pa
* @param Assignment $statement
* @param string $indent
*/
private function printAssignment($output, $statement, $indent) : void
private function printAssignment(\RectorPrefix20210705\Symfony\Component\Console\Output\OutputInterface $output, \RectorPrefix20210705\Helmich\TypoScriptParser\Parser\AST\Operator\Assignment $statement, string $indent) : void
{
if (\strpos($statement->value->value, "\n") !== \false) {
$output->writeln($indent . $statement->object->relativeName . ' (');
@ -201,19 +181,13 @@ class PrettyPrinter implements \RectorPrefix20210705\Helmich\TypoScriptParser\Pa
}
$output->writeln($indent . $statement->object->relativeName . ' = ' . $statement->value->value);
}
/**
* @param \Symfony\Component\Console\Output\OutputInterface $output
*/
private function printNopStatement($output) : void
private function printNopStatement(\RectorPrefix20210705\Symfony\Component\Console\Output\OutputInterface $output) : void
{
if ($this->prettyPrinterConfiguration->shouldIncludeEmptyLineBreaks()) {
$output->writeln('');
}
}
/**
* @param bool $hasNext
*/
private function closeCondition($hasNext) : bool
private function closeCondition(bool $hasNext) : bool
{
return !$hasNext || $this->prettyPrinterConfiguration->shouldAddClosingGlobal();
}

View File

@ -46,7 +46,7 @@ class Traverser
* @param Statement[] $statements
* @return Statement[]
*/
private function walkRecursive($statements) : array
private function walkRecursive(array $statements) : array
{
foreach ($statements as $statement) {
$this->visitors->enterNode($statement);

View File

@ -122,7 +122,7 @@ class Tokenizer implements \RectorPrefix20210705\Helmich\TypoScriptParser\Tokeni
* @return string
* @throws UnknownOperatorException
*/
private function getTokenTypeForBinaryOperator($operator) : string
private function getTokenTypeForBinaryOperator(string $operator) : string
{
switch ($operator) {
case '=':
@ -147,7 +147,7 @@ class Tokenizer implements \RectorPrefix20210705\Helmich\TypoScriptParser\Tokeni
* @param $currentLine
* @throws UnknownOperatorException
*/
private function tokenizeBinaryObjectOperation($tokens, $matches, $currentLine) : void
private function tokenizeBinaryObjectOperation(\RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenStreamBuilder $tokens, array $matches, int $currentLine) : void
{
$tokens->append($this->getTokenTypeForBinaryOperator($matches[3]), $matches[3], $currentLine);
if ($matches[4]) {
@ -180,7 +180,7 @@ class Tokenizer implements \RectorPrefix20210705\Helmich\TypoScriptParser\Tokeni
* @param ScannerLine $line
* @return bool
*/
private function tokenizeMultilineToken($tokens, $state, $line) : bool
private function tokenizeMultilineToken(\RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenStreamBuilder $tokens, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\MultilineTokenBuilder $state, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\ScannerLine $line) : bool
{
if ($state->currentTokenType() === \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_COMMENT_MULTILINE) {
$this->tokenizeMultilineComment($tokens, $state, $line);
@ -198,7 +198,7 @@ class Tokenizer implements \RectorPrefix20210705\Helmich\TypoScriptParser\Tokeni
* @param ScannerLine $line
* @return void
*/
private function tokenizeMultilineComment($tokens, $state, $line) : void
private function tokenizeMultilineComment(\RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenStreamBuilder $tokens, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\MultilineTokenBuilder $state, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\ScannerLine $line) : void
{
if ($matches = $line->scan(self::TOKEN_WHITESPACE)) {
$state->appendToToken($matches[0]);
@ -215,7 +215,7 @@ class Tokenizer implements \RectorPrefix20210705\Helmich\TypoScriptParser\Tokeni
* @param $state
* @param $line
*/
private function tokenizeMultilineAssignment($tokens, $state, $line) : void
private function tokenizeMultilineAssignment(\RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenStreamBuilder $tokens, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\MultilineTokenBuilder $state, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\ScannerLine $line) : void
{
if ($line->peek(',^\\s*\\),')) {
$token = $state->endMultilineToken();
@ -229,7 +229,7 @@ class Tokenizer implements \RectorPrefix20210705\Helmich\TypoScriptParser\Tokeni
* @param ScannerLine $line
* @return bool
*/
private function tokenizeSimpleStatements($tokens, $line) : bool
private function tokenizeSimpleStatements(\RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenStreamBuilder $tokens, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\ScannerLine $line) : bool
{
$simpleTokens = [self::TOKEN_COMMENT_ONELINE => \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_COMMENT_ONELINE, self::TOKEN_NESTING_END => \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_BRACE_CLOSE, self::TOKEN_CONDITION_ELSE => \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_CONDITION_ELSE, self::TOKEN_CONDITION_END => \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_CONDITION_END, self::TOKEN_CONDITION => \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_CONDITION, self::TOKEN_INCLUDE_STATEMENT => \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_INCLUDE, self::TOKEN_INCLUDE_NEW_STATEMENT => \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_INCLUDE_NEW];
foreach ($simpleTokens as $pattern => $type) {
@ -246,7 +246,7 @@ class Tokenizer implements \RectorPrefix20210705\Helmich\TypoScriptParser\Tokeni
* @param $line
* @return bool
*/
private function tokenizeObjectOperation($tokens, $state, $line) : bool
private function tokenizeObjectOperation(\RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenStreamBuilder $tokens, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\MultilineTokenBuilder $state, \RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\ScannerLine $line) : bool
{
if ($matches = $line->scan(self::TOKEN_OPERATOR_LINE)) {
$tokens->append(\RectorPrefix20210705\Helmich\TypoScriptParser\Tokenizer\TokenInterface::TYPE_OBJECT_IDENTIFIER, $matches[1], $line->index());

View File

@ -73,10 +73,7 @@ final class EditorConfigFile
}
return $configuration;
}
/**
* @param string $content
*/
private function parse($content) : void
private function parse(string $content) : void
{
$this->fileContent = $content;
$content = \preg_replace('/^\\s/m', '', $this->fileContent) ?? $this->fileContent;
@ -91,36 +88,26 @@ final class EditorConfigFile
$this->sections[] = new \RectorPrefix20210705\Idiosyncratic\EditorConfig\Section($this->getGlobPrefix($glob), $glob, $declarations, $this->declarationFactory);
}
}
/**
* @param string $isRoot
*/
private function setIsRoot($isRoot) : void
private function setIsRoot(string $isRoot) : void
{
if (\in_array($isRoot, ['true', 'false']) === \false) {
throw new \RectorPrefix20210705\Idiosyncratic\EditorConfig\Exception\InvalidValue('root', $isRoot);
}
$this->isRoot = $isRoot === 'true';
}
/**
* @param string $glob
*/
private function getGlobPrefix($glob) : string
private function getGlobPrefix(string $glob) : string
{
return \strpos($glob, '/') === 0 ? \dirname($this->path) : '**/';
}
/**
* @return array<string, mixed>
* @param string $content
*/
private function parseIniString($content) : array
private function parseIniString(string $content) : array
{
$parsedContent = \parse_ini_string($content, \true, \INI_SCANNER_RAW);
return \is_array($parsedContent) === \true ? $parsedContent : [];
}
/**
* @param string $path
*/
private function cleanContent($path) : string
private function cleanContent(string $path) : string
{
$content = \file_get_contents($path);
if ($content === \false) {

View File

@ -63,7 +63,7 @@ final class Section
/**
* @param array<string, mixed> $declarations
*/
private function setDeclarations($declarations) : void
private function setDeclarations(array $declarations) : void
{
foreach ($declarations as $name => $value) {
$this->setDeclaration($name, $value);
@ -71,9 +71,8 @@ final class Section
}
/**
* @param mixed $value
* @param string $name
*/
private function setDeclaration($name, $value) : void
private function setDeclaration(string $name, $value) : void
{
$declaration = $this->declarationFactory->getDeclaration($name, $value);
$this->declarations[$declaration->getName()] = $declaration;
@ -93,10 +92,7 @@ final class Section
{
return \array_key_exists($property, $this->declarations);
}
/**
* @param string $path
*/
private function matchesWithCurlBracesExpansion($path) : bool
private function matchesWithCurlBracesExpansion(string $path) : bool
{
\preg_match_all('#(?<prefix>.*){(?<subpattern>.*)}#', $this->glob, $matches, \PREG_SET_ORDER);
foreach ($matches as $match) {

View File

@ -531,11 +531,8 @@ class Image
/**
* Outputs image to browser or file.
* @throws ImageException
* @param int $type
* @param int|null $quality
* @param string|null $file
*/
private function output($type, $quality, $file = null) : void
private function output(int $type, ?int $quality, string $file = null) : void
{
switch ($type) {
case self::JPEG:

View File

@ -112,11 +112,7 @@ final class ObjectHelpers
}
return $best;
}
/**
* @param \ReflectionClass $rc
* @param string $pattern
*/
private static function parseFullDoc($rc, $pattern) : array
private static function parseFullDoc(\ReflectionClass $rc, string $pattern) : array
{
do {
$doc[] = $rc->getDocComment();

View File

@ -80,10 +80,8 @@ final class Reflection
/**
* @param \ReflectionFunction|\ReflectionMethod|\ReflectionParameter|\ReflectionProperty $reflection
* @return string|array|null
* @param \ReflectionType|null $type
* @param bool $asArray
*/
private static function getType($reflection, $type, $asArray = \false)
private static function getType($reflection, ?\ReflectionType $type, bool $asArray = \false)
{
if ($type === null) {
return $asArray ? [] : null;
@ -108,9 +106,8 @@ final class Reflection
}
/**
* @param \ReflectionFunction|\ReflectionMethod|\ReflectionParameter|\ReflectionProperty $reflection
* @param string $type
*/
private static function normalizeType($type, $reflection) : string
private static function normalizeType(string $type, $reflection) : string
{
$lower = \strtolower($type);
if ($reflection instanceof \ReflectionFunction) {
@ -268,10 +265,8 @@ final class Reflection
}
/**
* Parses PHP code to [class => [alias => class, ...]]
* @param string $code
* @param string|null $forClass
*/
private static function parseUseStatements($code, $forClass = null) : array
private static function parseUseStatements(string $code, string $forClass = null) : array
{
try {
$tokens = \token_get_all($code, \TOKEN_PARSE);
@ -341,10 +336,7 @@ final class Reflection
}
return $res;
}
/**
* @param mixed[] $tokens
*/
private static function fetch(&$tokens, $take) : ?string
private static function fetch(array &$tokens, $take) : ?string
{
$res = null;
while ($token = \current($tokens)) {

View File

@ -414,11 +414,8 @@ class Strings
}
/**
* Returns position in bytes of $nth occurence of $needle in $haystack or null if the needle was not found.
* @param string $haystack
* @param string $needle
* @param int $nth
*/
private static function pos($haystack, $needle, $nth = 1) : ?int
private static function pos(string $haystack, string $needle, int $nth = 1) : ?int
{
if (!$nth) {
return null;

View File

@ -199,7 +199,7 @@ class Comment implements \JsonSerializable
* @param string $str String to check
* @return int Length in characters. Tabs count as single characters.
*/
private function getShortestWhitespacePrefixLen($str) : int
private function getShortestWhitespacePrefixLen(string $str) : int
{
$lines = \explode("\n", $str);
$shortestPrefixLen = \INF;

View File

@ -94,10 +94,7 @@ class ConstExprEvaluator
{
return $this->evaluate($expr);
}
/**
* @param \PhpParser\Node\Expr $expr
*/
private function evaluate($expr)
private function evaluate(\PhpParser\Node\Expr $expr)
{
if ($expr instanceof \PhpParser\Node\Scalar\LNumber || $expr instanceof \PhpParser\Node\Scalar\DNumber || $expr instanceof \PhpParser\Node\Scalar\String_) {
return $expr->value;
@ -132,10 +129,7 @@ class ConstExprEvaluator
}
return ($this->fallbackEvaluator)($expr);
}
/**
* @param \PhpParser\Node\Expr\Array_ $expr
*/
private function evaluateArray($expr)
private function evaluateArray(\PhpParser\Node\Expr\Array_ $expr)
{
$array = [];
foreach ($expr->items as $item) {
@ -147,20 +141,14 @@ class ConstExprEvaluator
}
return $array;
}
/**
* @param \PhpParser\Node\Expr\Ternary $expr
*/
private function evaluateTernary($expr)
private function evaluateTernary(\PhpParser\Node\Expr\Ternary $expr)
{
if (null === $expr->if) {
return $this->evaluate($expr->cond) ?: $this->evaluate($expr->else);
}
return $this->evaluate($expr->cond) ? $this->evaluate($expr->if) : $this->evaluate($expr->else);
}
/**
* @param \PhpParser\Node\Expr\BinaryOp $expr
*/
private function evaluateBinaryOp($expr)
private function evaluateBinaryOp(\PhpParser\Node\Expr\BinaryOp $expr)
{
if ($expr instanceof \PhpParser\Node\Expr\BinaryOp\Coalesce && $expr->left instanceof \PhpParser\Node\Expr\ArrayDimFetch) {
// This needs to be special cased to respect BP_VAR_IS fetch semantics
@ -228,10 +216,7 @@ class ConstExprEvaluator
}
throw new \Exception('Should not happen');
}
/**
* @param \PhpParser\Node\Expr\ConstFetch $expr
*/
private function evaluateConstFetch($expr)
private function evaluateConstFetch(\PhpParser\Node\Expr\ConstFetch $expr)
{
$name = $expr->name->toLowerString();
switch ($name) {

View File

@ -146,7 +146,7 @@ class Error extends \RuntimeException
*
* @return int 1-based column (relative to start of line)
*/
private function toColumn($code, $pos) : int
private function toColumn(string $code, int $pos) : int
{
if ($pos > \strlen($code)) {
throw new \RuntimeException('Invalid position information');

View File

@ -51,11 +51,7 @@ class Differ
{
return $this->coalesceReplacements($this->diff($old, $new));
}
/**
* @param mixed[] $a
* @param mixed[] $b
*/
private function calculateTrace($a, $b)
private function calculateTrace(array $a, array $b)
{
$n = \count($a);
$m = \count($b);
@ -83,14 +79,7 @@ class Differ
}
throw new \Exception('Should not happen');
}
/**
* @param mixed[] $trace
* @param int $x
* @param int $y
* @param mixed[] $a
* @param mixed[] $b
*/
private function extractDiff($trace, $x, $y, $a, $b)
private function extractDiff(array $trace, int $x, int $y, array $a, array $b)
{
$result = [];
for ($d = \count($trace) - 1; $d >= 0; $d--) {
@ -128,7 +117,7 @@ class Differ
* @param DiffElem[] $diff
* @return DiffElem[]
*/
private function coalesceReplacements($diff)
private function coalesceReplacements(array $diff)
{
$newDiff = [];
$c = \count($diff);

View File

@ -31,10 +31,7 @@ class JsonDecoder
}
return $value;
}
/**
* @param mixed[] $array
*/
private function decodeArray($array) : array
private function decodeArray(array $array) : array
{
$decodedArray = [];
foreach ($array as $key => $value) {
@ -42,10 +39,7 @@ class JsonDecoder
}
return $decodedArray;
}
/**
* @param mixed[] $value
*/
private function decodeNode($value) : \PhpParser\Node
private function decodeNode(array $value) : \PhpParser\Node
{
$nodeType = $value['nodeType'];
if (!\is_string($nodeType)) {
@ -68,10 +62,7 @@ class JsonDecoder
}
return $node;
}
/**
* @param mixed[] $value
*/
private function decodeComment($value) : \PhpParser\Comment
private function decodeComment(array $value) : \PhpParser\Comment
{
$className = $value['nodeType'] === 'Comment' ? \PhpParser\Comment::class : \PhpParser\Comment\Doc::class;
if (!isset($value['text'])) {
@ -79,10 +70,7 @@ class JsonDecoder
}
return new $className($value['text'], $value['line'] ?? -1, $value['filePos'] ?? -1, $value['tokenPos'] ?? -1, $value['endLine'] ?? -1, $value['endFilePos'] ?? -1, $value['endTokenPos'] ?? -1);
}
/**
* @param string $nodeType
*/
private function reflectionClassFromNodeType($nodeType) : \ReflectionClass
private function reflectionClassFromNodeType(string $nodeType) : \ReflectionClass
{
if (!isset($this->reflectionClassCache[$nodeType])) {
$className = $this->classNameFromNodeType($nodeType);
@ -90,10 +78,7 @@ class JsonDecoder
}
return $this->reflectionClassCache[$nodeType];
}
/**
* @param string $nodeType
*/
private function classNameFromNodeType($nodeType) : string
private function classNameFromNodeType(string $nodeType) : string
{
$className = 'PhpParser\\Node\\' . \strtr($nodeType, '_', '\\');
if (\class_exists($className)) {

View File

@ -81,10 +81,7 @@ class Lexer
\ini_set('xdebug.scream', $scream);
}
}
/**
* @param \PhpParser\ErrorHandler $errorHandler
*/
private function handleInvalidCharacterRange($start, $end, $line, $errorHandler)
private function handleInvalidCharacterRange($start, $end, $line, \PhpParser\ErrorHandler $errorHandler)
{
$tokens = [];
for ($i = $start; $i < $end; $i++) {

View File

@ -85,17 +85,11 @@ class Emulative extends \PhpParser\Lexer
$this->tokens = $emulator->emulate($code, $this->tokens);
}
}
/**
* @param string $emulatorPhpVersion
*/
private function isForwardEmulationNeeded($emulatorPhpVersion) : bool
private function isForwardEmulationNeeded(string $emulatorPhpVersion) : bool
{
return \version_compare(\PHP_VERSION, $emulatorPhpVersion, '<') && \version_compare($this->targetPhpVersion, $emulatorPhpVersion, '>=');
}
/**
* @param string $emulatorPhpVersion
*/
private function isReverseEmulationNeeded($emulatorPhpVersion) : bool
private function isReverseEmulationNeeded(string $emulatorPhpVersion) : bool
{
return \version_compare(\PHP_VERSION, $emulatorPhpVersion, '>=') && \version_compare($this->targetPhpVersion, $emulatorPhpVersion, '<');
}
@ -183,7 +177,7 @@ class Emulative extends \PhpParser\Lexer
*
* @param Error[] $errors
*/
private function fixupErrors($errors)
private function fixupErrors(array $errors)
{
foreach ($errors as $error) {
$attrs = $error->getAttributes();

Some files were not shown because too many files have changed in this diff Show More