...
 
Commits (2)
......@@ -6,9 +6,10 @@ includes:
parameters:
ignoreErrors:
# We can fix this, but it's not our problem to fix and it's never called directly. We just want to just be
# We can fix these, but they aren't our problem to fix and it's never called directly. We just want to just be
# able to use inheritDoc here.
- '#Method [A-Za-z\\]+::jsonSerialize\(\) return type has no value type specified in iterable type array.#'
- '#Method [A-Za-z\\_]+::jsonSerialize\(\) return type has no value type specified in iterable type array.#'
- '#Method [A-Za-z\\_]+::getSubNodeNames\(\) return type has no value type specified in iterable type array.#'
-
message: '#Variable property access on#'
......
......@@ -17,7 +17,7 @@ interface ClasslikeInfoBuilderInterface
* @throws UnexpectedValueException
* @throws CircularDependencyException
*
* @return array
* @return array<string,mixed>
*/
public function build(string $fqcn): array;
}
......@@ -12,7 +12,7 @@ interface FunctionListProviderInterface
/**
* @throws RuntimeException
*
* @return array array<string, array> mapping FQCN's to functions.
* @return array<string,array<string, array>> mapping FQCN's to functions.
*/
public function getAll(): array;
}
......@@ -13,7 +13,7 @@ final class FunctionListRegistry implements FunctionListProviderInterface
private $delegate;
/**
* @var array|null
* @var array<string,array<string,mixed>>|null
*/
private $registry;
......@@ -34,7 +34,7 @@ final class FunctionListRegistry implements FunctionListProviderInterface
}
/**
* @param array $function
* @param array<string,mixed> $function
*/
public function add(array $function): void
{
......@@ -44,7 +44,7 @@ final class FunctionListRegistry implements FunctionListProviderInterface
}
/**
* @param array $function
* @param array<string,mixed> $function
*/
public function remove(array $function): void
{
......@@ -64,12 +64,14 @@ final class FunctionListRegistry implements FunctionListProviderInterface
}
/**
* @return array
* @return array<string,array<string,mixed>>
*/
private function getRegistry(): array
{
$this->initializeRegistryIfNecessary();
assert($this->registry !== null);
return $this->registry;
}
......
......@@ -69,7 +69,7 @@ final class NameNodeDefinitionLocator
*
* @throws UnexpectedValueException
*
* @return array
* @return array<string,mixed>
*/
private function getClassLikeInfo(string $fullyQualifiedName): array
{
......
......@@ -2,6 +2,7 @@
namespace Serenata\Highlights;
use PhpParser\Node;
use PhpParser\Error;
use PhpParser\Parser;
use PhpParser\ErrorHandler;
......@@ -80,7 +81,7 @@ final class DocumentHighlightsRetriever
*
* @throws Error
*
* @return array
* @return Node[]
*/
private function getNodes(string $code): array
{
......
......@@ -23,7 +23,7 @@ final class EventEmittingStorage implements StorageInterface, EventEmitterInterf
* By not immediately emitting events, we ensure that, for example, multiple persists of the same entity do not emit
* the same event multiple times to avoid costly recomputations caused by listeners.
*
* @var array
* @var array<string,array<string|mixed[]>> Should be a array<string,tuple<string,mixed[]>> actually.
*/
private $scheduledEvents = [];
......@@ -150,7 +150,10 @@ final class EventEmittingStorage implements StorageInterface, EventEmitterInterf
private function dispatchScheduledEvents(): void
{
foreach ($this->scheduledEvents as $scheduledEvent) {
$this->emit($scheduledEvent[0], $scheduledEvent[1]);
/** @var mixed[] $data */
$data = $scheduledEvent[1];
$this->emit($scheduledEvent[0], $data);
}
$this->clearScheduledEvents();
......
......@@ -4,6 +4,7 @@ namespace Serenata\Indexing;
use Iterator;
use Generator;
use SplFileInfo;
use IteratorIterator;
use IteratorAggregate;
......@@ -11,6 +12,8 @@ use Symfony\Component\Finder\Finder;
/**
* Iterator that iterates all indexable files for a path.
*
* @implements IteratorAggregate<SplFileInfo>
*/
final class IndexableFileIterator implements IteratorAggregate
{
......@@ -42,7 +45,7 @@ final class IndexableFileIterator implements IteratorAggregate
}
/**
* @inheritDoc
* @return Iterator<SplFileInfo>
*/
public function getIterator(): Iterator
{
......@@ -52,7 +55,7 @@ final class IndexableFileIterator implements IteratorAggregate
/**
* @param string $uri
*
* @return Generator
* @return Generator<SplFileInfo>
*/
private function iterate(string $uri): Generator
{
......
......@@ -19,8 +19,8 @@ final class ModificationTimeFilterIterator extends FilterIterator
private $fileModifiedMap;
/**
* @param Iterator $iterator
* @param Structures\File[] $filesInIndex
* @param Iterator<SplFileInfo> $iterator
* @param Structures\File[] $filesInIndex
*/
public function __construct(Iterator $iterator, array $filesInIndex)
{
......
......@@ -6,8 +6,10 @@ use DateTime;
use Exception;
use LogicException;
use PhpParser\Node;
use PhpParser\Error;
use PhpParser\Parser;
use PhpParser\NodeVisitor;
use PhpParser\ErrorHandler;
use PhpParser\NodeTraverser;
......@@ -148,7 +150,7 @@ final class StorageFileIndexer implements FileIndexerInterface
*
* @throws Error
*
* @return array
* @return Node\Stmt[]
*/
private function getNodes(string $code): array
{
......@@ -164,7 +166,7 @@ final class StorageFileIndexer implements FileIndexerInterface
}
/**
* @param array $nodes
* @param Node[] $nodes
* @param Structures\File $file
* @param TextDocumentItem $textDocumentItem
*
......@@ -200,7 +202,7 @@ final class StorageFileIndexer implements FileIndexerInterface
}
/**
* @param array $nodes
* @param Node[] $nodes
* @param Structures\File $file
* @param TextDocumentItem $textDocumentItem
*
......@@ -231,7 +233,7 @@ final class StorageFileIndexer implements FileIndexerInterface
* @param Structures\File $file
* @param TextDocumentItem $textDocumentItem
*
* @return array
* @return NodeVisitor[]
*/
private function getIndexingVisitors(Structures\File $file, TextDocumentItem $textDocumentItem): array
{
......
......@@ -59,12 +59,12 @@ class Class_ extends Classlike
private $traitFqcns;
/**
* @var ArrayCollection
* @var ArrayCollection<int,ClassTraitAlias>
*/
private $traitAliases;
/**
* @var ArrayCollection
* @var ArrayCollection<int,ClassTraitPrecedence>
*/
private $traitPrecedences;
......
......@@ -57,17 +57,17 @@ abstract class Classlike
protected $hasDocblock;
/**
* @var ArrayCollection
* @var ArrayCollection<int,ClassConstant>
*/
protected $constants;
/**
* @var ArrayCollection
* @var ArrayCollection<int,Property>
*/
protected $properties;
/**
* @var ArrayCollection
* @var ArrayCollection<int,Method>
*/
protected $methods;
......
......@@ -35,27 +35,27 @@ class File
private $indexedOn;
/**
* @var ArrayCollection
* @var ArrayCollection<int,Constant>
*/
private $constants;
/**
* @var ArrayCollection
* @var ArrayCollection<int,Function_>
*/
private $functions;
/**
* @var ArrayCollection
* @var ArrayCollection<int,Classlike>
*/
private $classlikes;
/**
* @var ArrayCollection
* @var ArrayCollection<int,FileNamespace>
*/
private $namespaces;
/**
* @var ArrayCollection
* @var ArrayCollection<int,MetaStaticMethodType>
*/
private $metaStaticMethodTypes;
......
......@@ -34,7 +34,7 @@ class FileNamespace
private $file;
/**
* @var ArrayCollection
* @var ArrayCollection<int,FileNamespaceImport>
*/
private $imports;
......
......@@ -27,12 +27,12 @@ class Trait_ extends Classlike
private $traitUserFqcns;
/**
* @var ArrayCollection
* @var ArrayCollection<int,TraitTraitAlias>
*/
private $traitAliases;
/**
* @var ArrayCollection
* @var ArrayCollection<int,TraitTraitPrecedence>
*/
private $traitPrecedences;
......@@ -99,8 +99,6 @@ class Trait_ extends Classlike
/**
* @param string $fqcn
*
* @return void
*/
public function addTraitFqcn(string $fqcn): void
{
......@@ -109,8 +107,6 @@ class Trait_ extends Classlike
/**
* @param Trait_ $trait
*
* @return void
*/
public function addTrait(Trait_ $trait): void
{
......@@ -137,8 +133,6 @@ class Trait_ extends Classlike
/**
* @param Class_|Trait_ $classlike
*
* @return void
*/
public function addTraitUser(Classlike $classlike): void
{
......@@ -165,8 +159,6 @@ class Trait_ extends Classlike
/**
* @param TraitTraitAlias $classlikeTraitAlias
*
* @return void
*/
public function addTraitAlias(TraitTraitAlias $classlikeTraitAlias): void
{
......@@ -183,8 +175,6 @@ class Trait_ extends Classlike
/**
* @param TraitTraitPrecedence $classlikeTraitPrecedence
*
* @return void
*/
public function addTraitPrecedence(TraitTraitPrecedence $classlikeTraitPrecedence): void
{
......
......@@ -22,7 +22,7 @@ final class TextDocumentContentRegistry
private $sourceCodeStreamReader;
/**
* @var array
* @var array<string,string>
*/
private $textDocumentContentsMap = [];
......
......@@ -29,7 +29,7 @@ use Serenata\DocblockTypeParser\SpecializedArrayDocblockType;
use Serenata\Indexing\Structures;
use Serenata\Indexing\StorageInterface;
use Serenata\Indexing\Structures\Classlike;
use Serenata\Indexing\Structures\AccessModifier;
use Serenata\Indexing\Structures\AccessModifierNameValue;
use Serenata\Parsing\DocblockParser;
......@@ -74,7 +74,7 @@ final class ClasslikeIndexingVisitor extends NodeVisitorAbstract
private $nodeTypeDeducer;
/**
* @var array|null
* @var array<string,AccessModifier>|null
*/
private $accessModifierMap;
......@@ -89,7 +89,7 @@ final class ClasslikeIndexingVisitor extends NodeVisitorAbstract
private $textDocumentItem;
/**
* @var Stack Stack<Structures\Classlike>
* @var Stack<Structures\Classlike>
*/
private $classlikeStack;
......@@ -1074,12 +1074,10 @@ final class ClasslikeIndexingVisitor extends NodeVisitorAbstract
}
/**
* @param array $rawData
* @param array<string,mixed> $rawData
* @param Structures\Classlike $classlike
* @param Structures\AccessModifier $accessModifier
* @param FilePosition $filePosition
*
* @return void
*/
private function indexMagicProperty(
array $rawData,
......@@ -1089,7 +1087,7 @@ final class ClasslikeIndexingVisitor extends NodeVisitorAbstract
): void {
$type = new MixedDocblockType();
if ($rawData['type']) {
if ($rawData['type'] !== null && $rawData['type'] !== '') {
$docblockType = $this->docblockTypeParser->parse($rawData['type']);
$type = $this->typeResolvingDocblockTypeTransformer->resolve($docblockType, $filePosition);
......@@ -1119,7 +1117,7 @@ final class ClasslikeIndexingVisitor extends NodeVisitorAbstract
}
/**
* @param array $rawData
* @param array<string,mixed> $rawData
* @param Structures\Classlike $classlike
* @param Structures\AccessModifier $accessModifier
* @param FilePosition $filePosition
......@@ -1134,7 +1132,7 @@ final class ClasslikeIndexingVisitor extends NodeVisitorAbstract
): void {
$returnType = new MixedDocblockType();
if ($rawData['type']) {
if ($rawData['type'] !== null && $rawData['type'] !== '') {
$docblockType = $this->docblockTypeParser->parse($rawData['type']);
$returnType = $this->typeResolvingDocblockTypeTransformer->resolve($docblockType, $filePosition);
......@@ -1216,8 +1214,6 @@ final class ClasslikeIndexingVisitor extends NodeVisitorAbstract
/**
* @param Structures\Classlike $classlike
*
* @return void
*/
private function indexClassKeyword(Structures\Classlike $classlike): void
{
......@@ -1243,7 +1239,7 @@ final class ClasslikeIndexingVisitor extends NodeVisitorAbstract
}
/**
* @return array
* @return array<string,AccessModifier>
*/
private function getAccessModifierMap(): array
{
......
......@@ -94,9 +94,7 @@ final class UseStatementIndexingVisitor implements NodeVisitor
}
/**
* @param array $namespace
*
* @return void
* @param array<string,mixed> $namespace
*/
private function indexNamespace(array $namespace): void
{
......@@ -115,10 +113,8 @@ final class UseStatementIndexingVisitor implements NodeVisitor
}
/**
* @param array $useStatement
* @param array<string,mixed> $useStatement
* @param Structures\FileNamespace $namespace
*
* @return void
*/
private function indexUseStatement(array $useStatement, Structures\FileNamespace $namespace): void
{
......
......@@ -39,17 +39,17 @@ final class Diagnostic implements JsonSerializable
private $message;
/**
* @var array|null
* @var array<array<string,mixed>>|null
*/
private $relatedInformation;
/**
* @param Range $range
* @param int|null $severity
* @param int|string|null $code
* @param string|null $source
* @param string $message
* @param array|null $relatedInformation
* @param Range $range
* @param int|null $severity
* @param int|string|null $code
* @param string|null $source
* @param string $message
* @param array<array<string,mixed>>|null $relatedInformation
*/
public function __construct(
Range $range,
......@@ -108,7 +108,7 @@ final class Diagnostic implements JsonSerializable
}
/**
* @return array|null
* @return array<array<string,mixed>>|null
*/
public function getRelatedInformation(): ?array
{
......
......@@ -29,7 +29,7 @@ final class Linter
/**
* @param string $code
*
* @return array
* @return Diagnostic[]
*/
public function lint(string $code): array
{
......
......@@ -2,6 +2,7 @@
namespace Serenata\Parsing;
use PhpParser\Node;
use PhpParser\Parser;
use PhpParser\ErrorHandler;
......@@ -19,7 +20,7 @@ final class CachingParser implements Parser
private $proxiedObject;
/**
* @var array|null
* @var Node\Stmt[]|null
*/
private $cache = null;
......
......@@ -140,10 +140,10 @@ final class DocblockParser
*
* @param string|false|null $docblock The docblock to parse. If null, the return array will be filled up with the
* correct keys, but they will be empty.
* @param array $filters Elements to search (see constants).
* @param string[] $filters Elements to search (see constants).
* @param string $itemName The name of the item (method, class, ...) the docblock is for.
*
* @return array
* @return array<string,mixed>
*/
public function parse($docblock, array $filters, string $itemName): array
{
......@@ -185,7 +185,13 @@ final class DocblockParser
foreach ($segments as $segment) {
[$tag, $start, $end] = $segment;
if (!$tag) {
if ($tag === null) {
continue;
}
assert(is_string($tag), 'Expected tag to be string');
if ($tag === '') {
continue;
} elseif (!isset($tags[$tag])) {
$tags[$tag] = [];
......@@ -422,13 +428,13 @@ final class DocblockParser
/**
* Filters out information about the return value of the function or method.
*
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable
*
* @return array
* @return array<string,mixed>
*/
private function filterReturn(?string $docblock, string $itemName, array $tags): array
{
......@@ -462,13 +468,13 @@ final class DocblockParser
/**
* Filters out information about the parameters of the function or method.
*
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable
*
* @return array
* @return array<string,mixed>
*/
private function filterParams(?string $docblock, string $itemName, array $tags): array
{
......@@ -516,13 +522,13 @@ final class DocblockParser
/**
* Filters out information about the variable.
*
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable
*
* @return array
* @return array<string,mixed>
*/
private function filterVar(?string $docblock, string $itemName, array $tags): array
{
......@@ -576,13 +582,13 @@ final class DocblockParser
/**
* Filters out deprecation information.
*
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable
*
* @return array
* @return array<string,mixed>
*/
private function filterDeprecated(?string $docblock, string $itemName, array $tags): array
{
......@@ -595,13 +601,13 @@ final class DocblockParser
/**
* Filters out information about what exceptions the method can throw.
*
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable
*
* @return array
* @return array<string,mixed>
*/
private function filterThrows(?string $docblock, string $itemName, array $tags): array
{
......@@ -629,13 +635,13 @@ final class DocblockParser
/**
* Filters out information about the magic methods of a class.
*
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable
*
* @return array
* @return array<string,mixed>
*/
private function filterMethod(?string $docblock, string $itemName, array $tags): array
{
......@@ -745,13 +751,13 @@ final class DocblockParser
/**
* Filters out information about the magic properties of a class.
*
* @param string $tagName
* @param string $keyName
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string $tagName
* @param string $keyName
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* @return array
* @return array<string,mixed>
*/
private function filterPropertyTag(
string $tagName,
......@@ -792,13 +798,13 @@ final class DocblockParser
/**
* Filters out information about the magic properties of a class.
*
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable -- since PHPCS thinks these methods are unused.
*
* @return array
* @return array<string,mixed>
*/
private function filterProperty(?string $docblock, string $itemName, array $tags): array
{
......@@ -809,13 +815,13 @@ final class DocblockParser
/**
* Filters out information about the magic properties of a class.
*
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable -- since PHPCS thinks these methods are unused.
*
* @return array
* @return array<string,mixed>
*/
private function filterPropertyRead(?string $docblock, string $itemName, array $tags): array
{
......@@ -826,13 +832,13 @@ final class DocblockParser
/**
* Filters out information about the magic properties of a class.
*
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable -- since PHPCS thinks these methods are unused.
*
* @return array
* @return array<string,mixed>
*/
private function filterPropertyWrite(?string $docblock, string $itemName, array $tags): array
{
......@@ -841,13 +847,13 @@ final class DocblockParser
}
/**
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable -- since PHPCS thinks these methods are unused.
*
* @return array
* @return array<string,mixed>
*/
private function filterCategory(?string $docblock, string $itemName, array $tags): array
{
......@@ -864,13 +870,13 @@ final class DocblockParser
}
/**
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable -- since PHPCS thinks these methods are unused.
*
* @return array
* @return array<string,mixed>
*/
private function filterSubpackage(?string $docblock, string $itemName, array $tags): array
{
......@@ -887,13 +893,13 @@ final class DocblockParser
}
/**
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable -- since PHPCS thinks these methods are unused.
*
* @return array
* @return array<string,mixed>
*/
private function filterLink(?string $docblock, string $itemName, array $tags): array
{
......@@ -919,13 +925,13 @@ final class DocblockParser
/**
* Filters out annotation information.
*
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable -- since PHPCS thinks these methods are unused.
*
* @return array
* @return array<string,mixed>
*/
private function filterAnnotation(?string $docblock, string $itemName, array $tags): array
{
......@@ -938,13 +944,13 @@ final class DocblockParser
/**
* Filters out information about the description.
*
* @param string|null $docblock
* @param string $itemName
* @param array $tags
* @param string|null $docblock
* @param string $itemName
* @param array<string,mixed> $tags
*
* phpcs:disable -- since PHPCS thinks these methods are unused.
*
* @return array
* @return array<string,mixed>
*/
private function filterDescription(?string $docblock, string $itemName, array $tags): array
{
......
......@@ -71,6 +71,7 @@ final class PartialParser implements Parser
};
$list = $this->tryParse($correctedExpression);
/** @var Node\Stmt[]|null $list We don't really return statements here, but it's fine for our purposes. */
$list = $isValid($list) ? $list : $this->tryParseWithKeywordCorrection($correctedExpression);
$list = $isValid($list) ? $list : $this->tryParseWithTrailingSemicolonCorrection($correctedExpression);
$list = $isValid($list) ? $list : $this->tryParseWithHeredocTerminationCorrection($correctedExpression);
......@@ -137,7 +138,7 @@ final class PartialParser implements Parser
/**
* @param string $code
*
* @return Node[]|null
* @return Node\Stmt[]|null
*/
private function tryParseWithTrailingSemicolonCorrection(string $code): ?array
{
......@@ -147,7 +148,7 @@ final class PartialParser implements Parser
/**
* @param string $code
*
* @return Node[]|null
* @return Node\Stmt[]|null
*/
private function tryParseWithHeredocTerminationCorrection(string $code): ?array
{
......@@ -157,7 +158,7 @@ final class PartialParser implements Parser
/**
* @param string $code
*
* @return array|null
* @return Node\Stmt[]|null
*/
private function tryParseWithFunctionTerminationCorrection(string $code): ?array
{
......@@ -167,7 +168,7 @@ final class PartialParser implements Parser
/**
* @param string $code
*
* @return array|null
* @return Node\Stmt[]|null
*/
private function tryParseWithFunctionMissingArgumentCorrection(string $code): ?array
{
......@@ -203,7 +204,7 @@ final class PartialParser implements Parser
/**
* @param string $code
*
* @return Node[]|null
* @return Node\Stmt[]|null
*/
private function tryParseWithTernaryOperatorTerminationCorrection(string $code): ?array
{
......@@ -219,13 +220,22 @@ final class PartialParser implements Parser
$traverser = new NodeTraverser();
$traverser->addVisitor(new class($dummyName) extends NodeVisitorAbstract {
/**
* @var string
*/
private $dummyName;
/**
* @param string $dummyName
*/
public function __construct(string $dummyName)
{
$this->dummyName = $dummyName;
}
/**
* @inheritDoc
*/
public function enterNode(Node $node)
{
if ($node instanceof Node\Expr\Ternary) {
......@@ -248,7 +258,7 @@ final class PartialParser implements Parser
/**
* @param string $code
*
* @return Node[]|null
* @return Node\Stmt[]|null
*/
private function tryParseWithDummyInsertion(string $code): ?array
{
......@@ -277,7 +287,7 @@ final class PartialParser implements Parser
/**
* @param string $code
*
* @return Node[]|null
* @return Node\Stmt[]|null
*/
private function tryParseWithDoubleArrowFix(string $code): ?array
{
......@@ -330,7 +340,7 @@ final class PartialParser implements Parser
/**
* @param string $code
*
* @return Node[]|null
* @return Node\Stmt[]|null
*/
private function tryParse(string $code): ?array
{
......
......@@ -40,7 +40,7 @@ final class FunctionParameterPrettyPrinter
}
/**
* @param array $parameter
* @param array<string,mixed> $parameter
*
* @return string
*/
......
......@@ -10,17 +10,17 @@ use PhpParser\PrettyPrinter;
final class NodePrettyPrinter extends PrettyPrinter\Standard
{
// phpcs:disable
public function parsing_Node_Keyword_Static()
public function parsing_Node_Keyword_Static(): string
{
return 'static';
}
public function parsing_Node_Keyword_Self()
public function parsing_Node_Keyword_Self(): string
{
return 'self';
}
public function parsing_Node_Keyword_Parent()
public function parsing_Node_Keyword_Parent(): string
{
return 'parent';
}
......
......@@ -8,7 +8,7 @@ namespace Serenata\PrettyPrinting;
final class ParameterNamePrettyPrinter
{
/**
* @param array $parameter
* @param array<string,mixed> $parameter
*
* @return string
*/
......
......@@ -329,8 +329,8 @@ final class SignatureHelpRetriever
}
/**
* @param array $functionInfo
* @param int $argumentIndex
* @param array<string,mixed> $functionInfo
* @param int $argumentIndex
*
* @throws UnexpectedValueException
*
......@@ -367,8 +367,8 @@ final class SignatureHelpRetriever
}
/**
* @param array $functionInfo
* @param int $argumentIndex
* @param array<string,mixed> $functionInfo
* @param int $argumentIndex
*
* @throws UnexpectedValueException
*
......@@ -396,7 +396,7 @@ final class SignatureHelpRetriever
}
/**
* @param array $parameters
* @param array<array<string,mixed>> $parameters
*
* @return ParameterInformation[]
*/
......@@ -412,7 +412,7 @@ final class SignatureHelpRetriever
}
/**
* @param array $parameter
* @param array<string,mixed> $parameter
*
* @return ParameterInformation
*/
......
......@@ -18,7 +18,7 @@ final class JsonRpcConnectionHandler implements JsonRpcMessageSenderInterface
protected const HEADER_DELIMITER = "\r\n";
/**
* @var array
* @var array<string,mixed>
*/
private $request;
......@@ -124,7 +124,7 @@ final class JsonRpcConnectionHandler implements JsonRpcMessageSenderInterface
$this->request['length'] = $contentLength;
$bytesRead = strlen($contentLengthHeader) + strlen(self::HEADER_DELIMITER);
} elseif (!$this->request['wasBoundaryFound']) {
} elseif ($this->request['wasBoundaryFound'] === false) {
$header = $this->readRawHeader($data);
if ($header === '') {
......
......@@ -63,7 +63,7 @@ final class JsonRpcError implements JsonSerializable
}
/**
* @param array $array
* @param array<string,mixed> $array
*
* @return static
*/
......
......@@ -16,7 +16,7 @@ final class JsonRpcQueue
private $jsonRpcRequestPriorityDeterminer;
/**
* @var Ds\PriorityQueue
* @var Ds\PriorityQueue<JsonRpcQueueItem>
*/
private $queue;
......
......@@ -199,7 +199,7 @@ final class JsonRpcQueueItemProcessor
/**
* @param Throwable $throwable
*
* @return Vector
* @return Vector<Throwable>
*/
private function getThrowableVector(Throwable $throwable): Vector
{
......
......@@ -30,15 +30,15 @@ final class JsonRpcRequest implements JsonRpcMessageInterface
private $method;
/**
* @var array|null
* @var array<string,mixed>|null
*/
private $params;
/**
* @param string|int|null $id
* @param string $method
* @param array|null $params
* @param string $jsonrpc The version.
* @param string|int|null $id
* @param string $method
* @param array<string,mixed>|null $params
* @param string $jsonrpc The version.
*/
public function __construct($id, string $method, ?array $params = null, string $jsonrpc = '2.0')
{
......@@ -83,7 +83,7 @@ final class JsonRpcRequest implements JsonRpcMessageInterface
}
/**
* @return array|null
* @return array<string,mixed>|null
*/
public function getParams(): ?array
{
......@@ -91,7 +91,7 @@ final class JsonRpcRequest implements JsonRpcMessageInterface
}
/**
* @param array $array
* @param array<string,mixed> $array
*
* @return static
*/
......
......@@ -76,7 +76,7 @@ final class JsonRpcResponse implements JsonRpcMessageInterface
}
/**
* @param array $array
* @param array<string,mixed> $array
*
* @return static
*/
......
......@@ -41,7 +41,7 @@ final class DocumentSymbolRetriever
/**
* @param File $file
*
* @return array
* @return array<string,mixed>
*/
private function getConstantSymbolsForFile(File $file): array
{
......@@ -53,7 +53,7 @@ final class DocumentSymbolRetriever
/**
* @param File $file
*
* @return array
* @return array<string,mixed>
*/
private function getFunctionSymbolsForFile(File $file): array
{
......@@ -65,7 +65,7 @@ final class DocumentSymbolRetriever
/**
* @param File $file
*
* @return array
* @return array<string,mixed>
*/
private function getClasslikeSymbolsForFile(File $file): array
{
......@@ -82,7 +82,7 @@ final class DocumentSymbolRetriever
* @param Classlike $classlike
* @param File $file
*
* @return array
* @return array<string,mixed>
*/
private function getMemberSymbolsForClasslike(Classlike $classlike, File $file): array
{
......@@ -215,9 +215,9 @@ final class DocumentSymbolRetriever
}
/**
* @param array $symbolList
* @param array<string,mixed> $symbolList
*
* @return array
* @return array<string,mixed>
*/
private function sortSymbolListByLocation(array $symbolList): array
{
......
......@@ -99,7 +99,7 @@ final class ClassConstFetchNodeTooltipGenerator
*
* @throws UnexpectedValueException
*
* @return array
* @return array<string,mixed>
*/
private function getClassTypes(
Node\Expr\ClassConstFetch $node,
......@@ -128,7 +128,7 @@ final class ClassConstFetchNodeTooltipGenerator
* @param string $classType
* @param string $name
*
* @return array|null
* @return array<string,mixed>|null
*/
private function fetchClassConstantInfo(string $classType, string $name): ?array
{
......
......@@ -10,7 +10,7 @@ use LogicException;
final class ClassLikeTooltipGenerator
{
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string
*/
......@@ -27,7 +27,7 @@ final class ClassLikeTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string
*/
......@@ -41,7 +41,7 @@ final class ClassLikeTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string|null
*/
......@@ -55,7 +55,7 @@ final class ClassLikeTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string
*/
......@@ -65,7 +65,7 @@ final class ClassLikeTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string
*/
......
......@@ -89,7 +89,7 @@ final class ClassMethodNodeTooltipGenerator
*
* @throws UnexpectedValueException
*
* @return array
* @return array<string,mixed>
*/
private function getMethodInfo(string $fqcn, string $method): array
{
......
......@@ -80,7 +80,7 @@ final class ConstFetchNodeTooltipGenerator
*
* @throws UnexpectedValueException
*
* @return array
* @return array<string,mixed>
*/
private function getConstantInfo(string $fullyQualifiedName): array
{
......
......@@ -21,7 +21,7 @@ final class ConstantTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string
*/
......@@ -37,7 +37,7 @@ final class ConstantTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string
*/
......@@ -51,7 +51,7 @@ final class ConstantTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string|null
*/
......@@ -65,7 +65,7 @@ final class ConstantTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string
*/
......
......@@ -12,7 +12,6 @@ use PhpParser\Node;
use Serenata\Common\Position;
use Serenata\Utility\TextDocumentItem;
/**
......@@ -78,7 +77,7 @@ final class FuncCallNodeTooltipGenerator
*
* @throws UnexpectedValueException
*
* @return array
* @return array<string,mixed>
*/
private function getFunctionInfo(string $fullyQualifiedName): array
{
......
......@@ -34,7 +34,7 @@ final class FunctionTooltipGenerator
}
/**
* @param array $functionInfo
* @param array<string,mixed> $functionInfo
*
* @return string
*/
......@@ -52,7 +52,7 @@ final class FunctionTooltipGenerator
}
/**
* @param array $functionInfo
* @param array<string,mixed> $functionInfo
*
* @return string
*/
......@@ -66,7 +66,7 @@ final class FunctionTooltipGenerator
}
/**
* @param array $functionInfo
* @param array<string,mixed> $functionInfo
*
* @return string|null
*/
......@@ -80,7 +80,7 @@ final class FunctionTooltipGenerator
}
/**
* @param array $functionInfo
* @param array<string,mixed> $functionInfo
*
* @return string|null
*/
......@@ -100,7 +100,7 @@ final class FunctionTooltipGenerator
}
/**
* @param array $parameter
* @param array<string,mixed> $parameter
*
* @return string
*/
......@@ -140,7 +140,7 @@ final class FunctionTooltipGenerator
}
/**
* @param array $functionInfo
* @param array<string,mixed> $functionInfo
*
* @return string
*/
......@@ -166,7 +166,7 @@ final class FunctionTooltipGenerator
}
/**
* @param array $functionInfo
* @param array<string,mixed> $functionInfo
*
* @return string|null
*/
......
......@@ -76,7 +76,7 @@ final class NameNodeTooltipGenerator
*
* @throws UnexpectedValueException
*
* @return array
* @return array<string,mixed>
*/
private function getClassLikeInfo(string $fullyQualifiedName): array
{
......
......@@ -21,7 +21,7 @@ final class PropertyTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string
*/
......@@ -37,7 +37,7 @@ final class PropertyTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string
*/
......@@ -51,7 +51,7 @@ final class PropertyTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string|null
*/
......@@ -65,7 +65,7 @@ final class PropertyTooltipGenerator
}
/**
* @param array $info
* @param array<string,mixed> $info
*
* @return string
*/
......
......@@ -66,7 +66,7 @@ final class ClassInfoJsonRpcQueueItemHandler extends AbstractJsonRpcQueueItemHan
/**
* @param string $fqcn
*
* @return array
* @return array<string,mixed>
*/
public function getClassInfo(string $fqcn): array
{
......
......@@ -74,7 +74,7 @@ final class ClassListJsonRpcQueueItemHandler extends AbstractJsonRpcQueueItemHan
}
/**
* @return array
* @return array<string,mixed>
*/
public function getAll(): array
{
......@@ -84,7 +84,7 @@ final class ClassListJsonRpcQueueItemHandler extends AbstractJsonRpcQueueItemHan
/**
* @param string $uri
*
* @return array
* @return array<string,mixed>
*/
public function getAllForFilePath(string $uri): array
{
......
......@@ -84,7 +84,7 @@ final class CompletionJsonRpcQueueItemHandler extends AbstractJsonRpcQueueItemHa
* @param string $code
* @param Position $position
*
* @return array
* @return array<string,mixed>
*/
public function getSuggestions(string $uri, string $code, Position $position): array
{
......
......@@ -59,7 +59,7 @@ final class DeduceTypesJsonRpcQueueItemHandler extends AbstractJsonRpcQueueItemH
throw new InvalidArgumentsException('"position" into the source must be supplied');
}
if (isset($arguments['stdin']) && $arguments['stdin']) {
if (isset($arguments['stdin']) && $arguments['stdin'] !== '') {
$code = $this->sourceCodeStreamReader->getSourceCodeFromStdin();
} else {
$code = $this->sourceCodeStreamReader->getSourceCodeFromFile($arguments['uri']);
......@@ -78,7 +78,7 @@ final class DeduceTypesJsonRpcQueueItemHandler extends AbstractJsonRpcQueueItemH
$code,
$codeWithExpression,
$position,
isset($arguments['ignore-last-element']) && $arguments['ignore-last-element']
isset($arguments['ignore-last-element']) && $arguments['ignore-last-element'] === true
);
$deferred = new Deferred();
......@@ -94,7 +94,7 @@ final class DeduceTypesJsonRpcQueueItemHandler extends AbstractJsonRpcQueueItemH
* @param Position $position
* @param bool $ignoreLastElement
*
* @return array
* @return array<string,mixed>
*/
public function deduceTypes(
string $uri,
......
......@@ -62,7 +62,7 @@ final class DidChangeWatchedFilesJsonRpcQueueItemHandler extends AbstractJsonRpc
}
/**
* @param array $parameters
* @param array<string,mixed> $parameters
*
* @return DidChangeWatchedFilesParams
*/
......@@ -72,7 +72,7 @@ final class DidChangeWatchedFilesJsonRpcQueueItemHandler extends AbstractJsonRpc
}
/**
* @param array $fileEvents
* @param array<string,mixed> $fileEvents
*
* @return FileEvent[]
*/
......
......@@ -72,7 +72,7 @@ final class DocumentHighlightJsonRpcQueueItemHandler extends AbstractJsonRpcQueu
* @param string $code
* @param Position $position
*
* @return array|null
* @return array<string,mixed>|null
*/
public function getAll(string $uri, string $code, Position $position): ?array
{
......
......@@ -42,7 +42,7 @@ final class GlobalConstantsJsonRpcQueueItemHandler extends AbstractJsonRpcQueueI
}
/**
* @return array
* @return array<string,mixed>
*/
public function getGlobalConstants(): array
{
......
......@@ -42,7 +42,7 @@ final class GlobalFunctionsJsonRpcQueueItemHandler extends AbstractJsonRpcQueueI
}
/**
* @return array
* @return array<string,mixed>
*/
public function getGlobalFunctions(): array
{
......
......@@ -136,7 +136,7 @@ final class InitializeJsonRpcQueueItemHandler extends AbstractJsonRpcQueueItemHa
}
/**
* @param array $params
* @param array<string,mixed> $params
*
* @return InitializeParams
*/
......@@ -313,7 +313,7 @@ final class InitializeJsonRpcQueueItemHandler extends AbstractJsonRpcQueueItemHa
/**
* @param string[] $uris
*
* @return array
* @return array<string,mixed>
*/
private function getDefaultProjectConfiguration(array $uris): array
{
......
......@@ -25,12 +25,12 @@ final class InitializeParams
private $rootUri;
/**
* @var array|null
* @var array<string,mixed>|null
*/
private $initializationOptions;
/**
* @var array
* @var array<string,mixed>
*/
private $capabilities;
......@@ -45,13 +45,13 @@ final class InitializeParams
private $workspaceFolders;
/**
* @param int|null $processId
* @param string|null $rootPath
* @param string|null $rootUri
* @param array|null $initializationOptions
* @param array $capabilities
* @param string|null $trace
* @param array[]|null $workspaceFolders
* @param int|null $processId
* @param string|null $rootPath
* @param string|null $rootUri
* @param array<string,mixed>|null $initializationOptions
* @param array<string,mixed> $capabilities
* @param string|null $trace
* @param array[]|null $workspaceFolders
*/
public function __construct(
?int $processId,
......@@ -96,7 +96,7 @@ final class InitializeParams
}
/**
* @return array|null
* @return array<string,mixed>|null
*/
public function getInitializationOptions(): ?array
{
......@@ -104,7 +104,7 @@ final class InitializeParams
}
/**
* @return array
* @return array<string,mixed>
*/
public function getCapabilities(): array
{
......