diff --git a/composer.json b/composer.json index f08bde5165c..30fefaeda0a 100644 --- a/composer.json +++ b/composer.json @@ -106,8 +106,8 @@ "psalter" ], "scripts": { - "cs": "phpcs -p", - "cs-fix": "phpcbf -p", + "cs": "phpcs -ps", + "cs-fix": "phpcbf -ps", "lint": "parallel-lint ./src ./tests", "phpunit": "paratest --runner=WrapperRunner", "phpunit-std": "phpunit", diff --git a/phpcs.xml b/phpcs.xml index fa2200f0d43..b539ffc6481 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -133,16 +133,16 @@ - - - + + + - - + + - + @@ -182,13 +182,6 @@ https://github.com/slevomat/coding-standard#slevomatcodingstandardtypehintsreturntypehint- --> - - - - - - - @@ -235,7 +228,7 @@ --> - @@ -246,7 +239,7 @@ - @@ -258,4 +251,17 @@ + + + + + + + + + + src/Psalm/Storage/Assertion/HasArrayKey\.php + src/Psalm/Storage/Assertion/IsNotCountable\.php + src/Psalm/Storage/Assertion/NonEmptyCountable\.php + diff --git a/src/Psalm/Aliases.php b/src/Psalm/Aliases.php index e112f956b88..526021c8a57 100644 --- a/src/Psalm/Aliases.php +++ b/src/Psalm/Aliases.php @@ -54,7 +54,6 @@ final class Aliases * @param array $functions_flipped * @param array $constants_flipped * @internal - * * @psalm-mutation-free */ public function __construct( diff --git a/src/Psalm/Codebase.php b/src/Psalm/Codebase.php index 3e9234fed7f..9af83cd0fa6 100644 --- a/src/Psalm/Codebase.php +++ b/src/Psalm/Codebase.php @@ -389,7 +389,6 @@ private function loadAnalyzer(): void /** * @param array $candidate_files - * */ public function reloadFiles(ProjectAnalyzer $project_analyzer, array $candidate_files): void { @@ -465,7 +464,6 @@ public function collectLocations(): void /** * @param 'always'|'auto' $find_unused_code - * */ public function reportUnusedCode(string $find_unused_code = 'auto'): void { @@ -483,7 +481,6 @@ public function reportUnusedVariables(): void /** * @param array $files_to_analyze - * */ public function addFilesToAnalyze(array $files_to_analyze): void { @@ -493,7 +490,6 @@ public function addFilesToAnalyze(array $files_to_analyze): void /** * Scans all files their related files - * */ public function scanFiles(int $threads = 1): void { @@ -606,7 +602,6 @@ public function findReferencesToProperty(string $property_id): array /** * @return CodeLocation[] - * * @psalm-return array */ public function findReferencesToClassLike(string $fq_class_name): array @@ -786,7 +781,6 @@ public function traitHasCorrectCasing(string $fq_trait_name): bool * a method, closure, or function. * * @param non-empty-string $function_id - * * @return FunctionStorage|MethodStorage */ public function getFunctionLikeStorage( @@ -838,7 +832,6 @@ public function methodExists( /** * @param string|MethodIdentifier $method_id - * * @return array */ public function getMethodParams($method_id): array @@ -848,7 +841,6 @@ public function getMethodParams($method_id): array /** * @param string|MethodIdentifier $method_id - * */ public function isVariadic($method_id): bool { @@ -858,7 +850,6 @@ public function isVariadic($method_id): bool /** * @param string|MethodIdentifier $method_id * @param list $call_args - * */ public function getMethodReturnType($method_id, ?string &$self_class, array $call_args = []): ?Union { @@ -872,7 +863,6 @@ public function getMethodReturnType($method_id, ?string &$self_class, array $cal /** * @param string|MethodIdentifier $method_id - * */ public function getMethodReturnsByRef($method_id): bool { @@ -881,8 +871,6 @@ public function getMethodReturnsByRef($method_id): bool /** * @param string|MethodIdentifier $method_id - * @param CodeLocation|null $defined_location - * */ public function getMethodReturnTypeLocation( $method_id, @@ -896,7 +884,6 @@ public function getMethodReturnTypeLocation( /** * @param string|MethodIdentifier $method_id - * */ public function getDeclaringMethodId($method_id): ?string { @@ -909,7 +896,6 @@ public function getDeclaringMethodId($method_id): ?string * Get the class this method appears in (vs is declared in, which could give a trait) * * @param string|MethodIdentifier $method_id - * */ public function getAppearingMethodId($method_id): ?string { @@ -920,7 +906,6 @@ public function getAppearingMethodId($method_id): ?string /** * @param string|MethodIdentifier $method_id - * * @return array */ public function getOverriddenMethodIds($method_id): array @@ -930,7 +915,6 @@ public function getOverriddenMethodIds($method_id): array /** * @param string|MethodIdentifier $method_id - * */ public function getCasedMethodId($method_id): string { @@ -986,8 +970,6 @@ public function getFunctionStorageForSymbol(string $file_path, string $symbol): } /** - * @param string $file_path - * @param string $symbol * @return array{ type: string, description?: string|null}|null */ public function getSymbolInformation(string $file_path, string $symbol): ?array @@ -1941,7 +1923,6 @@ public function queueClassLikeForScanning( /** * @param array $taints - * * @psalm-suppress PossiblyUnusedMethod */ public function addTaintSource( @@ -1969,7 +1950,6 @@ public function addTaintSource( /** * @param array $taints - * * @psalm-suppress PossiblyUnusedMethod */ public function addTaintSink( diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 0c633616c8d..0a4caf9256b 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -169,6 +169,7 @@ class Config /** * These are special object classes that allow any and all properties to be get/set on them + * * @var array */ protected $universal_object_crates; @@ -205,7 +206,6 @@ class Config * The directory to store PHP Parser (and other) caches * * @internal - * * @var string|null */ public $cache_directory; @@ -647,7 +647,6 @@ protected function __construct() * Searches up a folder hierarchy for the most immediate config. * * @throws ConfigException if a config path is not found - * */ public static function getConfigForPath(string $path, string $current_dir): Config { @@ -664,7 +663,6 @@ public static function getConfigForPath(string $path, string $current_dir): Conf * Searches up a folder hierarchy for the most immediate config. * * @throws ConfigException - * */ public static function locateConfigFile(string $path): ?string { @@ -730,9 +728,9 @@ public function computeHash(): string /** * Creates a new config object from an XML string + * * @param string|null $current_dir Current working directory, if different to $base_dir * @param non-empty-string $file_contents - * * @throws ConfigException */ public static function loadFromXML( @@ -771,7 +769,6 @@ private static function loadDomDocument(string $base_dir, string $file_contents) /** * @param non-empty-string $file_contents - * * @throws ConfigException */ private static function validateXmlConfig(string $base_dir, string $file_contents): void @@ -941,12 +938,10 @@ private static function processConfigDeprecations( /** * @param non-empty-string $file_contents - * * @psalm-suppress MixedMethodCall * @psalm-suppress MixedAssignment * @psalm-suppress MixedArgument * @psalm-suppress MixedPropertyFetch - * * @throws ConfigException */ private static function fromXmlAndPaths( @@ -1361,7 +1356,6 @@ public function setCustomErrorLevel(string $issue_key, string $error_level): voi /** * @throws ConfigException if a Config file could not be found - * */ private function loadFileExtensions(SimpleXMLElement $extensions): void { @@ -1559,9 +1553,7 @@ private static function requirePath(string $path): void /** * @template T - * * @param T::class $must_extend - * * @return class-string */ private function getPluginClassForPath(Codebase $codebase, string $path, string $must_extend): string diff --git a/src/Psalm/Context.php b/src/Psalm/Context.php index fc9d283c864..334c405f7b2 100644 --- a/src/Psalm/Context.php +++ b/src/Psalm/Context.php @@ -439,7 +439,6 @@ public function __destruct() * @param bool $has_leaving_statements whether or not the parent scope is abandoned between * $start_context and $end_context * @param array $updated_vars - * */ public function update( Context $start_context, @@ -513,7 +512,6 @@ public function updateReferencesPossiblyFromConfusingScope( /** * @param array $new_vars_in_scope - * * @return array */ public function getRedefinedVars(array $new_vars_in_scope, bool $include_new_vars = false): array @@ -636,9 +634,7 @@ public function decrementReferenceCount(string $ref_id): void /** * @param Clause[] $clauses * @param array $changed_var_ids - * * @return array{list, list} - * * @psalm-pure */ public static function removeReconciledClauses(array $clauses, array $changed_var_ids): array @@ -667,7 +663,6 @@ public static function removeReconciledClauses(array $clauses, array $changed_va /** * @param Clause[] $clauses - * * @return list */ public static function filterClauses( diff --git a/src/Psalm/ErrorBaseline.php b/src/Psalm/ErrorBaseline.php index 84a804cdfe4..e93b7f14220 100644 --- a/src/Psalm/ErrorBaseline.php +++ b/src/Psalm/ErrorBaseline.php @@ -34,8 +34,6 @@ final class ErrorBaseline { /** * @param array}>> $existingIssues - * - * * @psalm-pure */ public static function countTotalIssues(array $existingIssues): int @@ -58,7 +56,6 @@ public static function countTotalIssues(array $existingIssues): int /** * @param array> $issues - * */ public static function create( FileProvider $fileProvider, @@ -73,7 +70,6 @@ public static function create( /** * @return array}>> - * * @throws ConfigException */ public static function read(FileProvider $fileProvider, string $baselineFile): array @@ -133,9 +129,7 @@ public static function read(FileProvider $fileProvider, string $baselineFile): a /** * @param array> $issues - * * @return array}>> - * * @throws ConfigException */ public static function update( @@ -181,7 +175,6 @@ public static function update( /** * @param array> $issues - * * @return array}>> */ private static function countIssueTypesByFile(array $issues): array @@ -193,7 +186,6 @@ private static function countIssueTypesByFile(array $issues): array array_merge(...array_values($issues)), /** * @param array}>> $carry - * * @return array}>> */ static function (array $carry, IssueData $issue): array { @@ -237,7 +229,6 @@ static function (array $carry, IssueData $issue): array { /** * @param array}>> $groupedIssues - * */ private static function writeToFile( FileProvider $fileProvider, diff --git a/src/Psalm/Internal/Algebra.php b/src/Psalm/Internal/Algebra.php index 1aa6da4861c..be967892a0a 100644 --- a/src/Psalm/Internal/Algebra.php +++ b/src/Psalm/Internal/Algebra.php @@ -26,9 +26,7 @@ class Algebra { /** * @param array>> $all_types - * * @return array>> - * * @psalm-pure */ public static function negateTypes(array $all_types): array @@ -74,9 +72,7 @@ public static function negateTypes(array $all_types): array * (!$a) && (!$b) && ($a || $b || $c) => $c * * @param list $clauses - * * @return list - * * @psalm-pure */ public static function simplifyCNF(array $clauses): array @@ -330,7 +326,6 @@ public static function simplifyCNF(array $clauses): array * @param list $clauses * @param array $cond_referenced_var_ids * @param array>> $active_truths - * * @return array>> */ public static function getTruthsFromFormula( @@ -403,9 +398,7 @@ public static function getTruthsFromFormula( /** * @param non-empty-list $clauses - * * @return list - * * @psalm-pure */ public static function groupImpossibilities(array $clauses): array @@ -522,9 +515,7 @@ public static function groupImpossibilities(array $clauses): array /** * @param list $left_clauses * @param list $right_clauses - * * @return list - * * @psalm-pure */ public static function combineOredClauses( @@ -645,7 +636,6 @@ public static function combineOredClauses( * (!$a || !$c || !$f) * * @param list $clauses - * * @return non-empty-list */ public static function negateFormula(array $clauses): array diff --git a/src/Psalm/Internal/Analyzer/AttributesAnalyzer.php b/src/Psalm/Internal/Analyzer/AttributesAnalyzer.php index 6a8177efbe3..f1aede90ee8 100644 --- a/src/Psalm/Internal/Analyzer/AttributesAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/AttributesAnalyzer.php @@ -297,7 +297,6 @@ private static function getAttributeClassFlags( /** * @param iterable $attribute_groups - * * @return Generator */ private static function iterateAttributeNodes(iterable $attribute_groups): Generator diff --git a/src/Psalm/Internal/Analyzer/CanAlias.php b/src/Psalm/Internal/Analyzer/CanAlias.php index d97e0db4cc9..a91ee0e2293 100644 --- a/src/Psalm/Internal/Analyzer/CanAlias.php +++ b/src/Psalm/Internal/Analyzer/CanAlias.php @@ -11,37 +11,40 @@ use function implode; use function strtolower; +/** + * @internal + */ trait CanAlias { /** * @var array */ - private $aliased_classes = []; + private array $aliased_classes = []; /** * @var array */ - private $aliased_class_locations = []; + private array $aliased_class_locations = []; /** * @var array */ - private $aliased_classes_flipped = []; + private array $aliased_classes_flipped = []; /** * @var array */ - private $aliased_classes_flipped_replaceable = []; + private array $aliased_classes_flipped_replaceable = []; /** * @var array */ - private $aliased_functions = []; + private array $aliased_functions = []; /** * @var array */ - private $aliased_constants = []; + private array $aliased_constants = []; public function visitUse(PhpParser\Node\Stmt\Use_ $stmt): void { diff --git a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php index a7a32ad833b..1ea2962b09d 100644 --- a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php @@ -109,7 +109,7 @@ class ClassAnalyzer extends ClassLikeAnalyzer /** * @var array */ - public $inferred_property_types = []; + public array $inferred_property_types = []; /** * @param PhpParser\Node\Stmt\Class_|PhpParser\Node\Stmt\Enum_ $class @@ -517,7 +517,7 @@ public function analyze( ) ); } - + $const_id = strtolower($this->fq_class_name) . '::' . $const->name; foreach ($codebase->class_constants_to_rename as $original_const_id => $new_const_name) { diff --git a/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php index 56eed4212eb..9a86f1496b7 100644 --- a/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php @@ -81,33 +81,23 @@ abstract class ClassLikeAnalyzer extends SourceAnalyzer 'unknown type' => true, ]; - /** - * @var PhpParser\Node\Stmt\ClassLike - */ - protected $class; + protected PhpParser\Node\Stmt\ClassLike $class; - /** @var FileAnalyzer */ - public $file_analyzer; + public FileAnalyzer $file_analyzer; - /** - * @var string - */ - protected $fq_class_name; + protected string $fq_class_name; /** * The parent class - * - * @var string|null */ - protected $parent_fq_class_name; + protected ?string $parent_fq_class_name = null; /** * @var PhpParser\Node\Stmt[] */ - protected $leftover_stmts = []; + protected array $leftover_stmts = []; - /** @var ClassLikeStorage */ - protected $storage; + protected ClassLikeStorage $storage; public function __construct(PhpParser\Node\Stmt\ClassLike $class, SourceAnalyzer $source, string $fq_class_name) { @@ -404,8 +394,6 @@ public static function checkFullyQualifiedClassLikeName( /** * Gets the fully-qualified class name from a Name object - * - * */ public static function getFQCLNFromNameObject( PhpParser\Node\Name $class_name, @@ -495,7 +483,6 @@ public function isStatic(): bool * Gets the Psalm type from a particular value * * @param mixed $value - * */ public static function getTypeFromValue($value): Union { diff --git a/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php b/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php index 5e5a2cd1af7..60f61a9e87d 100644 --- a/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php +++ b/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php @@ -7,23 +7,17 @@ */ class ClassLikeNameOptions { - /** @var bool */ - public $inferred; + public bool $inferred; - /** @var bool */ - public $allow_trait; + public bool $allow_trait; - /** @var bool */ - public $allow_interface; + public bool $allow_interface; - /** @var bool */ - public $allow_enum; + public bool $allow_enum; - /** @var bool */ - public $from_docblock; + public bool $from_docblock; - /** @var bool */ - public $from_attribute; + public bool $from_attribute; public function __construct( bool $inferred = false, diff --git a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php index 925af7f35d6..02a5e91b3b9 100644 --- a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php @@ -39,9 +39,7 @@ class CommentAnalyzer /** * @param array>|null $template_type_map * @param array $type_aliases - * * @throws DocblockParseException if there was a problem parsing the docblock - * * @return list */ public static function getTypeFromComment( @@ -66,9 +64,7 @@ public static function getTypeFromComment( /** * @param array>|null $template_type_map * @param array $type_aliases - * * @return list - * * @throws DocblockParseException if there was a problem parsing the docblock */ public static function arrayToDocblocks( @@ -260,9 +256,7 @@ public static function sanitizeDocblockType(string $docblock_type): string /** * @throws DocblockParseException if an invalid string is found - * * @return non-empty-list - * * @psalm-pure */ public static function splitDocLine(string $return_block): array diff --git a/src/Psalm/Internal/Analyzer/DataFlowNodeData.php b/src/Psalm/Internal/Analyzer/DataFlowNodeData.php index 46c97f99957..bc4f2dbf533 100644 --- a/src/Psalm/Internal/Analyzer/DataFlowNodeData.php +++ b/src/Psalm/Internal/Analyzer/DataFlowNodeData.php @@ -6,67 +6,33 @@ /** * @psalm-immutable - * * @internal */ class DataFlowNodeData { use ImmutableNonCloneableTrait; - /** - * @var int - */ - public $line_from; + public int $line_from; - /** - * @var int - */ - public $line_to; + public int $line_to; - /** - * @var string - */ - public $label; + public string $label; - /** - * @var string - */ - public $file_name; + public string $file_name; - /** - * @var string - */ - public $file_path; + public string $file_path; - /** - * @var string - */ - public $snippet; + public string $snippet; - /** - * @var int - */ - public $from; + public int $from; - /** - * @var int - */ - public $to; + public int $to; - /** - * @var int - */ - public $snippet_from; + public int $snippet_from; - /** - * @var int - */ - public $column_from; + public int $column_from; - /** - * @var int - */ - public $column_to; + public int $column_to; public function __construct( string $label, diff --git a/src/Psalm/Internal/Analyzer/FileAnalyzer.php b/src/Psalm/Internal/Analyzer/FileAnalyzer.php index fc8b48aa70f..7fb1fb01eda 100644 --- a/src/Psalm/Internal/Analyzer/FileAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FileAnalyzer.php @@ -44,25 +44,13 @@ class FileAnalyzer extends SourceAnalyzer { use CanAlias; - /** - * @var string - */ - protected $file_name; + protected string $file_name; - /** - * @var string - */ - protected $file_path; + protected string $file_path; - /** - * @var string|null - */ - protected $root_file_path; + protected ?string $root_file_path = null; - /** - * @var string|null - */ - protected $root_file_name; + protected ?string $root_file_name = null; /** * @var array @@ -97,27 +85,18 @@ class FileAnalyzer extends SourceAnalyzer /** * @var array */ - public $interface_analyzers_to_analyze = []; + public array $interface_analyzers_to_analyze = []; /** * @var array */ - public $class_analyzers_to_analyze = []; + public array $class_analyzers_to_analyze = []; - /** - * @var null|Context - */ - public $context; + public ?Context $context = null; - /** - * @var ProjectAnalyzer - */ - public $project_analyzer; + public ProjectAnalyzer $project_analyzer; - /** - * @var Codebase - */ - public $codebase; + public Codebase $codebase; private int $first_statement_offset = -1; @@ -292,7 +271,6 @@ public function analyze( /** * @param array $stmts - * * @return list */ public function populateCheckers(array $stmts): array diff --git a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php index ffed9e60d94..8444abff344 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php @@ -67,9 +67,7 @@ class ReturnTypeAnalyzer * @param Closure|Function_|ClassMethod|ArrowFunction $function * @param PhpParser\Node\Stmt[] $function_stmts * @param string[] $compatible_method_ids - * * @return false|null - * * @psalm-suppress PossiblyUnusedReturnValue unused but seems important * @psalm-suppress ComplexMethod Unavoidably complex method */ @@ -781,7 +779,6 @@ public static function verifyReturnType( /** * @param Closure|Function_|ClassMethod|ArrowFunction $function - * * @return false|null */ public static function checkReturnType( @@ -978,7 +975,6 @@ public static function checkReturnType( /** * @param Closure|Function_|ClassMethod|ArrowFunction $function - * */ private static function addOrUpdateReturnType( FunctionLike $function, diff --git a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php index d2292f18dd7..d71a547f402 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php +++ b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php @@ -31,9 +31,7 @@ class ReturnTypeCollector * * @param array $stmts * @param list $yield_types - * * @return list a list of return types - * * @psalm-suppress ComplexMethod to be refactored */ public static function getReturnTypes( diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index 1d445ac7442..71404ec4912 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -90,64 +90,46 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer */ protected $function; - /** - * @var Codebase - */ - protected $codebase; + protected Codebase $codebase; /** * @var array */ - protected $suppressed_issues; + protected array $suppressed_issues; - /** - * @var bool - */ - protected $is_static = false; + protected bool $is_static = false; /** * @var ?array */ - protected $return_vars_in_scope = []; + protected ?array $return_vars_in_scope = []; /** * @var ?array */ - protected $return_vars_possibly_in_scope = []; + protected ?array $return_vars_possibly_in_scope = []; private ?Union $local_return_type = null; /** * @var array */ - protected static $no_effects_hashes = []; + protected static array $no_effects_hashes = []; - /** - * @var bool - */ - public $track_mutations = false; + public bool $track_mutations = false; - /** - * @var bool - */ - public $inferred_impure = false; + public bool $inferred_impure = false; - /** - * @var bool - */ - public $inferred_has_mutation = false; + public bool $inferred_has_mutation = false; /** * Holds param nodes for functions with func_get_args calls * * @var array */ - public $param_nodes = []; + public array $param_nodes = []; - /** - * @var FunctionLikeStorage - */ - protected $storage; + protected FunctionLikeStorage $storage; /** * @param TFunction $function @@ -163,9 +145,7 @@ public function __construct($function, SourceAnalyzer $source, FunctionLikeStora /** * @param bool $add_mutations whether or not to add mutations to this method - * * @return false|null - * * @psalm-suppress PossiblyUnusedReturnValue unused but seems important */ public function analyze( @@ -1781,7 +1761,6 @@ public function removeSuppressedIssues(array $new_issues): void /** * Adds a suppressed issue, useful when creating a method checker from scratch - * */ public function addSuppressedIssue(string $issue_name): void { diff --git a/src/Psalm/Internal/Analyzer/IssueData.php b/src/Psalm/Internal/Analyzer/IssueData.php index 318afe57f6a..6b273c0b1fb 100644 --- a/src/Psalm/Internal/Analyzer/IssueData.php +++ b/src/Psalm/Internal/Analyzer/IssueData.php @@ -11,121 +11,86 @@ */ class IssueData { - /** - * @var string - */ - public $severity; + public string $severity; - /** - * @var int - */ - public $line_from; + public int $line_from; - /** - * @var int - */ - public $line_to; + public int $line_to; /** - * @var string * @readonly */ - public $type; + public string $type; /** - * @var string * @readonly */ - public $message; + public string $message; /** - * @var string * @readonly */ - public $file_name; + public string $file_name; /** - * @var string * @readonly */ - public $file_path; + public string $file_path; /** - * @var string * @readonly */ - public $snippet; + public string $snippet; /** - * @var string * @readonly */ - public $selected_text; + public string $selected_text; - /** - * @var int - */ - public $from; + public int $from; - /** - * @var int - */ - public $to; + public int $to; - /** - * @var int - */ - public $snippet_from; + public int $snippet_from; - /** - * @var int - */ - public $snippet_to; + public int $snippet_to; /** - * @var int * @readonly */ - public $column_from; + public int $column_from; /** - * @var int * @readonly */ - public $column_to; + public int $column_to; - /** - * @var int - */ - public $error_level; + public int $error_level; /** - * @var int * @readonly */ - public $shortcode; + public int $shortcode; /** - * @var string * @readonly */ - public $link; + public string $link; /** * @var ?list */ - public $taint_trace; + public ?array $taint_trace = null; /** * @var ?list */ - public $other_references; + public ?array $other_references = null; /** - * @var ?string * @readonly */ - public $dupe_key; + public ?string $dupe_key = null; /** * @param ?list $taint_trace diff --git a/src/Psalm/Internal/Analyzer/MethodAnalyzer.php b/src/Psalm/Internal/Analyzer/MethodAnalyzer.php index e11abef5195..ae725773f81 100644 --- a/src/Psalm/Internal/Analyzer/MethodAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/MethodAnalyzer.php @@ -88,6 +88,7 @@ public function __construct( /** * Determines whether a given method is static or not + * * @param array $suppressed_issues */ public static function checkStatic( @@ -159,7 +160,6 @@ public static function checkStatic( /** * @param string[] $suppressed_issues * @param lowercase-string|null $calling_method_id - * */ public static function checkMethodExists( Codebase $codebase, diff --git a/src/Psalm/Internal/Analyzer/MethodComparator.php b/src/Psalm/Internal/Analyzer/MethodComparator.php index 7522b905ff8..034273858ba 100644 --- a/src/Psalm/Internal/Analyzer/MethodComparator.php +++ b/src/Psalm/Internal/Analyzer/MethodComparator.php @@ -48,9 +48,7 @@ class MethodComparator { /** * @param string[] $suppressed_issues - * * @return false|null - * * @psalm-suppress PossiblyUnusedReturnValue unused but seems important */ public static function compare( diff --git a/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php b/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php index 6ee0ea96933..e0d412cbfc6 100644 --- a/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php @@ -31,7 +31,7 @@ class NamespaceAnalyzer extends SourceAnalyzer * @var FileAnalyzer * @psalm-suppress NonInvariantDocblockPropertyType */ - protected $source; + protected SourceAnalyzer $source; private Namespace_ $namespace; @@ -42,7 +42,7 @@ class NamespaceAnalyzer extends SourceAnalyzer * * @var array> */ - protected static $public_namespace_constants = []; + protected static array $public_namespace_constants = []; public function __construct(Namespace_ $namespace, FileAnalyzer $source) { @@ -153,7 +153,6 @@ public function getFileAnalyzer(): FileAnalyzer * case-insensitive comparison. Identifiers can be namespaces, classlikes, functions, or methods. * * @psalm-pure - * * @throws InvalidArgumentException if $identifier is not a valid identifier */ public static function isWithin(string $calling_identifier, string $identifier): bool @@ -187,9 +186,7 @@ public static function isWithin(string $calling_identifier, string $identifier): * Identifiers can be namespaces, classlikes, functions, or methods. * * @psalm-pure - * * @psalm-assert-if-false !empty $identifiers - * * @param list $identifiers */ public static function isWithinAny(string $calling_identifier, array $identifiers): bool @@ -208,10 +205,8 @@ public static function isWithinAny(string $calling_identifier, array $identifier } /** - * @param non-empty-string $fullyQualifiedClassName, e.g. '\Psalm\Internal\Analyzer\NamespaceAnalyzer' - * + * @param non-empty-string $fullyQualifiedClassName e.g. '\Psalm\Internal\Analyzer\NamespaceAnalyzer' * @return non-empty-string , e.g. 'Psalm' - * * @psalm-pure */ public static function getNameSpaceRoot(string $fullyQualifiedClassName): string @@ -225,7 +220,6 @@ public static function getNameSpaceRoot(string $fullyQualifiedClassName): string /** * @return ($lowercase is true ? lowercase-string : string) - * * @psalm-pure */ public static function normalizeIdentifier(string $identifier, bool $lowercase = true): string @@ -242,7 +236,6 @@ public static function normalizeIdentifier(string $identifier, bool $lowercase = * Splits an identifier into parts, eg `Foo\Bar::baz` becomes ["Foo", "\\", "Bar", "::", "baz"]. * * @return list - * * @psalm-pure */ public static function getIdentifierParts(string $identifier): array diff --git a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php index 07f4300fcf7..38696dbbb08 100644 --- a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php @@ -114,10 +114,7 @@ class ProjectAnalyzer */ private Config $config; - /** - * @var self - */ - public static $instance; + public static ProjectAnalyzer $instance; /** * An object representing everything we know about the code @@ -128,70 +125,41 @@ class ProjectAnalyzer private ClassLikeStorageProvider $classlike_storage_provider; - private ?ParserCacheProvider $parser_cache_provider; + private ?ParserCacheProvider $parser_cache_provider = null; - /** @var ?ProjectCacheProvider */ - public $project_cache_provider; + public ?ProjectCacheProvider $project_cache_provider = null; private FileReferenceProvider $file_reference_provider; - /** - * @var Progress - */ - public $progress; + public Progress $progress; - /** - * @var bool - */ - public $debug_lines = false; + public bool $debug_lines = false; - /** - * @var bool - */ - public $debug_performance = false; + public bool $debug_performance = false; - /** - * @var bool - */ - public $show_issues = true; + public bool $show_issues = true; - /** @var int */ - public $threads; + public int $threads; /** * @var array */ private array $issues_to_fix = []; - /** - * @var bool - */ - public $dry_run = false; + public bool $dry_run = false; - /** - * @var bool - */ - public $full_run = false; + public bool $full_run = false; - /** - * @var bool - */ - public $only_replace_php_types_with_non_docblock_types = false; + public bool $only_replace_php_types_with_non_docblock_types = false; - /** - * @var ?int - */ - public $onchange_line_limit; + public ?int $onchange_line_limit = null; - /** - * @var bool - */ - public $provide_completion = false; + public bool $provide_completion = false; /** * @var list */ - public $check_paths_files = []; + public array $check_paths_files = []; /** * @var array @@ -206,17 +174,14 @@ class ProjectAnalyzer /** * @var array */ - private $to_refactor = []; + private array $to_refactor = []; - /** - * @var ?ReportOptions - */ - public $stdout_report_options; + public ?ReportOptions $stdout_report_options = null; /** * @var array */ - public $generated_report_options; + public array $generated_report_options; /** * @var array> @@ -247,17 +212,13 @@ class ProjectAnalyzer /** * When this is true, the language server will send the diagnostic code with a help link. - * - * @var bool */ - public $language_server_use_extended_diagnostic_codes = false; + public bool $language_server_use_extended_diagnostic_codes = false; /** * If this is true then the language server will send log messages to the client with additional information. - * - * @var bool */ - public $language_server_verbose = false; + public bool $language_server_verbose = false; /** * @param array $generated_report_options @@ -1112,7 +1073,6 @@ protected function getDiffFiles(): array /** * @param array $file_list - * */ private function checkDiffFilesWithConfig(Config $config, array $file_list = []): void { @@ -1232,7 +1192,6 @@ public function getConfig(): Config /** * @param array $diff_files - * * @return array */ public function getReferencedFilesFromDiff(array $diff_files, bool $include_referencing_files = true): array @@ -1280,7 +1239,6 @@ public function alterCodeAfterCompletion( /** * @param array $to_refactor - * */ public function refactorCodeAfterCompletion(array $to_refactor): void { @@ -1318,7 +1276,6 @@ public function setPhpVersion(string $version, string $source): void /** * @param array $issues * @throws UnsupportedIssueToFixException - * */ public function setIssuesToFix(array $issues): void { @@ -1450,6 +1407,7 @@ public function getFunctionLikeAnalyzer( * Adapted from https://gist.github.com/divinity76/01ef9ca99c111565a72d3a8a6e42f7fb * returns number of cpu cores * Copyleft 2018, license: WTFPL + * * @throws NumberOfCpuCoreNotFound */ public static function getCpuCount(): int @@ -1478,7 +1436,6 @@ public static function getCpuCount(): int /** * @return array - * * @psalm-pure */ public static function getSupportedIssuesToFix(): array diff --git a/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php b/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php index b0b2858c2b8..72af912397a 100644 --- a/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php @@ -31,9 +31,7 @@ class ScopeAnalyzer * @param array $stmts * @param list<'loop'|'switch'> $break_types * @param bool $return_is_exit Exit and Throw statements are treated differently from return if this is false - * * @return list - * * @psalm-suppress ComplexMethod nothing much we can do */ public static function getControlActions( @@ -397,7 +395,6 @@ public static function getControlActions( /** * @param array $stmts - * */ public static function onlyThrowsOrExits(NodeTypeProvider $type_provider, array $stmts): bool { @@ -429,7 +426,6 @@ public static function onlyThrowsOrExits(NodeTypeProvider $type_provider, array /** * @param array $stmts - * */ public static function onlyThrows(array $stmts): bool { diff --git a/src/Psalm/Internal/Analyzer/SourceAnalyzer.php b/src/Psalm/Internal/Analyzer/SourceAnalyzer.php index 506ee7b5cde..705176d6818 100644 --- a/src/Psalm/Internal/Analyzer/SourceAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/SourceAnalyzer.php @@ -13,10 +13,7 @@ */ abstract class SourceAnalyzer implements StatementsSource { - /** - * @var SourceAnalyzer - */ - protected $source; + protected SourceAnalyzer $source; public function __destruct() { @@ -122,7 +119,8 @@ public function getSource(): StatementsSource /** * Get a list of suppressed issues - *@psalm-mutation-free + * + * @psalm-mutation-free * @return array */ public function getSuppressedIssues(): array diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php index 2f934d11951..f2fcb18d28b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php @@ -387,7 +387,6 @@ public static function analyze( /** * @param PhpParser\Node\Stmt\Foreach_|PhpParser\Node\Expr\YieldFrom $stmt - * * @return false|null */ public static function checkIteratorType( diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php index d1b0e1f0fa5..2fbc984da60 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php @@ -50,7 +50,6 @@ class IfAnalyzer { /** * @param array $pre_assignment_else_redefined_vars - * * @return false|null */ public static function analyze( @@ -401,6 +400,7 @@ public static function addConditionallyAssignedVarsToContext( /** * Returns all expressions inside an ored expression + * * @return non-empty-list */ private static function getDefinitelyEvaluatedOredExpressions(PhpParser\Node\Expr $stmt): array diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php index b89c8dc54a7..3a87d9e8f9f 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php @@ -64,7 +64,6 @@ class IfElseAnalyzer * (x: null) * throw new Exception -- effects: remove null from the type of x * - * * @return null|false */ public static function analyze( diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php index c8dce61b121..79ac5bda923 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php @@ -36,7 +36,6 @@ class LoopAnalyzer * @param array $stmts * @param PhpParser\Node\Expr[] $pre_conditions * @param PhpParser\Node\Expr[] $post_expressions - * * @return false|null */ public static function analyze( @@ -568,7 +567,6 @@ private static function updateLoopScopeContexts( /** * @param list $pre_condition_clauses - * * @return list */ private static function applyPreConditionToLoopContext( @@ -647,7 +645,6 @@ private static function applyPreConditionToLoopContext( /** * @param array> $assignment_map - * */ private static function getAssignmentMapDepth(string $first_var_id, array $assignment_map): int { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php index cf7447a1057..f122b73f67d 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php @@ -14,47 +14,38 @@ class ArrayCreationInfo /** * @var list */ - public $item_key_atomic_types = []; + public array $item_key_atomic_types = []; /** * @var list */ - public $item_value_atomic_types = []; + public array $item_value_atomic_types = []; /** * @var array */ - public $property_types = []; + public array $property_types = []; /** * @var array */ - public $class_strings = []; + public array $class_strings = []; - /** - * @var bool - */ - public $can_create_objectlike = true; + public bool $can_create_objectlike = true; /** * @var array */ - public $array_keys = []; + public array $array_keys = []; - /** - * @var int - */ - public $int_offset = 0; + public int $int_offset = 0; - /** - * @var bool - */ - public $all_list = true; + public bool $all_list = true; /** * @var array */ - public $parent_taint_nodes = []; + public array $parent_taint_nodes = []; public bool $can_be_empty = true; } diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php index a19fe3b2e2b..a38327a271d 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php @@ -925,7 +925,6 @@ private static function processIrreconcilableFunctionCall( /** * @param PhpParser\Node\Expr\FuncCall|PhpParser\Node\Expr\MethodCall|PhpParser\Node\Expr\StaticCall $expr - * * @return list>>> */ protected static function processCustomAssertion( @@ -3476,8 +3475,6 @@ private static function getTypedValueEqualityAssertions( } /** - * @param PhpParser\Node\Expr\FuncCall $expr - * @param StatementsAnalyzer $source * @return list>>> */ private static function getIsaAssertions( @@ -3582,9 +3579,6 @@ private static function getIsaAssertions( } /** - * @param PhpParser\Node\Expr\FuncCall $expr - * @param StatementsAnalyzer $source - * @param string|null $first_var_name * @return list>>> */ private static function getInarrayAssertions( @@ -3662,9 +3656,6 @@ private static function getInarrayAssertions( } /** - * @param PhpParser\Node\Expr\FuncCall $expr - * @param Union|null $first_var_type - * @param string|null $first_var_name * @return list>>> */ private static function getArrayKeyExistsAssertions( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php index c1d06eb6fc8..a49249992b5 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php @@ -9,20 +9,11 @@ */ class AssignedProperty { - /** - * @var Union - */ - public $property_type; + public Union $property_type; - /** - * @var string - */ - public $id; + public string $id; - /** - * @var Union - */ - public $assignment_type; + public Union $assignment_type; public function __construct( Union $property_type, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php index d69df245442..8c3afc95672 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php @@ -92,7 +92,6 @@ class InstancePropertyAssignmentAnalyzer /** * @param PropertyFetch|PropertyProperty $stmt * @param bool $direct_assignment whether the variable is assigned explicitly - * * @return false|null */ public static function analyze( @@ -878,7 +877,6 @@ private static function analyzeRegularAssignment( /** * @param list $invalid_assignment_types - * * @psalm-suppress ComplexMethod Unavoidably complex method */ private static function analyzeAtomicAssignment( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php index 05ea3dae4f9..e5c71802001 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php @@ -100,7 +100,6 @@ class AssignmentAnalyzer { /** * @param PhpParser\Node\Expr|null $assign_value This has to be null to support list destructuring - * * @return false|Union */ public static function analyze( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php index 6d99a6da774..043da46ac4c 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php @@ -292,7 +292,6 @@ private static function getNumericalType($result): Union /** * @param string[] $invalid_left_messages * @param string[] $invalid_right_messages - * * @psalm-suppress ComplexMethod Unavoidably complex method. */ private static function analyzeOperands( @@ -929,7 +928,6 @@ private static function analyzeOperands( } /** - * @param PhpParser\Node $operation * @param float|int $operand1 * @param float|int $operand2 */ diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php index fca29300314..6f19a633a50 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php @@ -53,9 +53,6 @@ class ConcatAnalyzer { private const MAX_LITERALS = 64; - /** - * @param Union|null $result_type - */ public static function analyze( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr $left, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php index 3d815318b7a..e0d2005802c 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php @@ -72,7 +72,6 @@ class ArgumentsAnalyzer /** * @param list $args * @param array|null $function_params - * * @return false|null */ public static function analyze( @@ -698,9 +697,7 @@ private static function handleClosureArg( * @param list $args * @param string|MethodIdentifier|null $method_id * @param array $function_params - * * @return false|null - * * @psalm-suppress ComplexMethod there's just not much that can be done about this */ public static function checkArgumentsMatch( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php index 92fa5b49161..3443219f0eb 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php @@ -134,7 +134,6 @@ public static function checkArgumentsMatch( /** * @param list $args - * * @return false|null */ public static function handleAddition( @@ -329,7 +328,6 @@ public static function handleAddition( /** * @param list $args - * * @return false|null */ public static function handleSplice( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php index 61984a89d7d..c2e38864d5b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php @@ -12,60 +12,36 @@ */ class FunctionCallInfo { - /** - * @var ?string - */ - public $function_id; + public ?string $function_id = null; - /** - * @var ?bool - */ - public $function_exists; + public ?bool $function_exists = null; - /** - * @var bool - */ - public $is_stubbed = false; + public bool $is_stubbed = false; - /** - * @var bool - */ - public $in_call_map = false; + public bool $in_call_map = false; /** * @var array */ - public $defined_constants = []; + public array $defined_constants = []; /** * @var array */ - public $global_variables = []; + public array $global_variables = []; /** * @var ?array */ - public $function_params; + public ?array $function_params = null; - /** - * @var ?FunctionLikeStorage - */ - public $function_storage; + public ?FunctionLikeStorage $function_storage = null; - /** - * @var ?PhpParser\Node\Name - */ - public $new_function_name; + public ?PhpParser\Node\Name $new_function_name = null; - /** - * @var bool - */ - public $allow_named_args = true; + public bool $allow_named_args = true; - /** - * @var array - */ - public $byref_uses = []; + public array $byref_uses = []; /** * @mutation-free diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php index 8477dd558d3..7e033b36f1d 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php @@ -10,11 +10,10 @@ */ class AtomicCallContext { - /** @var MethodIdentifier */ - public $method_id; + public MethodIdentifier $method_id; /** @var list */ - public $args; + public array $args; /** @param list $args */ public function __construct(MethodIdentifier $method_id, array $args) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalysisResult.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalysisResult.php index ba2e13db734..e83742e070b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalysisResult.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalysisResult.php @@ -10,83 +10,56 @@ */ class AtomicMethodCallAnalysisResult { - /** - * @var ?Union - */ - public $return_type; + public ?Union $return_type = null; - /** - * @var bool - */ - public $returns_by_ref = false; + public bool $returns_by_ref = false; - /** - * @var bool - */ - public $has_mock = false; + public bool $has_mock = false; - /** - * @var bool - */ - public $has_valid_method_call_type = false; + public bool $has_valid_method_call_type = false; - /** - * @var bool - */ - public $has_mixed_method_call = false; + public bool $has_mixed_method_call = false; /** * @var array */ - public $invalid_method_call_types = []; + public array $invalid_method_call_types = []; /** * @var array */ - public $existent_method_ids = []; + public array $existent_method_ids = []; /** * @var array */ - public $non_existent_class_method_ids = []; + public array $non_existent_class_method_ids = []; /** * @var array */ - public $non_existent_interface_method_ids = []; + public array $non_existent_interface_method_ids = []; /** * @var array */ - public $non_existent_magic_method_ids = []; + public array $non_existent_magic_method_ids = []; - /** - * @var bool - */ - public $check_visibility = true; + public bool $check_visibility = true; - /** - * @var bool - */ - public $too_many_arguments = true; + public bool $too_many_arguments = true; /** * @var list */ - public $too_many_arguments_method_ids = []; + public array $too_many_arguments_method_ids = []; - /** - * @var bool - */ - public $too_few_arguments = false; + public bool $too_few_arguments = false; /** * @var list */ - public $too_few_arguments_method_ids = []; + public array $too_few_arguments_method_ids = []; - /** - * @var bool - */ - public $can_memoize = false; + public bool $can_memoize = false; } diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalyzer.php index 29f510c6359..aa6ac74b96d 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalyzer.php @@ -64,7 +64,6 @@ class AtomicMethodCallAnalyzer extends CallAnalyzer { /** * @param TNamedObject|TTemplateParam|null $static_type - * * @psalm-suppress ComplexMethod it's really complex, but unavoidably so */ public static function analyze( @@ -512,7 +511,6 @@ public static function analyze( /** * @param TNamedObject|TTemplateParam $lhs_type_part * @param array $intersection_types - * * @return array{?Union, array} */ private static function getIntersectionReturnType( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php index fcb44cb9e1d..dd4a19fafbc 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php @@ -19,7 +19,6 @@ class MethodCallProhibitionAnalyzer { /** * @param string[] $suppressed_issues - * * @return false|null */ public static function analyze( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php index ad6c4fcc41a..f96f679fc98 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php @@ -24,7 +24,6 @@ class MethodVisibilityAnalyzer { /** * @param string[] $suppressed_issues - * * @return false|null */ public static function analyze( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php index 1982bcf707b..11a00eeb38c 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php @@ -410,10 +410,8 @@ private static function createFirstClassCallableReturnType(?MethodStorage $metho * Returns the pseudo method if exists, with its defining class storage. * If the method is not declared, null is returned. * - * @param Codebase $codebase * @param ClassLikeStorage $static_class_storage The called class * @param lowercase-string $method_name_lc - * * @return array{MethodStorage, ClassLikeStorage} */ private static function findPseudoMethodAndClassStorages( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php index e6474f9baa6..75dd5bcb815 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php @@ -1079,10 +1079,8 @@ public static function handleNonObjectCall( * Returns the pseudo method if exists, with its defining class storage. * If the method is not declared, null is returned. * - * @param Codebase $codebase * @param ClassLikeStorage $static_class_storage The called class * @param lowercase-string $method_name_lc - * * @return array{MethodStorage, ClassLikeStorage}|null */ private static function findPseudoMethodAndClassStorages( @@ -1114,15 +1112,9 @@ private static function findPseudoMethodAndClassStorages( * Forward static call to instance call, using `VirtualMethodCall` and `MethodCallAnalyzer::analyze()` * The resolved method return type will be set as type of the $stmt node. * - * @param StatementsAnalyzer $statements_analyzer - * @param PhpParser\Node\Expr\StaticCall $stmt - * @param PhpParser\Node\Identifier $stmt_name - * @param Context $context * @param string $virtual_var_name Temporary var name to use for create the fake MethodCall statement. * @param bool $always_set_node_type If true, when the method has no declared typed, mixed will be set on node. - * * @return bool Result of analysis. False if the call is invalid. - * * @see MethodCallAnalyzer::analyze() */ private static function forwardCallToInstanceMethod( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php index 502e46a47f5..659111f8259 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php @@ -493,7 +493,6 @@ public static function getGenericParamForOffset( /** * @param PhpParser\Node\Scalar\String_|PhpParser\Node\Expr\Array_|PhpParser\Node\Expr\BinaryOp\Concat $callable_arg - * * @return list */ public static function getFunctionIdsFromCallableArg( @@ -597,7 +596,6 @@ public static function getFunctionIdsFromCallableArg( /** * @param non-empty-string $function_id * @param bool $can_be_in_root_scope if true, the function can be shortened to the root version - * */ public static function checkFunctionExists( StatementsAnalyzer $statements_analyzer, @@ -640,7 +638,6 @@ public static function checkFunctionExists( * @param Identifier|Name $expr * @param Possibilities[] $var_assertions * @param list $args - * */ public static function applyAssertionsToContext( PhpParser\NodeAbstract $expr, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php index f50ab1d324d..5f32e104d9e 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php @@ -1090,7 +1090,6 @@ public static function handleMixedArrayAccess( * @param TArray|TKeyedArray|TClassStringMap $type * @param-out TArray|TKeyedArray|TClassStringMap $type * @param list $key_values - * * @psalm-suppress ConflictingReferenceConstraint Ignore */ private static function handleArrayAccessOnArray( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php index 79bbe947414..c0bcba608a7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php @@ -77,7 +77,6 @@ class AtomicPropertyFetchAnalyzer { /** * @param array $invalid_fetch_types $invalid_fetch_types - * * @psalm-suppress ComplexMethod Unavoidably complex method. */ public static function analyze( diff --git a/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php index 618031bd768..348ee488ceb 100644 --- a/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php @@ -582,6 +582,7 @@ private static function handleTaints( /** * If a function returns a closure, we try to infer the param/return types of * the inner closure. + * * @see \Psalm\Tests\ReturnTypeTest:756 * @param PhpParser\Node\Expr\Closure|PhpParser\Node\Expr\ArrowFunction $expr */ diff --git a/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php b/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php index 2d5895885f1..8a83cd265a6 100644 --- a/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php +++ b/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php @@ -32,7 +32,6 @@ class UnusedAssignmentRemover /** * @param array $stmts * @param array $var_loc_map - * */ public function findUnusedAssignment( Codebase $codebase, diff --git a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php index 8387a85436d..d6a9b6089b2 100644 --- a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php @@ -94,20 +94,11 @@ */ class StatementsAnalyzer extends SourceAnalyzer { - /** - * @var SourceAnalyzer - */ - protected $source; + protected SourceAnalyzer $source; - /** - * @var FileAnalyzer - */ - protected $file_analyzer; + protected FileAnalyzer $file_analyzer; - /** - * @var Codebase - */ - protected $codebase; + protected Codebase $codebase; /** * @var array @@ -139,17 +130,15 @@ class StatementsAnalyzer extends SourceAnalyzer /** * @var array */ - public $byref_uses = []; + public array $byref_uses = []; private ?ParsedDocblock $parsed_docblock = null; private ?string $fake_this_class = null; - /** @var NodeDataProvider */ - public $node_data; + public NodeDataProvider $node_data; - /** @var ?DataFlowGraph */ - public $data_flow_graph; + public ?DataFlowGraph $data_flow_graph = null; /** * Locations of foreach values @@ -159,7 +148,7 @@ class StatementsAnalyzer extends SourceAnalyzer * @var array> * @psalm-internal Psalm\Internal\Analyzer */ - public $foreach_var_locations = []; + public array $foreach_var_locations = []; public function __construct(SourceAnalyzer $source, NodeDataProvider $node_data) { @@ -179,7 +168,6 @@ public function __construct(SourceAnalyzer $source, NodeDataProvider $node_data) * Checks an array of statements for validity * * @param array $stmts - * * @return null|false */ public function analyze( diff --git a/src/Psalm/Internal/Analyzer/TypeAnalyzer.php b/src/Psalm/Internal/Analyzer/TypeAnalyzer.php index 05a4548c84e..0c871fe2200 100644 --- a/src/Psalm/Internal/Analyzer/TypeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/TypeAnalyzer.php @@ -18,7 +18,6 @@ class TypeAnalyzer * * @param array $new_types * @param array $existing_types - * * @return array */ public static function combineKeyedTypes(array $new_types, array $existing_types): array diff --git a/src/Psalm/Internal/Clause.php b/src/Psalm/Internal/Clause.php index 2d76469f49f..7e1c952bed2 100644 --- a/src/Psalm/Internal/Clause.php +++ b/src/Psalm/Internal/Clause.php @@ -24,17 +24,15 @@ /** * @internal - * * @psalm-immutable */ class Clause { use ImmutableNonCloneableTrait; - /** @var int */ - public $creating_conditional_id; - /** @var int */ - public $creating_object_id; + public int $creating_conditional_id; + + public int $creating_object_id; /** * An array of strings of the form @@ -51,7 +49,7 @@ class Clause * * @var array> */ - public $possibilities; + public array $possibilities; /** * An array of things that are not true @@ -67,22 +65,18 @@ class Clause * * @var array>|null */ - public $impossibilities; + public ?array $impossibilities = null; - /** @var bool */ - public $wedge; + public bool $wedge; - /** @var bool */ - public $reconcilable; + public bool $reconcilable; - /** @var bool */ - public $generated = false; + public bool $generated = false; /** @var array */ - public $redefined_vars = []; + public array $redefined_vars = []; - /** @var string */ - public $hash; + public string $hash; /** * @param array> $possibilities diff --git a/src/Psalm/Internal/CliUtils.php b/src/Psalm/Internal/CliUtils.php index 76afad8d136..b1b5ad0542d 100644 --- a/src/Psalm/Internal/CliUtils.php +++ b/src/Psalm/Internal/CliUtils.php @@ -132,7 +132,6 @@ public static function requireAutoloaders( foreach ($autoload_files as $file) { /** * @psalm-suppress UnresolvableInclude - * * @var mixed */ $autoloader = require_once $file; @@ -255,7 +254,6 @@ public static function getArguments(): array /** * @param string|array|null|false $f_paths - * * @return list|null */ public static function getPathsToCheck($f_paths): ?array diff --git a/src/Psalm/Internal/Codebase/Analyzer.php b/src/Psalm/Internal/Codebase/Analyzer.php index 239f7c453d0..beeaa80aa3c 100644 --- a/src/Psalm/Internal/Codebase/Analyzer.php +++ b/src/Psalm/Internal/Codebase/Analyzer.php @@ -110,7 +110,7 @@ class Analyzer * * @var array */ - private $mixed_counts = []; + private array $mixed_counts = []; /** * Used to store member names of mixed property/method access @@ -141,7 +141,7 @@ class Analyzer * * @var array */ - private $files_with_analysis_results = []; + private array $files_with_analysis_results = []; /** * We may update fewer files than we analyse (i.e. for dead code detection) @@ -178,12 +178,12 @@ class Analyzer /** * @var array> */ - public $possible_method_param_types = []; + public array $possible_method_param_types = []; /** * @var array */ - public $mutable_classes = []; + public array $mutable_classes = []; public function __construct( Config $config, @@ -199,7 +199,6 @@ public function __construct( /** * @param array $files_to_analyze - * */ public function addFilesToAnalyze(array $files_to_analyze): void { @@ -209,7 +208,6 @@ public function addFilesToAnalyze(array $files_to_analyze): void /** * @param array $files_to_analyze - * */ public function addFilesToShowResults(array $files_to_analyze): void { @@ -218,7 +216,6 @@ public function addFilesToShowResults(array $files_to_analyze): void /** * @param array $files_to_update - * */ public function setFilesToUpdate(array $files_to_update): void { @@ -1072,7 +1069,6 @@ public function hasMixedMemberName(string $member_id): bool /** * @param array> $names - * */ public function addMixedMemberNames(array $names): void { @@ -1102,7 +1098,6 @@ public function getMixedCountsForFile(string $file_path): array /** * @param list{int, int} $mixed_counts - * */ public function setMixedCountsForFile(string $file_path, array $mixed_counts): void { diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 5019317f43e..f9069e1de02 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -74,55 +74,52 @@ class ClassLikes { private ClassLikeStorageProvider $classlike_storage_provider; - /** - * @var FileReferenceProvider - */ - public $file_reference_provider; + public FileReferenceProvider $file_reference_provider; /** * @var array */ - private $existing_classlikes_lc = []; + private array $existing_classlikes_lc = []; /** * @var array */ - private $existing_classes_lc = []; + private array $existing_classes_lc = []; /** * @var array */ - private $existing_classes = []; + private array $existing_classes = []; /** * @var array */ - private $existing_interfaces_lc = []; + private array $existing_interfaces_lc = []; /** * @var array */ - private $existing_interfaces = []; + private array $existing_interfaces = []; /** * @var array */ - private $existing_traits_lc = []; + private array $existing_traits_lc = []; /** * @var array */ - private $existing_traits = []; + private array $existing_traits = []; /** * @var array */ - private $existing_enums_lc = []; + private array $existing_enums_lc = []; /** * @var array */ - private $existing_enums = []; + private array $existing_enums = []; /** * @var array @@ -139,15 +136,9 @@ class ClassLikes */ private array $trait_nodes = []; - /** - * @var bool - */ - public $collect_references = false; + public bool $collect_references = false; - /** - * @var bool - */ - public $collect_locations = false; + public bool $collect_locations = false; private StatementsProvider $statements_provider; @@ -1577,7 +1568,6 @@ public function airliftClassDefinedDocblockType( /** * @param ReflectionProperty::IS_PUBLIC|ReflectionProperty::IS_PROTECTED|ReflectionProperty::IS_PRIVATE * $visibility - * * @return array */ public function getConstantsForClass(string $class_name, int $visibility): array @@ -2281,7 +2271,6 @@ public function getThreadData(): array * 7: array, * 8: array, * } $thread_data - * */ public function addThreadData(array $thread_data): void { diff --git a/src/Psalm/Internal/Codebase/DataFlowGraph.php b/src/Psalm/Internal/Codebase/DataFlowGraph.php index 5f66a1955cc..6a79fa7e2bf 100644 --- a/src/Psalm/Internal/Codebase/DataFlowGraph.php +++ b/src/Psalm/Internal/Codebase/DataFlowGraph.php @@ -20,7 +20,7 @@ abstract class DataFlowGraph { /** @var array> */ - protected $forward_edges = []; + protected array $forward_edges = []; abstract public function addNode(DataFlowNode $node): void; @@ -58,7 +58,6 @@ public function addPath( /** * @param array $previous_path_types - * * @psalm-pure */ protected static function shouldIgnoreFetch( diff --git a/src/Psalm/Internal/Codebase/Functions.php b/src/Psalm/Internal/Codebase/Functions.php index 70ea45c5000..320540013d9 100644 --- a/src/Psalm/Internal/Codebase/Functions.php +++ b/src/Psalm/Internal/Codebase/Functions.php @@ -42,19 +42,15 @@ class Functions /** * @var array */ - private static $stubbed_functions; + private static array $stubbed_functions; - /** @var FunctionReturnTypeProvider */ - public $return_type_provider; + public FunctionReturnTypeProvider $return_type_provider; - /** @var FunctionExistenceProvider */ - public $existence_provider; + public FunctionExistenceProvider $existence_provider; - /** @var FunctionParamsProvider */ - public $params_provider; + public FunctionParamsProvider $params_provider; - /** @var DynamicFunctionStorageProvider */ - public $dynamic_storage_provider; + public DynamicFunctionStorageProvider $dynamic_storage_provider; private Reflection $reflection; @@ -232,7 +228,6 @@ public function functionExists( /** * @param non-empty-string $function_name - * * @return non-empty-string */ public function getFullyQualifiedFunctionNameFromString(string $function_name, StatementsSource $source): string diff --git a/src/Psalm/Internal/Codebase/InternalCallMapHandler.php b/src/Psalm/Internal/Codebase/InternalCallMapHandler.php index 56c6054748a..64ad62709e4 100644 --- a/src/Psalm/Internal/Codebase/InternalCallMapHandler.php +++ b/src/Psalm/Internal/Codebase/InternalCallMapHandler.php @@ -50,7 +50,7 @@ class InternalCallMapHandler /** * @var array>|null */ - private static $call_map_callables = []; + private static ?array $call_map_callables = []; /** * @var array>> @@ -86,7 +86,6 @@ public static function getCallableFromCallMapById( /** * @param array $callables * @param list $args - * */ public static function getMatchingCallableFromCallMapOptions( Codebase $codebase, diff --git a/src/Psalm/Internal/Codebase/Methods.php b/src/Psalm/Internal/Codebase/Methods.php index 7cc94518634..940edc9c472 100644 --- a/src/Psalm/Internal/Codebase/Methods.php +++ b/src/Psalm/Internal/Codebase/Methods.php @@ -54,29 +54,19 @@ class Methods { private ClassLikeStorageProvider $classlike_storage_provider; - /** - * @var bool - */ - public $collect_locations = false; + public bool $collect_locations = false; - /** - * @var FileReferenceProvider - */ - public $file_reference_provider; + public FileReferenceProvider $file_reference_provider; private ClassLikes $classlikes; - /** @var MethodReturnTypeProvider */ - public $return_type_provider; + public MethodReturnTypeProvider $return_type_provider; - /** @var MethodParamsProvider */ - public $params_provider; + public MethodParamsProvider $params_provider; - /** @var MethodExistenceProvider */ - public $existence_provider; + public MethodExistenceProvider $existence_provider; - /** @var MethodVisibilityProvider */ - public $visibility_provider; + public MethodVisibilityProvider $visibility_provider; public function __construct( ClassLikeStorageProvider $storage_provider, @@ -347,7 +337,6 @@ public function methodExists( /** * @param list $args - * * @return list */ public function getMethodParams( @@ -560,7 +549,6 @@ public function isVariadic(MethodIdentifier $method_id): bool /** * @param list|null $args - * */ public function getMethodReturnType( MethodIdentifier $method_id, @@ -918,10 +906,6 @@ public function getMethodReturnsByRef(MethodIdentifier $method_id): bool return $this->getStorage($method_id)->returns_by_ref; } - /** - * @param CodeLocation|null $defined_location - * - */ public function getMethodReturnTypeLocation( MethodIdentifier $method_id, CodeLocation &$defined_location = null @@ -953,7 +937,6 @@ public function getMethodReturnTypeLocation( /** * @param lowercase-string $method_name_lc * @param lowercase-string $declaring_method_name_lc - * */ public function setDeclaringMethodId( string $fq_class_name, @@ -972,7 +955,6 @@ public function setDeclaringMethodId( /** * @param lowercase-string $method_name_lc * @param lowercase-string $appearing_method_name_lc - * */ public function setAppearingMethodId( string $fq_class_name, diff --git a/src/Psalm/Internal/Codebase/Populator.php b/src/Psalm/Internal/Codebase/Populator.php index b5abb3b3aa2..64f322f8f43 100644 --- a/src/Psalm/Internal/Codebase/Populator.php +++ b/src/Psalm/Internal/Codebase/Populator.php @@ -43,7 +43,7 @@ class Populator /** * @var array> */ - private $invalid_class_storages = []; + private array $invalid_class_storages = []; private Progress $progress; diff --git a/src/Psalm/Internal/Codebase/Properties.php b/src/Psalm/Internal/Codebase/Properties.php index 769cd378c80..ad44695ce87 100644 --- a/src/Psalm/Internal/Codebase/Properties.php +++ b/src/Psalm/Internal/Codebase/Properties.php @@ -29,30 +29,15 @@ class Properties private ClassLikes $classlikes; - /** - * @var bool - */ - public $collect_locations = false; + public bool $collect_locations = false; - /** - * @var FileReferenceProvider - */ - public $file_reference_provider; + public FileReferenceProvider $file_reference_provider; - /** - * @var PropertyExistenceProvider - */ - public $property_existence_provider; + public PropertyExistenceProvider $property_existence_provider; - /** - * @var PropertyTypeProvider - */ - public $property_type_provider; + public PropertyTypeProvider $property_type_provider; - /** - * @var PropertyVisibilityProvider - */ - public $property_visibility_provider; + public PropertyVisibilityProvider $property_visibility_provider; public function __construct( @@ -70,7 +55,6 @@ public function __construct( /** * Whether or not a given property exists - * */ public function propertyExists( string $property_id, diff --git a/src/Psalm/Internal/Codebase/Reflection.php b/src/Psalm/Internal/Codebase/Reflection.php index cd521511f98..a750d4ad673 100644 --- a/src/Psalm/Internal/Codebase/Reflection.php +++ b/src/Psalm/Internal/Codebase/Reflection.php @@ -46,7 +46,7 @@ class Reflection /** * @var array */ - private static $builtin_functions = []; + private static array $builtin_functions = []; public function __construct(ClassLikeStorageProvider $storage_provider, Codebase $codebase) { @@ -355,7 +355,6 @@ private function getReflectionParamData(ReflectionParameter $param): FunctionLik /** * @param callable-string $function_id - * * @return false|null */ public function registerFunction(string $function_id): ?bool @@ -471,7 +470,6 @@ private function registerInheritedMethods( /** * @param lowercase-string $fq_class_name * @param lowercase-string $parent_class - * */ private function registerInheritedProperties( string $fq_class_name, diff --git a/src/Psalm/Internal/Codebase/Scanner.php b/src/Psalm/Internal/Codebase/Scanner.php index 177454a8828..6d4d86d4fcc 100644 --- a/src/Psalm/Internal/Codebase/Scanner.php +++ b/src/Psalm/Internal/Codebase/Scanner.php @@ -90,47 +90,47 @@ class Scanner /** * @var array */ - private $classlike_files = []; + private array $classlike_files = []; /** * @var array */ - private $deep_scanned_classlike_files = []; + private array $deep_scanned_classlike_files = []; /** * @var array */ - private $files_to_scan = []; + private array $files_to_scan = []; /** * @var array */ - private $classes_to_scan = []; + private array $classes_to_scan = []; /** * @var array */ - private $classes_to_deep_scan = []; + private array $classes_to_deep_scan = []; /** * @var array */ - private $files_to_deep_scan = []; + private array $files_to_deep_scan = []; /** * @var array */ - private $scanned_files = []; + private array $scanned_files = []; /** * @var array */ - private $store_scan_failure = []; + private array $store_scan_failure = []; /** * @var array */ - private $reflected_classlikes_lc = []; + private array $reflected_classlikes_lc = []; private Reflection $reflection; @@ -166,7 +166,6 @@ public function __construct( /** * @param array $files_to_scan - * */ public function addFilesToShallowScan(array $files_to_scan): void { @@ -743,7 +742,6 @@ public function getThreadData(): array /** * @param ThreadData $thread_data - * */ public function addThreadData(array $thread_data): void { diff --git a/src/Psalm/Internal/Codebase/TaintFlowGraph.php b/src/Psalm/Internal/Codebase/TaintFlowGraph.php index 17ad6cb2152..5bbf5ff6130 100644 --- a/src/Psalm/Internal/Codebase/TaintFlowGraph.php +++ b/src/Psalm/Internal/Codebase/TaintFlowGraph.php @@ -52,7 +52,7 @@ class TaintFlowGraph extends DataFlowGraph private array $sources = []; /** @var array */ - private $nodes = []; + private array $nodes = []; /** @var array */ private array $sinks = []; diff --git a/src/Psalm/Internal/Codebase/VariableUseGraph.php b/src/Psalm/Internal/Codebase/VariableUseGraph.php index d536a4a71f1..608bfd64519 100644 --- a/src/Psalm/Internal/Codebase/VariableUseGraph.php +++ b/src/Psalm/Internal/Codebase/VariableUseGraph.php @@ -16,7 +16,7 @@ class VariableUseGraph extends DataFlowGraph { /** @var array> */ - protected $backward_edges = []; + protected array $backward_edges = []; /** @var array */ private array $nodes = []; diff --git a/src/Psalm/Internal/DataFlow/DataFlowNode.php b/src/Psalm/Internal/DataFlow/DataFlowNode.php index 95c2327970d..e0c38e03934 100644 --- a/src/Psalm/Internal/DataFlow/DataFlowNode.php +++ b/src/Psalm/Internal/DataFlow/DataFlowNode.php @@ -8,39 +8,33 @@ /** * @psalm-consistent-constructor - * * @internal */ class DataFlowNode { - /** @var string */ - public $id; + public string $id; - /** @var ?string */ - public $unspecialized_id; + public ?string $unspecialized_id = null; - /** @var string */ - public $label; + public string $label; - /** @var ?CodeLocation */ - public $code_location; + public ?CodeLocation $code_location = null; - /** @var ?string */ - public $specialization_key; + public ?string $specialization_key = null; /** @var array */ - public $taints; + public array $taints; /** @var ?self */ - public $previous; + public ?DataFlowNode $previous = null; /** @var list */ - public $path_types = []; + public array $path_types = []; /** * @var array> */ - public $specialized_calls = []; + public array $specialized_calls = []; /** * @param array $taints diff --git a/src/Psalm/Internal/DataFlow/Path.php b/src/Psalm/Internal/DataFlow/Path.php index e28eecb91fd..a6de16c95ee 100644 --- a/src/Psalm/Internal/DataFlow/Path.php +++ b/src/Psalm/Internal/DataFlow/Path.php @@ -6,20 +6,21 @@ /** * @psalm-immutable - * * @internal */ class Path { use ImmutableNonCloneableTrait; - public $type; + public string $type; - public $unescaped_taints; + /** @var ?array */ + public ?array $unescaped_taints = null; - public $escaped_taints; + /** @var ?array */ + public ?array $escaped_taints = null; - public $length; + public int $length; /** * @param ?array $unescaped_taints diff --git a/src/Psalm/Internal/Diff/AstDiffer.php b/src/Psalm/Internal/Diff/AstDiffer.php index 7ab61cee590..5165d47ceb1 100644 --- a/src/Psalm/Internal/Diff/AstDiffer.php +++ b/src/Psalm/Internal/Diff/AstDiffer.php @@ -27,7 +27,6 @@ class AstDiffer * @param Closure(Stmt, Stmt, string, string, bool=): bool $is_equal * @param array $a * @param array $b - * * @return array{0:non-empty-list>, 1: int, 2: int, 3: array} */ protected static function calculateTrace( @@ -79,9 +78,7 @@ protected static function calculateTrace( * @param array $a * @param array $b * @param array $bc - * * @return list - * * @psalm-pure */ protected static function extractDiff(array $trace, int $x, int $y, array $a, array $b, array $bc): array diff --git a/src/Psalm/Internal/Diff/ClassStatementsDiffer.php b/src/Psalm/Internal/Diff/ClassStatementsDiffer.php index ccc6e947815..fed20010c29 100644 --- a/src/Psalm/Internal/Diff/ClassStatementsDiffer.php +++ b/src/Psalm/Internal/Diff/ClassStatementsDiffer.php @@ -21,7 +21,6 @@ class ClassStatementsDiffer extends AstDiffer * * @param array $a * @param array $b - * * @return array{ * 0: list, * 1: list, diff --git a/src/Psalm/Internal/Diff/DiffElem.php b/src/Psalm/Internal/Diff/DiffElem.php index 6d506c70111..b76caab99f9 100644 --- a/src/Psalm/Internal/Diff/DiffElem.php +++ b/src/Psalm/Internal/Diff/DiffElem.php @@ -8,7 +8,6 @@ /** * @internal - * * @psalm-immutable */ class DiffElem @@ -22,7 +21,7 @@ class DiffElem public const TYPE_KEEP_SIGNATURE = 4; /** @var int One of the TYPE_* constants */ - public $type; + public int $type; /** @var mixed Is null for add operations */ public $old; /** @var mixed Is null for remove operations */ diff --git a/src/Psalm/Internal/Diff/FileDiffer.php b/src/Psalm/Internal/Diff/FileDiffer.php index 4e1ee3fd860..6d72bc038ce 100644 --- a/src/Psalm/Internal/Diff/FileDiffer.php +++ b/src/Psalm/Internal/Diff/FileDiffer.php @@ -28,9 +28,7 @@ class FileDiffer /** * @param list $a * @param list $b - * * @return array{0:non-empty-list>, 1: int, 2: int} - * * @psalm-pure */ private static function calculateTrace( @@ -72,9 +70,7 @@ private static function calculateTrace( * @param list> $trace * @param list $a * @param list $b - * * @return list - * * @psalm-pure */ private static function extractDiff(array $trace, int $x, int $y, array $a, array $b): array @@ -125,7 +121,6 @@ private static function extractDiff(array $trace, int $x, int $y, array $a, arra /** * @return array - * * @psalm-pure */ public static function getDiff(string $a_code, string $b_code): array @@ -273,9 +268,7 @@ public static function getDiff(string $a_code, string $b_code): array * Coalesce equal-length sequences of remove+add into a replace operation. * * @param DiffElem[] $diff - * * @return list - * * @psalm-pure */ private static function coalesceReplacements(array $diff): array diff --git a/src/Psalm/Internal/Diff/FileStatementsDiffer.php b/src/Psalm/Internal/Diff/FileStatementsDiffer.php index cb90a339c51..02316c62589 100644 --- a/src/Psalm/Internal/Diff/FileStatementsDiffer.php +++ b/src/Psalm/Internal/Diff/FileStatementsDiffer.php @@ -15,9 +15,9 @@ class FileStatementsDiffer extends AstDiffer { /** * Calculate diff (edit script) from $a to $b. + * * @param list $a * @param list $b - * * @return array{ * 0: list, * 1: list, diff --git a/src/Psalm/Internal/Diff/NamespaceStatementsDiffer.php b/src/Psalm/Internal/Diff/NamespaceStatementsDiffer.php index a3788f848e6..03b5469fba7 100644 --- a/src/Psalm/Internal/Diff/NamespaceStatementsDiffer.php +++ b/src/Psalm/Internal/Diff/NamespaceStatementsDiffer.php @@ -15,9 +15,9 @@ class NamespaceStatementsDiffer extends AstDiffer { /** * Calculate diff (edit script) from $a to $b. + * * @param array $a * @param array $b - * * @return array{ * 0: list, * 1: list, diff --git a/src/Psalm/Internal/EventDispatcher.php b/src/Psalm/Internal/EventDispatcher.php index ad6e091daf1..b42c7b3da36 100644 --- a/src/Psalm/Internal/EventDispatcher.php +++ b/src/Psalm/Internal/EventDispatcher.php @@ -64,7 +64,7 @@ class EventDispatcher * * @var list> */ - public $after_function_checks = []; + public array $after_function_checks = []; /** * Static methods to be called after every function call @@ -75,49 +75,49 @@ class EventDispatcher * * @var list> */ - public $after_every_function_checks = []; + public array $after_every_function_checks = []; /** * Static methods to be called after expression checks have completed * * @var list> */ - public $after_expression_checks = []; + public array $after_expression_checks = []; /** * Static methods to be called before statement checks are processed * * @var list> */ - public $before_statement_checks = []; + public array $before_statement_checks = []; /** * Static methods to be called after statement checks have completed * * @var list> */ - public $after_statement_checks = []; + public array $after_statement_checks = []; /** * Static methods to be called after method checks have completed * * @var list> */ - public $string_interpreters = []; + public array $string_interpreters = []; /** * Static methods to be called after classlike exists checks have completed * * @var list> */ - public $after_classlike_exists_checks = []; + public array $after_classlike_exists_checks = []; /** * Static methods to be called after classlike checks have completed * * @var list> */ - public $after_classlike_checks = []; + public array $after_classlike_checks = []; /** * Static methods to be called after classlikes have been scanned @@ -131,7 +131,7 @@ class EventDispatcher * * @var list> */ - public $after_codebase_populated = []; + public array $after_codebase_populated = []; /** * @var list> @@ -143,42 +143,42 @@ class EventDispatcher * * @var list> */ - public $after_analysis = []; + public array $after_analysis = []; /** * Static methods to be called after a file has been analyzed * * @var list> */ - public $after_file_checks = []; + public array $after_file_checks = []; /** * Static methods to be called before a file is analyzed * * @var list> */ - public $before_file_checks = []; + public array $before_file_checks = []; /** * Static methods to be called after functionlike checks have completed * * @var list> */ - public $after_functionlike_checks = []; + public array $after_functionlike_checks = []; /** * Static methods to be called to see if taints should be added * * @var list> */ - public $add_taints_checks = []; + public array $add_taints_checks = []; /** * Static methods to be called to see if taints should be removed * * @var list> */ - public $remove_taints_checks = []; + public array $remove_taints_checks = []; /** * @param class-string $class diff --git a/src/Psalm/Internal/ExecutionEnvironment/BuildInfoCollector.php b/src/Psalm/Internal/ExecutionEnvironment/BuildInfoCollector.php index 25d731dcc96..2d87476fc77 100644 --- a/src/Psalm/Internal/ExecutionEnvironment/BuildInfoCollector.php +++ b/src/Psalm/Internal/ExecutionEnvironment/BuildInfoCollector.php @@ -18,7 +18,6 @@ * Environment variables collector for CI environment. * * @author Kitamura Satoshi - * * @internal */ class BuildInfoCollector @@ -27,17 +26,13 @@ class BuildInfoCollector * Environment variables. * * Overwritten through collection process. - * - * @var array */ - protected $env; + protected array $env; /** * Read environment variables. - * - * @var array */ - protected $readEnv = []; + protected array $readEnv = []; public function __construct(array $env) { @@ -72,7 +67,6 @@ public function collect(): array * "TRAVIS", "TRAVIS_JOB_ID" must be set. * * @return $this - * * @psalm-suppress PossiblyUndefinedStringArrayOffset */ protected function fillTravisCi(): self @@ -149,7 +143,6 @@ protected function fillCircleCi(): self * "APPVEYOR", "APPVEYOR_BUILD_NUMBER" must be set. * * @psalm-suppress PossiblyUndefinedStringArrayOffset - * * @return $this */ protected function fillAppVeyor(): self @@ -221,7 +214,6 @@ protected function fillJenkins(): self * "JENKINS_URL", "BUILD_NUMBER" must be set. * * @psalm-suppress PossiblyUndefinedStringArrayOffset - * * @return $this */ protected function fillScrutinizer(): self diff --git a/src/Psalm/Internal/ExecutionEnvironment/GitInfoCollector.php b/src/Psalm/Internal/ExecutionEnvironment/GitInfoCollector.php index 68d3ff77eed..d9ec447db52 100644 --- a/src/Psalm/Internal/ExecutionEnvironment/GitInfoCollector.php +++ b/src/Psalm/Internal/ExecutionEnvironment/GitInfoCollector.php @@ -19,17 +19,14 @@ * Git repository info collector. * * @author Kitamura Satoshi - * * @internal */ class GitInfoCollector { /** * Git command. - * - * @var SystemCommandExecutor */ - protected $executor; + protected SystemCommandExecutor $executor; /** * Constructor. @@ -102,7 +99,6 @@ protected function collectCommit(): CommitInfo * Collect remotes info. * * @throws RuntimeException - * * @return list */ protected function collectRemotes(): array diff --git a/src/Psalm/Internal/ExecutionEnvironment/SystemCommandExecutor.php b/src/Psalm/Internal/ExecutionEnvironment/SystemCommandExecutor.php index 97113ea1d17..20aa0383bd0 100644 --- a/src/Psalm/Internal/ExecutionEnvironment/SystemCommandExecutor.php +++ b/src/Psalm/Internal/ExecutionEnvironment/SystemCommandExecutor.php @@ -11,7 +11,6 @@ /** * @author Kitamura Satoshi * @author Dariusz Rumiński - * * @internal */ final class SystemCommandExecutor @@ -19,9 +18,7 @@ final class SystemCommandExecutor /** * Execute command. * - * * @throws RuntimeException - * * @return string[] */ public function execute(string $command): array diff --git a/src/Psalm/Internal/FileManipulation/ClassDocblockManipulator.php b/src/Psalm/Internal/FileManipulation/ClassDocblockManipulator.php index dae0fdccc22..011d7927830 100644 --- a/src/Psalm/Internal/FileManipulation/ClassDocblockManipulator.php +++ b/src/Psalm/Internal/FileManipulation/ClassDocblockManipulator.php @@ -79,7 +79,6 @@ public function makeImmutable(): void /** * Gets a new docblock given the existing docblock, if one exists, and the updated return types * and/or parameters - * */ private function getDocblock(): string { diff --git a/src/Psalm/Internal/FileManipulation/CodeMigration.php b/src/Psalm/Internal/FileManipulation/CodeMigration.php index 31d7be9a99f..641e6aaf5d1 100644 --- a/src/Psalm/Internal/FileManipulation/CodeMigration.php +++ b/src/Psalm/Internal/FileManipulation/CodeMigration.php @@ -6,26 +6,21 @@ /** * @psalm-immutable - * * @internal */ class CodeMigration { use ImmutableNonCloneableTrait; - /** @var string */ - public $source_file_path; - /** @var int */ - public $source_start; + public string $source_file_path; - /** @var int */ - public $source_end; + public int $source_start; - /** @var string */ - public $destination_file_path; + public int $source_end; - /** @var int */ - public $destination_start; + public string $destination_file_path; + + public int $destination_start; public function __construct( string $source_file_path, diff --git a/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php b/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php index 1ed9c6c180b..96f1aa778bb 100644 --- a/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php +++ b/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php @@ -22,14 +22,13 @@ class FileManipulationBuffer { /** @var array */ - private static $file_manipulations = []; + private static array $file_manipulations = []; /** @var CodeMigration[] */ - private static $code_migrations = []; + private static array $code_migrations = []; /** * @param FileManipulation[] $file_manipulations - * */ public static function add(string $file_path, array $file_manipulations): void { diff --git a/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php b/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php index 24c8c180c4d..73c0b5b4c29 100644 --- a/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php +++ b/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php @@ -39,7 +39,7 @@ class FunctionDocblockManipulator * * @var array> */ - private static $manipulators = []; + private static array $manipulators = []; /** @var Closure|Function_|ClassMethod|ArrowFunction */ private $stmt; @@ -265,7 +265,6 @@ private function __construct(string $file_path, FunctionLike $stmt, ProjectAnaly /** * Sets the new return type - * */ public function setReturnType( ?string $php_type, @@ -312,7 +311,6 @@ public function setParamType( /** * Gets a new docblock given the existing docblock, if one exists, and the updated return types * and/or parameters - * */ private function getDocblock(): string { diff --git a/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php b/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php index 3dc2793eed6..009d5619a55 100644 --- a/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php +++ b/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php @@ -153,7 +153,6 @@ public function setType( /** * Gets a new docblock given the existing docblock, if one exists, and the updated return types * and/or parameters - * */ private function getDocblock(): string { diff --git a/src/Psalm/Internal/Fork/ForkProcessDoneMessage.php b/src/Psalm/Internal/Fork/ForkProcessDoneMessage.php index ab407ff5ba5..c845be80315 100644 --- a/src/Psalm/Internal/Fork/ForkProcessDoneMessage.php +++ b/src/Psalm/Internal/Fork/ForkProcessDoneMessage.php @@ -6,7 +6,6 @@ /** * @psalm-immutable - * * @internal */ class ForkProcessDoneMessage implements ForkMessage diff --git a/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php b/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php index f187a63a927..cb75509e6cb 100644 --- a/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php +++ b/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php @@ -6,14 +6,13 @@ /** * @psalm-immutable - * * @internal */ class ForkProcessErrorMessage implements ForkMessage { use ImmutableNonCloneableTrait; - /** @var string */ - public $message; + + public string $message; public function __construct(string $message) { diff --git a/src/Psalm/Internal/Fork/ForkTaskDoneMessage.php b/src/Psalm/Internal/Fork/ForkTaskDoneMessage.php index af545dcfc39..11fff6edbd3 100644 --- a/src/Psalm/Internal/Fork/ForkTaskDoneMessage.php +++ b/src/Psalm/Internal/Fork/ForkTaskDoneMessage.php @@ -6,7 +6,6 @@ /** * @psalm-immutable - * * @internal */ class ForkTaskDoneMessage implements ForkMessage diff --git a/src/Psalm/Internal/Fork/Pool.php b/src/Psalm/Internal/Fork/Pool.php index ef5e871a3ef..ef1f7ecd908 100644 --- a/src/Psalm/Internal/Fork/Pool.php +++ b/src/Psalm/Internal/Fork/Pool.php @@ -86,7 +86,7 @@ class Pool private bool $did_have_error = false; /** @var ?Closure(mixed): void */ - private $task_done_closure; + private ?Closure $task_done_closure = null; public const MAC_PCRE_MESSAGE = 'Mac users: pcre.jit is set to 1 in your PHP config.' . PHP_EOL . 'The pcre jit is known to cause segfaults in PHP 7.3 on Macs, and Psalm' . PHP_EOL @@ -95,7 +95,6 @@ class Pool . 'Relevant info: https://bugs.php.net/bug.php?id=77260'; /** - * @param Config $config * @param array> $process_task_data_iterator * An array of task data items to be divided up among the * workers. The size of this is the number of forked processes. @@ -108,7 +107,6 @@ class Pool * A closure to execute upon shutting down a child * @param Closure(mixed $data):void $task_done_closure * A closure to execute when a task is done - * * @psalm-suppress MixedAssignment */ public function __construct( @@ -279,7 +277,6 @@ public function __construct( * return the stream the parent will use to read results. * * @param resource[] $sockets the socket pair for IPC - * * @return resource */ private static function streamForParent(array $sockets) @@ -305,7 +302,6 @@ private static function streamForParent(array $sockets) * the stream the child will use to write results. * * @param resource[] $sockets the socket pair for IPC - * * @return resource */ private static function streamForChild(array $sockets) @@ -324,9 +320,7 @@ private static function streamForChild(array $sockets) * The results are returned in an array, one for each worker. The order of the results * is not maintained. * - * * @psalm-suppress MixedAssignment - * * @return list */ private function readResultsFromChildren(): array @@ -393,6 +387,7 @@ private function readResultsFromChildren(): array foreach ($this->child_pid_list as $child_pid) { /** * SIGTERM does not exist on windows + * * @psalm-suppress UnusedPsalmSuppress * @psalm-suppress UndefinedConstant * @psalm-suppress MixedArgument @@ -449,6 +444,7 @@ public function wait(): array if ($process_lookup) { /** * SIGALRM does not exist on windows + * * @psalm-suppress UnusedPsalmSuppress * @psalm-suppress UndefinedConstant * @psalm-suppress MixedArgument @@ -467,6 +463,7 @@ public function wait(): array /** * SIGALRM does not exist on windows + * * @psalm-suppress UnusedPsalmSuppress * @psalm-suppress UndefinedConstant */ @@ -483,7 +480,6 @@ public function wait(): array /** * Returns true if this had an error, e.g. due to memory limits or due to a child process crashing. - * */ public function didHaveError(): bool { diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index f751ca93da0..ebc2441afe8 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -30,7 +30,9 @@ public function disableExtension(string $disabledExtension): void /** * No type hint to allow xdebug-handler v1 and v2 usage + * * @param bool $default + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint */ protected function requiresRestart($default): bool { @@ -44,6 +46,7 @@ protected function requiresRestart($default): bool /** * No type hint to allow xdebug-handler v1 and v2 usage + * * @param string|string[] $command */ protected function restart($command): void diff --git a/src/Psalm/Internal/Json/Json.php b/src/Psalm/Internal/Json/Json.php index ab35c3acd7f..10c823d2773 100644 --- a/src/Psalm/Internal/Json/Json.php +++ b/src/Psalm/Internal/Json/Json.php @@ -27,8 +27,6 @@ class Json /** * @param mixed $data - * - * * @psalm-pure */ public static function encode($data, ?int $options = null): string diff --git a/src/Psalm/Internal/LanguageServer/Client/TextDocument.php b/src/Psalm/Internal/LanguageServer/Client/TextDocument.php index 43aad5e1a28..333ebab4e14 100644 --- a/src/Psalm/Internal/LanguageServer/Client/TextDocument.php +++ b/src/Psalm/Internal/LanguageServer/Client/TextDocument.php @@ -49,9 +49,7 @@ public function publishDiagnostics(string $uri, array $diagnostics): void * to request the current content of a text document identified by the URI * * @param TextDocumentIdentifier $textDocument The document to get the content for - * * @return Promise The document's current content - * * @psalm-suppress MixedReturnTypeCoercion due to Psalm bug */ public function xcontent(TextDocumentIdentifier $textDocument): Promise diff --git a/src/Psalm/Internal/LanguageServer/ClientHandler.php b/src/Psalm/Internal/LanguageServer/ClientHandler.php index d884c6a7079..bb16b365b28 100644 --- a/src/Psalm/Internal/LanguageServer/ClientHandler.php +++ b/src/Psalm/Internal/LanguageServer/ClientHandler.php @@ -20,20 +20,11 @@ */ class ClientHandler { - /** - * @var ProtocolReader - */ - public $protocolReader; + public ProtocolReader $protocolReader; - /** - * @var ProtocolWriter - */ - public $protocolWriter; + public ProtocolWriter $protocolWriter; - /** - * @var IdGenerator - */ - public $idGenerator; + public IdGenerator $idGenerator; public function __construct(ProtocolReader $protocolReader, ProtocolWriter $protocolWriter) { @@ -47,7 +38,6 @@ public function __construct(ProtocolReader $protocolReader, ProtocolWriter $prot * * @param string $method The method to call * @param array|object $params The method parameters - * * @return Promise Resolved with the result of the request or rejected with an error */ public function request(string $method, $params): Promise diff --git a/src/Psalm/Internal/LanguageServer/EmitterInterface.php b/src/Psalm/Internal/LanguageServer/EmitterInterface.php index 9f8f80ba0fc..e331456fd11 100644 --- a/src/Psalm/Internal/LanguageServer/EmitterInterface.php +++ b/src/Psalm/Internal/LanguageServer/EmitterInterface.php @@ -65,6 +65,7 @@ public function listeners(string $eventName): array; * * If the listener could not be found, this method will return false. If it * was removed it will return true. + * * @psalm-suppress PossiblyUnusedReturnValue */ public function removeListener(string $eventName, callable $listener): bool; diff --git a/src/Psalm/Internal/LanguageServer/EmitterTrait.php b/src/Psalm/Internal/LanguageServer/EmitterTrait.php index 50535d0ed42..c20ebe3b812 100644 --- a/src/Psalm/Internal/LanguageServer/EmitterTrait.php +++ b/src/Psalm/Internal/LanguageServer/EmitterTrait.php @@ -22,6 +22,7 @@ * @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License + * @internal */ trait EmitterTrait { @@ -30,7 +31,7 @@ trait EmitterTrait * * @var array */ - protected $listeners = []; + protected array $listeners = []; /** * Subscribe to an event. diff --git a/src/Psalm/Internal/LanguageServer/IdGenerator.php b/src/Psalm/Internal/LanguageServer/IdGenerator.php index ebac085c127..330015db5e7 100644 --- a/src/Psalm/Internal/LanguageServer/IdGenerator.php +++ b/src/Psalm/Internal/LanguageServer/IdGenerator.php @@ -11,14 +11,10 @@ */ class IdGenerator { - /** - * @var int - */ - public $counter = 1; + public int $counter = 1; /** * Returns a unique ID - * */ public function generate(): int { diff --git a/src/Psalm/Internal/LanguageServer/LanguageClient.php b/src/Psalm/Internal/LanguageServer/LanguageClient.php index dc828f3c9ff..83f6ac82e49 100644 --- a/src/Psalm/Internal/LanguageServer/LanguageClient.php +++ b/src/Psalm/Internal/LanguageServer/LanguageClient.php @@ -14,10 +14,8 @@ class LanguageClient { /** * Handles textDocument/* methods - * - * @var ClientTextDocument */ - public $textDocument; + public ClientTextDocument $textDocument; /** * The client handler diff --git a/src/Psalm/Internal/LanguageServer/LanguageServer.php b/src/Psalm/Internal/LanguageServer/LanguageServer.php index c032d501cb7..3c4501763fa 100644 --- a/src/Psalm/Internal/LanguageServer/LanguageServer.php +++ b/src/Psalm/Internal/LanguageServer/LanguageServer.php @@ -62,59 +62,43 @@ class LanguageServer extends Dispatcher { /** * Handles textDocument/* method calls - * - * @var ?ServerTextDocument */ - public $textDocument; + public ?ServerTextDocument $textDocument = null; /** * Handles workspace/* method calls - * - * @var ?ServerWorkspace */ - public $workspace; + public ?ServerWorkspace $workspace = null; - /** - * @var ProtocolReader - */ - protected $protocolReader; + protected ProtocolReader $protocolReader; - /** - * @var ProtocolWriter - */ - protected $protocolWriter; + protected ProtocolWriter $protocolWriter; - /** - * @var LanguageClient - */ - public $client; + public LanguageClient $client; - /** - * @var ProjectAnalyzer - */ - protected $project_analyzer; + protected ProjectAnalyzer $project_analyzer; /** * @var array */ - protected $onsave_paths_to_analyze = []; + protected array $onsave_paths_to_analyze = []; /** * @var array */ - protected $onchange_paths_to_analyze = []; + protected array $onchange_paths_to_analyze = []; /** * @var array> */ - protected $current_issues = []; + protected array $current_issues = []; /** * This should actually be a private property on `parent` + * * @psalm-suppress UnusedProperty - * @var JsonMapper */ - protected $mapper; + protected JsonMapper $mapper; public function __construct( ProtocolReader $reader, @@ -311,7 +295,6 @@ function (): Generator { /** * @psalm-suppress PossiblyUnusedMethod - * */ public function initialized(): void { @@ -367,7 +350,6 @@ public function doAnalysis(): void /** * @param array $uris - * */ public function emitIssues(array $uris): void { @@ -440,6 +422,7 @@ public function emitIssues(array $uris): void * The shutdown request is sent from the client to the server. It asks the server to shut down, * but to not exit (otherwise the response might not be delivered correctly to the client). * There is a separate exit notification that asks the server to exit. + * * @psalm-suppress PossiblyUnusedReturnValue */ public function shutdown(): Promise @@ -458,7 +441,6 @@ public function shutdown(): Promise /** * A notification to ask the server to exit its process. - * */ public function exit(): void { @@ -538,8 +520,6 @@ public static function pathToUri(string $filepath): string /** * Transforms URI into file path - * - * */ public static function uriToPath(string $uri): string { diff --git a/src/Psalm/Internal/LanguageServer/Message.php b/src/Psalm/Internal/LanguageServer/Message.php index be3362530de..ba1e73f9622 100644 --- a/src/Psalm/Internal/LanguageServer/Message.php +++ b/src/Psalm/Internal/LanguageServer/Message.php @@ -15,20 +15,16 @@ */ class Message { - /** - * @var ?MessageBody - */ - public $body; + public ?MessageBody $body = null; /** * @var string[] */ - public $headers; + public array $headers; /** * Parses a message * - * * @psalm-suppress UnusedMethod */ public static function parse(string $msg): Message diff --git a/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php b/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php index 944c6af3dd7..b2867d8fa50 100644 --- a/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php +++ b/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php @@ -31,14 +31,12 @@ class ProtocolStreamReader implements ProtocolReader /** * This is checked by ProtocolStreamReader so that it will stop reading from streams in the forked process. * There could be buffered bytes in stdin/over TCP, those would be processed by TCP if it were not for this check. - * - * @var bool */ - private $is_accepting_new_requests = true; + private bool $is_accepting_new_requests = true; private int $parsing_mode = self::PARSE_HEADERS; private string $buffer = ''; /** @var string[] */ - private $headers = []; + private array $headers = []; private ?int $content_length = null; private bool $did_emit_close = false; diff --git a/src/Psalm/Internal/LanguageServer/ProtocolWriter.php b/src/Psalm/Internal/LanguageServer/ProtocolWriter.php index 6d5ce01ec43..a512012a369 100644 --- a/src/Psalm/Internal/LanguageServer/ProtocolWriter.php +++ b/src/Psalm/Internal/LanguageServer/ProtocolWriter.php @@ -11,7 +11,6 @@ interface ProtocolWriter /** * Sends a Message to the client * - * * @return Promise Resolved when the message has been fully written out to the output stream */ public function write(Message $msg): Promise; diff --git a/src/Psalm/Internal/LanguageServer/Server/TextDocument.php b/src/Psalm/Internal/LanguageServer/Server/TextDocument.php index c2ca6fe1d65..45000fd7105 100644 --- a/src/Psalm/Internal/LanguageServer/Server/TextDocument.php +++ b/src/Psalm/Internal/LanguageServer/Server/TextDocument.php @@ -39,20 +39,11 @@ */ class TextDocument { - /** - * @var LanguageServer - */ - protected $server; + protected LanguageServer $server; - /** - * @var Codebase - */ - protected $codebase; + protected Codebase $codebase; - /** - * @var ProjectAnalyzer - */ - protected $project_analyzer; + protected ProjectAnalyzer $project_analyzer; public function __construct( LanguageServer $server, @@ -112,7 +103,6 @@ public function didSave(TextDocumentItem $textDocument, ?string $text): void /** * The document change notification is sent from the client to the server to signal changes to a text document. * - * @param VersionedTextDocumentIdentifier $textDocument * @param TextDocumentContentChangeEvent[] $contentChanges */ public function didChange(VersionedTextDocumentIdentifier $textDocument, array $contentChanges): void @@ -148,7 +138,6 @@ public function didChange(VersionedTextDocumentIdentifier $textDocument, array $ * is independent of whether a text document is open or closed. * * @param TextDocumentIdentifier $textDocument The document that was closed - * */ public function didClose(TextDocumentIdentifier $textDocument): void { @@ -347,7 +336,6 @@ public function signatureHelp(TextDocumentIdentifier $textDocument, Position $po * The code action request is sent from the client to the server to compute commands * for a given text document and range. These commands are typically code fixes to * either fix problems or to beautify/refactor code. - * */ public function codeAction(TextDocumentIdentifier $textDocument, Range $range): Promise { diff --git a/src/Psalm/Internal/LanguageServer/Server/Workspace.php b/src/Psalm/Internal/LanguageServer/Server/Workspace.php index 8af7f1cada0..333c1bb647d 100644 --- a/src/Psalm/Internal/LanguageServer/Server/Workspace.php +++ b/src/Psalm/Internal/LanguageServer/Server/Workspace.php @@ -17,20 +17,11 @@ */ class Workspace { - /** - * @var LanguageServer - */ - protected $server; + protected LanguageServer $server; - /** - * @var Codebase - */ - protected $codebase; + protected Codebase $codebase; - /** - * @var ProjectAnalyzer - */ - protected $project_analyzer; + protected ProjectAnalyzer $project_analyzer; public function __construct( LanguageServer $server, diff --git a/src/Psalm/Internal/MethodIdentifier.php b/src/Psalm/Internal/MethodIdentifier.php index c82d2ba93f9..ad519202430 100644 --- a/src/Psalm/Internal/MethodIdentifier.php +++ b/src/Psalm/Internal/MethodIdentifier.php @@ -13,18 +13,18 @@ /** * @psalm-immutable - * * @internal */ class MethodIdentifier { use ImmutableNonCloneableTrait; - public $fq_class_name; - public $method_name; + public string $fq_class_name; + /** @var lowercase-string */ + public string $method_name; /** - * @param lowercase-string $method_name + * @param lowercase-string $method_name */ public function __construct(string $fq_class_name, string $method_name) { @@ -37,7 +37,6 @@ public function __construct(string $fq_class_name, string $method_name) * it into a MethodIdentifier * * @param string|MethodIdentifier $method_id - * * @psalm-pure */ public static function wrap($method_id): self diff --git a/src/Psalm/Internal/PhpTraverser/CustomTraverser.php b/src/Psalm/Internal/PhpTraverser/CustomTraverser.php index 2f8f6a44d1f..b2ddd40cdb0 100644 --- a/src/Psalm/Internal/PhpTraverser/CustomTraverser.php +++ b/src/Psalm/Internal/PhpTraverser/CustomTraverser.php @@ -27,7 +27,6 @@ public function __construct() * Recursively traverse a node. * * @param Node $node node to traverse - * * @return Node Result of traversal (may be original node or new one) */ protected function traverseNode(Node $node): Node @@ -97,7 +96,6 @@ protected function traverseNode(Node $node): Node * Recursively traverse array (usually of nodes). * * @param array $nodes Array to traverse - * * @return array Result of traversal (may be original array or changed one) */ protected function traverseArray(array $nodes): array diff --git a/src/Psalm/Internal/PhpVisitor/AssignmentMapVisitor.php b/src/Psalm/Internal/PhpVisitor/AssignmentMapVisitor.php index a3fd78e28b8..703db43da3c 100644 --- a/src/Psalm/Internal/PhpVisitor/AssignmentMapVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/AssignmentMapVisitor.php @@ -18,12 +18,9 @@ class AssignmentMapVisitor extends PhpParser\NodeVisitorAbstract /** * @var array> */ - protected $assignment_map = []; + protected array $assignment_map = []; - /** - * @var string|null - */ - protected $this_class_name; + protected ?string $this_class_name = null; public function __construct(?string $this_class_name) { diff --git a/src/Psalm/Internal/PhpVisitor/CheckTrivialExprVisitor.php b/src/Psalm/Internal/PhpVisitor/CheckTrivialExprVisitor.php index a57eeabd5f5..c3289c5e3c4 100644 --- a/src/Psalm/Internal/PhpVisitor/CheckTrivialExprVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/CheckTrivialExprVisitor.php @@ -12,7 +12,7 @@ class CheckTrivialExprVisitor extends PhpParser\NodeVisitorAbstract /** * @var array */ - protected $non_trivial_expr = []; + protected array $non_trivial_expr = []; private function checkNonTrivialExpr(PhpParser\Node\Expr $node): bool { diff --git a/src/Psalm/Internal/PhpVisitor/NodeCounterVisitor.php b/src/Psalm/Internal/PhpVisitor/NodeCounterVisitor.php index dd71903533d..fadcf34e4a0 100644 --- a/src/Psalm/Internal/PhpVisitor/NodeCounterVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/NodeCounterVisitor.php @@ -9,8 +9,7 @@ */ class NodeCounterVisitor extends PhpParser\NodeVisitorAbstract { - /** @var int */ - public $count = 0; + public int $count = 0; public function enterNode(PhpParser\Node $node): ?int { diff --git a/src/Psalm/Internal/PhpVisitor/ParamReplacementVisitor.php b/src/Psalm/Internal/PhpVisitor/ParamReplacementVisitor.php index 087e64f884e..a16bd0e5415 100644 --- a/src/Psalm/Internal/PhpVisitor/ParamReplacementVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/ParamReplacementVisitor.php @@ -21,7 +21,7 @@ class ParamReplacementVisitor extends PhpParser\NodeVisitorAbstract private string $new_name; /** @var list */ - private $replacements = []; + private array $replacements = []; private bool $new_name_replaced = false; diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php index cf8febd6575..43325c41c27 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php @@ -488,9 +488,7 @@ public static function parse( * @param array> $specials * @param 'property'|'psalm-property'|'property-read'| * 'psalm-property-read'|'property-write'|'psalm-property-write' $property_tag - * * @throws DocblockParseException - * */ protected static function addMagicPropertyToInfo( Doc $comment, diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php index b02ba3e5f7a..c2846292a86 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php @@ -107,21 +107,18 @@ class ClassLikeNodeScanner /** * @var array> */ - public $class_template_types = []; + public array $class_template_types = []; - private ?Name $namespace_name; + private ?Name $namespace_name = null; private Aliases $aliases; - /** - * @var ?ClassLikeStorage - */ - public $storage; + public ?ClassLikeStorage $storage = null; /** * @var array */ - public $type_aliases = []; + public array $type_aliases = []; public function __construct( Codebase $codebase, @@ -1682,9 +1679,6 @@ private function visitPropertyDeclaration( } /** - * @param ClassLikeDocblockComment $comment - * @param string $fq_classlike_name - * * @return array */ private function getImportedTypeAliases(ClassLikeDocblockComment $comment, string $fq_classlike_name): array @@ -1771,9 +1765,7 @@ private function getImportedTypeAliases(ClassLikeDocblockComment $comment, strin /** * @param array $type_aliases - * * @return array - * * @throws DocblockParseException if there was a problem parsing the docblock */ public static function getTypeAliasesFromComment( @@ -1804,9 +1796,7 @@ public static function getTypeAliasesFromComment( /** * @param array $type_alias_comment_lines * @param array $type_aliases - * * @return array - * * @throws DocblockParseException if there was a problem parsing the docblock */ private static function getTypeAliasesFromCommentLines( diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockParser.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockParser.php index dd14d0e2397..6fb676f4bb7 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockParser.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockParser.php @@ -664,8 +664,6 @@ private static function checkDuplicatedTags(ParsedDocblock $parsed_docblock): vo /** * @param array $param - * - * * @throws DocblockParseException if a duplicate is found */ private static function checkDuplicatedParams(array $param): void @@ -679,9 +677,7 @@ private static function checkDuplicatedParams(array $param): void /** * @param array $lines - * * @return list - * * @psalm-pure */ private static function extractAllParamNames(array $lines): array diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php index 5e6052ed82a..f5f9d6e07f3 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php @@ -423,7 +423,6 @@ public static function addDocblockInfo( * @param array> $template_types * @param array|null $type_aliases * @param array> $function_template_types - * * @return array{ * array, * array> diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php index 47bacc1011f..f6986f2e13f 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php @@ -78,7 +78,7 @@ class FunctionLikeNodeScanner private FileStorage $file_storage; - private ?ClassLikeStorage $classlike_storage; + private ?ClassLikeStorage $classlike_storage = null; /** * @var array> @@ -92,10 +92,7 @@ class FunctionLikeNodeScanner */ private array $type_aliases; - /** - * @var ?FunctionLikeStorage - */ - public $storage; + public ?FunctionLikeStorage $storage = null; /** * @param array> $existing_function_template_types @@ -123,7 +120,6 @@ public function __construct( /** * @param bool $fake_method in the case of @method annotations we do something a little strange - * * @return FunctionStorage|MethodStorage|false */ public function start(PhpParser\Node\FunctionLike $stmt, bool $fake_method = false) diff --git a/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php b/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php index e0ed99dbbd2..fe0bd1f4a92 100644 --- a/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php @@ -14,7 +14,7 @@ class ShortClosureVisitor extends PhpParser\NodeVisitorAbstract /** * @var array */ - protected $used_variables = []; + protected array $used_variables = []; public function enterNode(PhpParser\Node $node): ?int { diff --git a/src/Psalm/Internal/PhpVisitor/SimpleNameResolver.php b/src/Psalm/Internal/PhpVisitor/SimpleNameResolver.php index f9aaca2378f..be7e6daeb0f 100644 --- a/src/Psalm/Internal/PhpVisitor/SimpleNameResolver.php +++ b/src/Psalm/Internal/PhpVisitor/SimpleNameResolver.php @@ -198,7 +198,6 @@ private function resolveType(?Node $node): ?Node * * @param Name $name Function or constant name to resolve * @param Stmt\Use_::TYPE_* $type One of Stmt\Use_::TYPE_* - * * @return Name Resolved name, or original name with attribute */ protected function resolveName(Name $name, int $type): Name diff --git a/src/Psalm/Internal/PluginManager/ComposerLock.php b/src/Psalm/Internal/PluginManager/ComposerLock.php index 9a003baccbc..8efe3c5818e 100644 --- a/src/Psalm/Internal/PluginManager/ComposerLock.php +++ b/src/Psalm/Internal/PluginManager/ComposerLock.php @@ -28,12 +28,10 @@ public function __construct(array $file_names) /** * @param mixed $package - * * @psalm-assert-if-true array{ * name: string, * extra: array{psalm: array{pluginClass: string}} * } $package - * * @psalm-pure */ public function isPlugin($package): bool diff --git a/src/Psalm/Internal/PluginManager/PluginList.php b/src/Psalm/Internal/PluginManager/PluginList.php index fa06d3b6362..789dcc0ad0a 100644 --- a/src/Psalm/Internal/PluginManager/PluginList.php +++ b/src/Psalm/Internal/PluginManager/PluginList.php @@ -16,7 +16,7 @@ */ class PluginList { - private ?ConfigFile $config_file; + private ?ConfigFile $config_file = null; private ComposerLock $composer_lock; @@ -24,7 +24,7 @@ class PluginList private ?array $all_plugins = null; /** @var ?array [pluginClass => ?packageName] */ - private $enabled_plugins; + private ?array $enabled_plugins = null; public function __construct(?ConfigFile $config_file, ComposerLock $composer_lock) { diff --git a/src/Psalm/Internal/Provider/ClassLikeStorageCacheProvider.php b/src/Psalm/Internal/Provider/ClassLikeStorageCacheProvider.php index 0915d99bf1c..eb1ed14a5ff 100644 --- a/src/Psalm/Internal/Provider/ClassLikeStorageCacheProvider.php +++ b/src/Psalm/Internal/Provider/ClassLikeStorageCacheProvider.php @@ -35,10 +35,7 @@ class ClassLikeStorageCacheProvider { private Config $config; - /** - * @var string - */ - private $modified_timestamps = ''; + private string $modified_timestamps = ''; private const CLASS_CACHE_DIRECTORY = 'class_cache'; diff --git a/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php b/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php index 11f847dccd9..5e9d9e5a9c8 100644 --- a/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php +++ b/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php @@ -19,17 +19,14 @@ class ClassLikeStorageProvider * * @var array */ - private static $storage = []; + private static array $storage = []; /** * @var array */ - private static $new_storage = []; + private static array $new_storage = []; - /** - * @var ?ClassLikeStorageCacheProvider - */ - public $cache; + public ?ClassLikeStorageCacheProvider $cache = null; public function __construct(?ClassLikeStorageCacheProvider $cache = null) { @@ -97,7 +94,6 @@ public function getNew(): array /** * @param array $more - * */ public function addMore(array $more): void { diff --git a/src/Psalm/Internal/Provider/DynamicFunctionStorageProvider.php b/src/Psalm/Internal/Provider/DynamicFunctionStorageProvider.php index 24641a83de9..059fb29ec09 100644 --- a/src/Psalm/Internal/Provider/DynamicFunctionStorageProvider.php +++ b/src/Psalm/Internal/Provider/DynamicFunctionStorageProvider.php @@ -27,7 +27,7 @@ final class DynamicFunctionStorageProvider { /** @var array> */ - private static $handlers = []; + private static array $handlers = []; /** @var array */ private static array $dynamic_storages = []; diff --git a/src/Psalm/Internal/Provider/FakeFileProvider.php b/src/Psalm/Internal/Provider/FakeFileProvider.php index 06405e386f5..47dcb7c552d 100644 --- a/src/Psalm/Internal/Provider/FakeFileProvider.php +++ b/src/Psalm/Internal/Provider/FakeFileProvider.php @@ -13,12 +13,12 @@ class FakeFileProvider extends FileProvider /** * @var array */ - public $fake_files = []; + public array $fake_files = []; /** * @var array */ - public $fake_file_times = []; + public array $fake_file_times = []; public function fileExists(string $file_path): bool { @@ -61,7 +61,6 @@ public function registerFile(string $file_path, string $file_contents): void /** * @param array $file_extensions * @param null|callable(string):bool $filter - * * @return list */ public function getFilesInDir(string $dir_path, array $file_extensions, callable $filter = null): array diff --git a/src/Psalm/Internal/Provider/FileProvider.php b/src/Psalm/Internal/Provider/FileProvider.php index 9c4119644b5..4b6ec34b234 100644 --- a/src/Psalm/Internal/Provider/FileProvider.php +++ b/src/Psalm/Internal/Provider/FileProvider.php @@ -26,12 +26,12 @@ class FileProvider /** * @var array */ - protected $temp_files = []; + protected array $temp_files = []; /** * @var array */ - protected static $open_files = []; + protected static array $open_files = []; /** @psalm-mutation-free */ public function getContents(string $file_path, bool $go_to_source = false): string @@ -126,7 +126,6 @@ public function fileExists(string $file_path): bool /** * @param array $file_extensions * @param null|callable(string):bool $filter - * * @return list */ public function getFilesInDir(string $dir_path, array $file_extensions, callable $filter = null): array diff --git a/src/Psalm/Internal/Provider/FileReferenceCacheProvider.php b/src/Psalm/Internal/Provider/FileReferenceCacheProvider.php index 818bac960f3..3ec71a97fbd 100644 --- a/src/Psalm/Internal/Provider/FileReferenceCacheProvider.php +++ b/src/Psalm/Internal/Provider/FileReferenceCacheProvider.php @@ -27,7 +27,6 @@ * * Used to determine which files reference other files, necessary for using the --diff * option from the command line. - * * @internal */ class FileReferenceCacheProvider @@ -53,10 +52,7 @@ class FileReferenceCacheProvider private const UNKNOWN_MEMBER_CACHE_NAME = 'unknown_member_references'; private const METHOD_PARAM_USE_CACHE_NAME = 'method_param_uses'; - /** - * @var Config - */ - protected $config; + protected Config $config; public function __construct(Config $config) { diff --git a/src/Psalm/Internal/Provider/FileReferenceProvider.php b/src/Psalm/Internal/Provider/FileReferenceProvider.php index af636892be3..5c79ebc0063 100644 --- a/src/Psalm/Internal/Provider/FileReferenceProvider.php +++ b/src/Psalm/Internal/Provider/FileReferenceProvider.php @@ -21,7 +21,6 @@ * * Used to determine which files reference other files, necessary for using the --diff * option from the command line. - * * @internal */ class FileReferenceProvider @@ -34,42 +33,42 @@ class FileReferenceProvider * * @var array> */ - private static $nonmethod_references_to_classes = []; + private static array $nonmethod_references_to_classes = []; /** * A lookup table used for getting all the methods that reference a class * * @var array> */ - private static $method_references_to_classes = []; + private static array $method_references_to_classes = []; /** * A lookup table used for getting all the files that reference a class member * * @var array> */ - private static $file_references_to_class_members = []; + private static array $file_references_to_class_members = []; /** * A lookup table used for getting all the files that reference a class property * * @var array> */ - private static $file_references_to_class_properties = []; + private static array $file_references_to_class_properties = []; /** * A lookup table used for getting all the files that reference a method's return value * * @var array> */ - private static $file_references_to_method_returns = []; + private static array $file_references_to_method_returns = []; /** * A lookup table used for getting all the files that reference a missing class member * * @var array> */ - private static $file_references_to_missing_class_members = []; + private static array $file_references_to_missing_class_members = []; /** * @var array> @@ -88,87 +87,84 @@ class FileReferenceProvider * * @var array, i:array}> */ - private static $file_references = []; + private static array $file_references = []; /** * @var array> */ - private static $method_references_to_class_members = []; + private static array $method_references_to_class_members = []; /** * @var array> */ - private static $method_dependencies = []; + private static array $method_dependencies = []; /** * @var array> */ - private static $method_references_to_class_properties = []; + private static array $method_references_to_class_properties = []; /** * @var array> */ - private static $method_references_to_method_returns = []; + private static array $method_references_to_method_returns = []; /** * @var array> */ - private static $method_references_to_missing_class_members = []; + private static array $method_references_to_missing_class_members = []; /** * @var array> */ - private static $references_to_mixed_member_names = []; + private static array $references_to_mixed_member_names = []; /** * @var array> */ - private static $class_method_locations = []; + private static array $class_method_locations = []; /** * @var array> */ - private static $class_property_locations = []; + private static array $class_property_locations = []; /** * @var array> */ - private static $class_locations = []; + private static array $class_locations = []; /** * @var array */ - private static $classlike_files = []; + private static array $classlike_files = []; /** * @var array> */ - private static $analyzed_methods = []; + private static array $analyzed_methods = []; /** * @var array> */ - private static $issues = []; + private static array $issues = []; /** * @var array */ - private static $file_maps = []; + private static array $file_maps = []; /** * @var array */ - private static $mixed_counts = []; + private static array $mixed_counts = []; /** * @var array>> */ - private static $method_param_uses = []; + private static array $method_param_uses = []; - /** - * @var ?FileReferenceCacheProvider - */ - public $cache; + public ?FileReferenceCacheProvider $cache = null; public function __construct(?FileReferenceCacheProvider $cache = null) { @@ -208,7 +204,6 @@ public function getAllNonMethodReferencesToClasses(): array /** * @param array> $references - * */ public function addNonMethodReferencesToClasses(array $references): void { @@ -288,7 +283,6 @@ public function getAllFileReferencesToMissingClassMembers(): array /** * @param array> $references - * */ public function addFileReferencesToClassMembers(array $references): void { @@ -306,7 +300,6 @@ public function addFileReferencesToClassMembers(array $references): void /** * @param array> $references - * */ public function addFileReferencesToClassProperties(array $references): void { @@ -324,7 +317,6 @@ public function addFileReferencesToClassProperties(array $references): void /** * @param array> $references - * */ public function addFileReferencesToMethodReturns(array $references): void { @@ -342,7 +334,6 @@ public function addFileReferencesToMethodReturns(array $references): void /** * @param array> $references - * */ public function addFileReferencesToMissingClassMembers(array $references): void { @@ -682,7 +673,6 @@ public function loadReferenceCache(bool $force_reload = true): bool /** * @param array $visited_files - * */ public function updateReferenceCache(Codebase $codebase, array $visited_files): void { @@ -853,7 +843,6 @@ public function isMethodParamUsed(string $method_id, int $offset): bool /** * @param array> $references - * */ public function setNonMethodReferencesToClasses(array $references): void { @@ -910,7 +899,6 @@ public function getClassLocations(string $fq_class_name_lc): array /** * @param array> $references - * */ public function addMethodReferencesToClassMembers(array $references): void { @@ -928,7 +916,6 @@ public function addMethodReferencesToClassMembers(array $references): void /** * @param array> $references - * */ public function addMethodDependencies(array $references): void { @@ -946,7 +933,6 @@ public function addMethodDependencies(array $references): void /** * @param array> $references - * */ public function addMethodReferencesToClassProperties(array $references): void { @@ -964,7 +950,6 @@ public function addMethodReferencesToClassProperties(array $references): void /** * @param array> $references - * */ public function addMethodReferencesToMethodReturns(array $references): void { @@ -982,7 +967,6 @@ public function addMethodReferencesToMethodReturns(array $references): void /** * @param array> $references - * */ public function addMethodReferencesToClasses(array $references): void { @@ -1000,7 +984,6 @@ public function addMethodReferencesToClasses(array $references): void /** * @param array> $references - * */ public function addMethodReferencesToMissingClassMembers(array $references): void { @@ -1018,7 +1001,6 @@ public function addMethodReferencesToMissingClassMembers(array $references): voi /** * @param array>> $references - * */ public function addMethodParamUses(array $references): void { @@ -1042,7 +1024,6 @@ public function addMethodParamUses(array $references): void /** * @param array> $references - * */ public function setCallingMethodReferencesToClasses(array $references): void { @@ -1051,7 +1032,6 @@ public function setCallingMethodReferencesToClasses(array $references): void /** * @param array> $references - * */ public function setCallingMethodReferencesToClassMembers(array $references): void { @@ -1060,7 +1040,6 @@ public function setCallingMethodReferencesToClassMembers(array $references): voi /** * @param array> $references - * */ public function setMethodDependencies(array $references): void { @@ -1069,7 +1048,6 @@ public function setMethodDependencies(array $references): void /** * @param array> $references - * */ public function setCallingMethodReferencesToClassProperties(array $references): void { @@ -1078,7 +1056,6 @@ public function setCallingMethodReferencesToClassProperties(array $references): /** * @param array> $references - * */ public function setCallingMethodReferencesToMethodReturns(array $references): void { @@ -1087,7 +1064,6 @@ public function setCallingMethodReferencesToMethodReturns(array $references): vo /** * @param array> $references - * */ public function setCallingMethodReferencesToMissingClassMembers(array $references): void { @@ -1096,7 +1072,6 @@ public function setCallingMethodReferencesToMissingClassMembers(array $reference /** * @param array> $references - * */ public function setFileReferencesToClassMembers(array $references): void { @@ -1105,7 +1080,6 @@ public function setFileReferencesToClassMembers(array $references): void /** * @param array> $references - * */ public function setFileReferencesToClassProperties(array $references): void { @@ -1114,7 +1088,6 @@ public function setFileReferencesToClassProperties(array $references): void /** * @param array> $references - * */ public function setFileReferencesToMethodReturns(array $references): void { @@ -1123,7 +1096,6 @@ public function setFileReferencesToMethodReturns(array $references): void /** * @param array> $references - * */ public function setFileReferencesToMissingClassMembers(array $references): void { @@ -1132,7 +1104,6 @@ public function setFileReferencesToMissingClassMembers(array $references): void /** * @param array> $references - * */ public function setReferencesToMixedMemberNames(array $references): void { @@ -1141,7 +1112,6 @@ public function setReferencesToMixedMemberNames(array $references): void /** * @param array>> $references - * */ public function setMethodParamUses(array $references): void { @@ -1150,7 +1120,6 @@ public function setMethodParamUses(array $references): void /** * @param array> $references - * */ public function addClassMethodLocations(array $references): void { @@ -1168,7 +1137,6 @@ public function addClassMethodLocations(array $references): void /** * @param array> $references - * */ public function addClassPropertyLocations(array $references): void { @@ -1186,7 +1154,6 @@ public function addClassPropertyLocations(array $references): void /** * @param array> $references - * */ public function addClassLocations(array $references): void { @@ -1236,7 +1203,6 @@ public function addIssue(string $file_path, IssueData $issue): void /** * @param array> $analyzed_methods - * */ public function setAnalyzedMethods(array $analyzed_methods): void { @@ -1261,7 +1227,6 @@ public function getTypeCoverage(): array /** * @param array $mixed_counts - * */ public function setTypeCoverage(array $mixed_counts): void { diff --git a/src/Psalm/Internal/Provider/FileStorageCacheProvider.php b/src/Psalm/Internal/Provider/FileStorageCacheProvider.php index 6fb7aa1a78b..03604f270f1 100644 --- a/src/Psalm/Internal/Provider/FileStorageCacheProvider.php +++ b/src/Psalm/Internal/Provider/FileStorageCacheProvider.php @@ -32,10 +32,7 @@ */ class FileStorageCacheProvider { - /** - * @var string - */ - private $modified_timestamps = ''; + private string $modified_timestamps = ''; private Config $config; diff --git a/src/Psalm/Internal/Provider/FileStorageProvider.php b/src/Psalm/Internal/Provider/FileStorageProvider.php index ff48840dec8..946d3c46062 100644 --- a/src/Psalm/Internal/Provider/FileStorageProvider.php +++ b/src/Psalm/Internal/Provider/FileStorageProvider.php @@ -19,7 +19,7 @@ class FileStorageProvider * * @var array */ - private static $storage = []; + private static array $storage = []; /** * A list of data useful to analyse new files @@ -27,12 +27,9 @@ class FileStorageProvider * * @var array */ - private static $new_storage = []; + private static array $new_storage = []; - /** - * @var ?FileStorageCacheProvider - */ - public $cache; + public ?FileStorageCacheProvider $cache = null; public function __construct(?FileStorageCacheProvider $cache = null) { diff --git a/src/Psalm/Internal/Provider/FunctionParamsProvider.php b/src/Psalm/Internal/Provider/FunctionParamsProvider.php index e6949d88ad2..037812ad5b2 100644 --- a/src/Psalm/Internal/Provider/FunctionParamsProvider.php +++ b/src/Psalm/Internal/Provider/FunctionParamsProvider.php @@ -58,7 +58,6 @@ public function has(string $fq_classlike_name): bool /** * @param list $call_args - * * @return ?array */ public function getFunctionParams( diff --git a/src/Psalm/Internal/Provider/MethodParamsProvider.php b/src/Psalm/Internal/Provider/MethodParamsProvider.php index 688f94f8dc8..afecba495ba 100644 --- a/src/Psalm/Internal/Provider/MethodParamsProvider.php +++ b/src/Psalm/Internal/Provider/MethodParamsProvider.php @@ -65,7 +65,6 @@ public function has(string $fq_classlike_name): bool /** * @param ?list $call_args - * * @return ?list */ public function getMethodParams( diff --git a/src/Psalm/Internal/Provider/NodeDataProvider.php b/src/Psalm/Internal/Provider/NodeDataProvider.php index e3d62a55a1b..8b4a2274274 100644 --- a/src/Psalm/Internal/Provider/NodeDataProvider.php +++ b/src/Psalm/Internal/Provider/NodeDataProvider.php @@ -23,21 +23,20 @@ class NodeDataProvider implements NodeTypeProvider { /** @var SplObjectStorage */ - private $node_types; + private SplObjectStorage $node_types; /** * @var SplObjectStorage>>>|null> */ - private $node_assertions; + private SplObjectStorage $node_assertions; /** @var SplObjectStorage> */ - private $node_if_true_assertions; + private SplObjectStorage $node_if_true_assertions; /** @var SplObjectStorage> */ - private $node_if_false_assertions; + private SplObjectStorage $node_if_false_assertions; - /** @var bool */ - public $cache_assertions = true; + public bool $cache_assertions = true; public function __construct() { diff --git a/src/Psalm/Internal/Provider/ParserCacheProvider.php b/src/Psalm/Internal/Provider/ParserCacheProvider.php index 34119906a4b..df13d799aff 100644 --- a/src/Psalm/Internal/Provider/ParserCacheProvider.php +++ b/src/Psalm/Internal/Provider/ParserCacheProvider.php @@ -52,14 +52,14 @@ class ParserCacheProvider * * @var array|null */ - protected $existing_file_content_hashes; + protected ?array $existing_file_content_hashes = null; /** * A map of recently-added filename hashes to contents hashes * * @var array */ - protected $new_file_content_hashes = []; + protected array $new_file_content_hashes = []; private bool $use_file_cache; @@ -255,7 +255,6 @@ public function getNewFileContentHashes(): array /** * @param array $file_content_hashes - * */ public function addNewFileContentHashes(array $file_content_hashes): void { diff --git a/src/Psalm/Internal/Provider/ProjectCacheProvider.php b/src/Psalm/Internal/Provider/ProjectCacheProvider.php index 915af943de6..b97b0c31cac 100644 --- a/src/Psalm/Internal/Provider/ProjectCacheProvider.php +++ b/src/Psalm/Internal/Provider/ProjectCacheProvider.php @@ -25,10 +25,7 @@ class ProjectCacheProvider private const GOOD_RUN_NAME = 'good_run'; private const COMPOSER_LOCK_HASH = 'composer_lock_hash'; - /** - * @var int|null - */ - private $last_run; + private ?int $last_run = null; private ?string $composer_lock_hash = null; diff --git a/src/Psalm/Internal/Provider/Providers.php b/src/Psalm/Internal/Provider/Providers.php index 864dd92a17f..57e0414dffc 100644 --- a/src/Psalm/Internal/Provider/Providers.php +++ b/src/Psalm/Internal/Provider/Providers.php @@ -18,40 +18,19 @@ */ class Providers { - /** - * @var FileProvider - */ - public $file_provider; - - /** - * @var ?ParserCacheProvider - */ - public $parser_cache_provider; - - /** - * @var FileStorageProvider - */ - public $file_storage_provider; - - /** - * @var ClassLikeStorageProvider - */ - public $classlike_storage_provider; - - /** - * @var StatementsProvider - */ - public $statements_provider; - - /** - * @var FileReferenceProvider - */ - public $file_reference_provider; - - /** - * @var ?ProjectCacheProvider - */ - public $project_cache_provider; + public FileProvider $file_provider; + + public ?ParserCacheProvider $parser_cache_provider = null; + + public FileStorageProvider $file_storage_provider; + + public ClassLikeStorageProvider $classlike_storage_provider; + + public StatementsProvider $statements_provider; + + public FileReferenceProvider $file_reference_provider; + + public ?ProjectCacheProvider $project_cache_provider = null; public function __construct( FileProvider $file_provider, diff --git a/src/Psalm/Internal/Provider/StatementsProvider.php b/src/Psalm/Internal/Provider/StatementsProvider.php index bd208a06023..ab8ee607945 100644 --- a/src/Psalm/Internal/Provider/StatementsProvider.php +++ b/src/Psalm/Internal/Provider/StatementsProvider.php @@ -43,34 +43,31 @@ class StatementsProvider { private FileProvider $file_provider; - /** - * @var ?ParserCacheProvider - */ - public $parser_cache_provider; + public ?ParserCacheProvider $parser_cache_provider = null; /** * @var int|bool */ private $this_modified_time; - private ?FileStorageCacheProvider $file_storage_cache_provider; + private ?FileStorageCacheProvider $file_storage_cache_provider = null; private StatementsVolatileCache $statements_volatile_cache; /** * @var array> */ - private $unchanged_members = []; + private array $unchanged_members = []; /** * @var array> */ - private $unchanged_signature_members = []; + private array $unchanged_signature_members = []; /** * @var array> */ - private $changed_members = []; + private array $changed_members = []; /** * @var array @@ -80,12 +77,12 @@ class StatementsProvider /** * @var array> */ - private $diff_map = []; + private array $diff_map = []; /** * @var array> */ - private $deletion_ranges = []; + private array $deletion_ranges = []; private static ?Emulative $lexer = null; @@ -301,7 +298,6 @@ public function getChangedMembers(): array /** * @param array> $more_changed_members - * */ public function addChangedMembers(array $more_changed_members): void { @@ -318,7 +314,6 @@ public function getUnchangedSignatureMembers(): array /** * @param array> $more_unchanged_members - * */ public function addUnchangedSignatureMembers(array $more_unchanged_members): void { @@ -335,7 +330,6 @@ public function getErrors(): array /** * @param array $errors - * */ public function addErrors(array $errors): void { @@ -371,7 +365,6 @@ public function getDeletionRanges(): array /** * @param array> $diff_map - * */ public function addDiffMap(array $diff_map): void { @@ -380,7 +373,6 @@ public function addDiffMap(array $diff_map): void /** * @param array> $deletion_ranges - * */ public function addDeletionRanges(array $deletion_ranges): void { @@ -399,7 +391,6 @@ public function resetDiffs(): void /** * @param list $existing_statements * @param array $file_changes - * * @return list */ public static function parseStatements( diff --git a/src/Psalm/Internal/Provider/StatementsVolatileCache.php b/src/Psalm/Internal/Provider/StatementsVolatileCache.php index 2dd19ea1030..e9fef387164 100644 --- a/src/Psalm/Internal/Provider/StatementsVolatileCache.php +++ b/src/Psalm/Internal/Provider/StatementsVolatileCache.php @@ -22,22 +22,16 @@ final class StatementsVolatileCache /** * @var array> */ - protected $cache = []; + protected array $cache = []; /** * @var array */ - protected $access = []; + protected array $access = []; - /** - * @var int - */ - protected $max_size; + protected int $max_size; - /** - * @var ?StatementsVolatileCache - */ - protected static $instance; + protected static ?StatementsVolatileCache $instance = null; public function __construct(int $max_size = 4096) { @@ -59,7 +53,6 @@ public function has(string $key): bool } /** - * @param string $key * @return list * @throws InvalidArgumentException */ @@ -79,7 +72,6 @@ public function get(string $key): array } /** - * @param string $key * @param list $content */ public function set(string $key, array $content): void diff --git a/src/Psalm/Internal/ReferenceConstraint.php b/src/Psalm/Internal/ReferenceConstraint.php index a77ec7ec648..64db0e24344 100644 --- a/src/Psalm/Internal/ReferenceConstraint.php +++ b/src/Psalm/Internal/ReferenceConstraint.php @@ -12,8 +12,7 @@ */ class ReferenceConstraint { - /** @var Union|null */ - public $type; + public ?Union $type = null; public function __construct(?Union $type = null) { diff --git a/src/Psalm/Internal/Scanner/ClassLikeDocblockComment.php b/src/Psalm/Internal/Scanner/ClassLikeDocblockComment.php index 2e51824806f..0b865ba01b9 100644 --- a/src/Psalm/Internal/Scanner/ClassLikeDocblockComment.php +++ b/src/Psalm/Internal/Scanner/ClassLikeDocblockComment.php @@ -11,137 +11,94 @@ class ClassLikeDocblockComment { /** * Whether or not the class is deprecated - * - * @var bool */ - public $deprecated = false; + public bool $deprecated = false; /** * Whether or not the class is internal - * - * @var bool */ - public $internal = false; + public bool $internal = false; /** * Whether or not the class is final - * - * @var bool */ - public $final = false; + public bool $final = false; /** * If set, the class is internal to the given namespace. * * @var list */ - public $psalm_internal = []; + public array $psalm_internal = []; /** * @var string[] */ - public $mixins = []; + public array $mixins = []; /** * @var array */ - public $templates = []; + public array $templates = []; /** * @var array */ - public $template_extends = []; + public array $template_extends = []; /** * @var array */ - public $template_implements = []; + public array $template_implements = []; - /** - * @var ?string - */ - public $yield; + public ?string $yield = null; /** * @var array */ - public $properties = []; + public array $properties = []; /** * @var array */ - public $methods = []; + public array $methods = []; - /** - * @var bool - */ - public $sealed_properties = false; + public bool $sealed_properties = false; - /** - * @var bool - */ - public $sealed_methods = false; + public bool $sealed_methods = false; - /** - * @var bool - */ - public $override_property_visibility = false; + public bool $override_property_visibility = false; - /** - * @var bool - */ - public $override_method_visibility = false; + public bool $override_method_visibility = false; - /** - * @var bool - */ - public $mutation_free = false; + public bool $mutation_free = false; - /** - * @var bool - */ - public $external_mutation_free = false; + public bool $external_mutation_free = false; - /** - * @var bool - */ - public $taint_specialize = false; + public bool $taint_specialize = false; /** * @var array */ - public $suppressed_issues = []; + public array $suppressed_issues = []; /** * @var list}> */ - public $imported_types = []; + public array $imported_types = []; - /** - * @var bool - */ - public $consistent_constructor = false; + public bool $consistent_constructor = false; - /** - * @var bool - */ - public $consistent_templates = false; + public bool $consistent_templates = false; - /** @var bool */ - public $stub_override = false; + public bool $stub_override = false; - /** - * @var null|string - */ - public $extension_requirement; + public ?string $extension_requirement = null; /** * @var array */ - public $implementation_requirements = []; + public array $implementation_requirements = []; - /** - * @var ?string - */ - public $description; + public ?string $description = null; } diff --git a/src/Psalm/Internal/Scanner/FileScanner.php b/src/Psalm/Internal/Scanner/FileScanner.php index a8b3f72bddf..62b17bfc06c 100644 --- a/src/Psalm/Internal/Scanner/FileScanner.php +++ b/src/Psalm/Internal/Scanner/FileScanner.php @@ -18,20 +18,11 @@ */ class FileScanner implements FileSource { - /** - * @var string - */ - public $file_path; - - /** - * @var string - */ - public $file_name; - - /** - * @var bool - */ - public $will_analyze; + public string $file_path; + + public string $file_name; + + public bool $will_analyze; public function __construct(string $file_path, string $file_name, bool $will_analyze) { diff --git a/src/Psalm/Internal/Scanner/FunctionDocblockComment.php b/src/Psalm/Internal/Scanner/FunctionDocblockComment.php index a3819b4acf7..74b315600c7 100644 --- a/src/Psalm/Internal/Scanner/FunctionDocblockComment.php +++ b/src/Psalm/Internal/Scanner/FunctionDocblockComment.php @@ -7,30 +7,15 @@ */ class FunctionDocblockComment { - /** - * @var string|null - */ - public $return_type; + public ?string $return_type = null; - /** - * @var string|null - */ - public $return_type_description; + public ?string $return_type_description = null; - /** - * @var int|null - */ - public $return_type_start; + public ?int $return_type_start = null; - /** - * @var int|null - */ - public $return_type_end; + public ?int $return_type_end = null; - /** - * @var int|null - */ - public $return_type_line_number; + public ?int $return_type_line_number = null; /** * @var array< @@ -45,184 +30,148 @@ class FunctionDocblockComment * } * > */ - public $params = []; + public array $params = []; /** * @var array */ - public $params_out = []; + public array $params_out = []; /** * @var array{type:string, line_number: int}|null */ - public $self_out; + public ?array $self_out = null; /** * @var array{type:string, line_number: int}|null */ - public $if_this_is; + public ?array $if_this_is = null; /** * @var array */ - public $globals = []; + public array $globals = []; /** * Whether or not the function is deprecated - * - * @var bool */ - public $deprecated = false; + public bool $deprecated = false; /** * If set, the function is internal to the given namespace. * * @var list */ - public $psalm_internal = []; + public array $psalm_internal = []; /** * Whether or not the function is internal - * - * @var bool */ - public $internal = false; + public bool $internal = false; /** * Whether or not the function uses get_args - * - * @var bool */ - public $variadic = false; + public bool $variadic = false; /** * Whether or not the function is pure - * - * @var bool */ - public $pure = false; + public bool $pure = false; /** * Whether or not to specialize a given call (useful for taint analysis) - * - * @var bool */ - public $specialize_call = false; + public bool $specialize_call = false; /** * Represents the flow from function params to return type * * @var array */ - public $flows = []; + public array $flows = []; /** * @var array */ - public $added_taints = []; + public array $added_taints = []; /** * @var array */ - public $removed_taints = []; + public array $removed_taints = []; /** * @var array */ - public $taint_sink_params = []; + public array $taint_sink_params = []; /** * @var array */ - public $taint_source_types = []; + public array $taint_source_types = []; /** * @var array */ - public $assert_untainted_params = []; + public array $assert_untainted_params = []; /** * Whether or not to ignore the nullability of this function's return type - * - * @var bool */ - public $ignore_nullable_return = false; + public bool $ignore_nullable_return = false; /** * Whether or not to ignore the nullability of this function's return type - * - * @var bool */ - public $ignore_falsable_return = false; + public bool $ignore_falsable_return = false; /** * @var array */ - public $suppressed_issues = []; + public array $suppressed_issues = []; /** * @var array */ - public $throws = []; + public array $throws = []; /** * @var array */ - public $templates = []; + public array $templates = []; /** * @var array */ - public $assertions = []; + public array $assertions = []; /** * @var array */ - public $if_true_assertions = []; + public array $if_true_assertions = []; /** * @var array */ - public $if_false_assertions = []; + public array $if_false_assertions = []; - /** - * @var bool - */ - public $inheritdoc = false; + public bool $inheritdoc = false; - /** - * @var bool - */ - public $mutation_free = false; + public bool $mutation_free = false; - /** - * @var bool - */ - public $external_mutation_free = false; + public bool $external_mutation_free = false; - /** - * @var bool - */ - public $no_named_args = false; + public bool $no_named_args = false; - /** @var bool */ - public $stub_override = false; + public bool $stub_override = false; - /** - * @var int - */ - public $since_php_major_version = 0; + public int $since_php_major_version = 0; - /** - * @var int - */ - public $since_php_minor_version = 0; + public int $since_php_minor_version = 0; - /** - * @var ?string - */ - public $description; + public ?string $description = null; /** @var array, suggested_replacement?:string}> */ - public $unexpected_tags = []; + public array $unexpected_tags = []; } diff --git a/src/Psalm/Internal/Scanner/ParsedDocblock.php b/src/Psalm/Internal/Scanner/ParsedDocblock.php index 650a444780c..1e5b0f89692 100644 --- a/src/Psalm/Internal/Scanner/ParsedDocblock.php +++ b/src/Psalm/Internal/Scanner/ParsedDocblock.php @@ -10,17 +10,15 @@ */ class ParsedDocblock { - /** @var string */ - public $description; + public string $description; - /** @var string */ - public $first_line_padding; + public string $first_line_padding; /** @var array> */ - public $tags = []; + public array $tags = []; /** @var array> */ - public $combined_tags = []; + public array $combined_tags = []; private static bool $shouldAddNewLineBetweenAnnotations = true; @@ -81,7 +79,6 @@ private static function shouldAddNewLineBetweenAnnotations(): bool /** * Sets whether a new line should be added between the annotations or not. - * */ public static function addNewLineBetweenAnnotations(bool $should = true): void { diff --git a/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php b/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php index 63e316a9389..d6a50313832 100644 --- a/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php +++ b/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php @@ -100,9 +100,6 @@ public static function handleOverride(array $args, Codebase $codebase): void $codebase->methods->return_type_provider->registerClosure( $meta_fq_classlike_name, - /** - * @param list $call_args - */ static function ( MethodReturnTypeProviderEvent $event ) use ( @@ -156,9 +153,6 @@ static function ( } elseif ($type_offset !== null) { $codebase->methods->return_type_provider->registerClosure( $meta_fq_classlike_name, - /** - * @param list $call_args - */ static function ( MethodReturnTypeProviderEvent $event ) use ( @@ -193,9 +187,6 @@ static function ( } elseif ($element_type_offset !== null) { $codebase->methods->return_type_provider->registerClosure( $meta_fq_classlike_name, - /** - * @param list $call_args - */ static function ( MethodReturnTypeProviderEvent $event ) use ( @@ -252,10 +243,6 @@ static function ( $codebase->functions->return_type_provider->registerClosure( $function_id, - /** - * @param non-empty-string $function_id - * @param list $call_args - */ static function ( FunctionReturnTypeProviderEvent $event ) use ( @@ -306,10 +293,6 @@ static function ( } elseif ($type_offset !== null) { $codebase->functions->return_type_provider->registerClosure( $function_id, - /** - * @param non-empty-string $function_id - * @param list $call_args - */ static function ( FunctionReturnTypeProviderEvent $event ) use ( @@ -340,10 +323,6 @@ static function ( } elseif ($element_type_offset !== null) { $codebase->functions->return_type_provider->registerClosure( $function_id, - /** - * @param non-empty-string $function_id - * @param list $call_args - */ static function ( FunctionReturnTypeProviderEvent $event ) use ( diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php index bdb2c16f51e..dcff9097691 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php @@ -6,16 +6,13 @@ /** * @psalm-immutable - * * @internal */ class ArrayOffsetFetch extends UnresolvedConstantComponent { - /** @var UnresolvedConstantComponent */ - public $array; + public UnresolvedConstantComponent $array; - /** @var UnresolvedConstantComponent */ - public $offset; + public UnresolvedConstantComponent $offset; public function __construct(UnresolvedConstantComponent $left, UnresolvedConstantComponent $right) { diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArraySpread.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArraySpread.php index 9bd4d069a61..7078bdcc671 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArraySpread.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArraySpread.php @@ -6,13 +6,11 @@ /** * @psalm-immutable - * * @internal */ class ArraySpread extends UnresolvedConstantComponent { - /** @var UnresolvedConstantComponent */ - public $array; + public UnresolvedConstantComponent $array; public function __construct(UnresolvedConstantComponent $array) { diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayValue.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayValue.php index 94a246ac31d..eb56c44533b 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayValue.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayValue.php @@ -6,13 +6,12 @@ /** * @psalm-immutable - * * @internal */ class ArrayValue extends UnresolvedConstantComponent { /** @var array */ - public $entries; + public array $entries; /** @param list $entries */ public function __construct(array $entries) diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/ClassConstant.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/ClassConstant.php index 041f02fa2df..e75bd93b318 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/ClassConstant.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/ClassConstant.php @@ -6,16 +6,13 @@ /** * @psalm-immutable - * * @internal */ class ClassConstant extends UnresolvedConstantComponent { - /** @var string */ - public $fqcln; + public string $fqcln; - /** @var string */ - public $name; + public string $name; public function __construct(string $fqcln, string $name) { diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/Constant.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/Constant.php index 5e7d2950872..f7363e5dafc 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/Constant.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/Constant.php @@ -6,16 +6,13 @@ /** * @psalm-immutable - * * @internal */ class Constant extends UnresolvedConstantComponent { - /** @var string */ - public $name; + public string $name; - /** @var bool */ - public $is_fully_qualified; + public bool $is_fully_qualified; public function __construct(string $name, bool $is_fully_qualified) { diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/KeyValuePair.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/KeyValuePair.php index e75c68dae22..607bc7a58f8 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/KeyValuePair.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/KeyValuePair.php @@ -6,16 +6,13 @@ /** * @psalm-immutable - * * @internal */ class KeyValuePair extends UnresolvedConstantComponent { - /** @var ?UnresolvedConstantComponent */ - public $key; + public ?UnresolvedConstantComponent $key = null; - /** @var UnresolvedConstantComponent */ - public $value; + public UnresolvedConstantComponent $value; public function __construct(?UnresolvedConstantComponent $key, UnresolvedConstantComponent $value) { diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/ScalarValue.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/ScalarValue.php index 757bcdcef0d..688387ef6c1 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/ScalarValue.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/ScalarValue.php @@ -6,7 +6,6 @@ /** * @psalm-immutable - * * @internal */ class ScalarValue extends UnresolvedConstantComponent diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php index 565f76a9309..64c33e5874f 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php @@ -4,7 +4,6 @@ /** * @psalm-immutable - * * @internal */ class UnresolvedAdditionOp extends UnresolvedBinaryOp diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBinaryOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBinaryOp.php index 25966b7ff19..0dda5e247b6 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBinaryOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBinaryOp.php @@ -7,18 +7,15 @@ /** * @psalm-immutable - * * @internal */ abstract class UnresolvedBinaryOp extends UnresolvedConstantComponent { use ImmutableNonCloneableTrait; - /** @var UnresolvedConstantComponent */ - public $left; + public UnresolvedConstantComponent $left; - /** @var UnresolvedConstantComponent */ - public $right; + public UnresolvedConstantComponent $right; public function __construct(UnresolvedConstantComponent $left, UnresolvedConstantComponent $right) { diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseAnd.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseAnd.php index 2b59f99a33a..bbd471f08e7 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseAnd.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseAnd.php @@ -4,7 +4,6 @@ /** * @psalm-immutable - * * @internal */ class UnresolvedBitwiseAnd extends UnresolvedBinaryOp diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseOr.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseOr.php index e6f2c08a626..6995432d1fe 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseOr.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseOr.php @@ -4,7 +4,6 @@ /** * @psalm-immutable - * * @internal */ class UnresolvedBitwiseOr extends UnresolvedBinaryOp diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseXor.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseXor.php index c9ff455bfda..d2070eb941e 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseXor.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseXor.php @@ -4,7 +4,6 @@ /** * @psalm-immutable - * * @internal */ class UnresolvedBitwiseXor extends UnresolvedBinaryOp diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedConcatOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedConcatOp.php index ea89992649f..2d7910ead63 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedConcatOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedConcatOp.php @@ -6,7 +6,6 @@ /** * @psalm-immutable - * * @internal */ class UnresolvedConcatOp extends UnresolvedBinaryOp diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedDivisionOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedDivisionOp.php index 90b827a9fea..00ee1dd6be8 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedDivisionOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedDivisionOp.php @@ -6,7 +6,6 @@ /** * @psalm-immutable - * * @internal */ class UnresolvedDivisionOp extends UnresolvedBinaryOp diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedMultiplicationOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedMultiplicationOp.php index 38417e145e1..f167d9d8fc7 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedMultiplicationOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedMultiplicationOp.php @@ -6,7 +6,6 @@ /** * @psalm-immutable - * * @internal */ class UnresolvedMultiplicationOp extends UnresolvedBinaryOp diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedSubtractionOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedSubtractionOp.php index 27d25ccea6c..2b111f3aeda 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedSubtractionOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedSubtractionOp.php @@ -6,7 +6,6 @@ /** * @psalm-immutable - * * @internal */ class UnresolvedSubtractionOp extends UnresolvedBinaryOp diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedTernary.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedTernary.php index c2af781b860..294b129e01c 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedTernary.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedTernary.php @@ -7,19 +7,17 @@ /** * @psalm-immutable - * * @internal */ class UnresolvedTernary extends UnresolvedConstantComponent { use ImmutableNonCloneableTrait; - /** @var UnresolvedConstantComponent */ - public $cond; - /** @var UnresolvedConstantComponent|null */ - public $if; - /** @var UnresolvedConstantComponent */ - public $else; + public UnresolvedConstantComponent $cond; + + public ?UnresolvedConstantComponent $if = null; + + public UnresolvedConstantComponent $else; public function __construct( UnresolvedConstantComponent $cond, diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstantComponent.php b/src/Psalm/Internal/Scanner/UnresolvedConstantComponent.php index 746fa6c456a..caede827d93 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstantComponent.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstantComponent.php @@ -6,7 +6,6 @@ /** * @psalm-immutable - * * @internal */ abstract class UnresolvedConstantComponent diff --git a/src/Psalm/Internal/Scanner/VarDocblockComment.php b/src/Psalm/Internal/Scanner/VarDocblockComment.php index 8797530a664..4a1651c9044 100644 --- a/src/Psalm/Internal/Scanner/VarDocblockComment.php +++ b/src/Psalm/Internal/Scanner/VarDocblockComment.php @@ -9,78 +9,52 @@ */ class VarDocblockComment { - /** - * @var ?Union - */ - public $type; + public ?Union $type = null; - /** - * @var string|null - */ - public $var_id; + public ?string $var_id = null; - /** - * @var int|null - */ - public $line_number; + public ?int $line_number = null; - /** - * @var int|null - */ - public $type_start; + public ?int $type_start = null; - /** - * @var int|null - */ - public $type_end; + public ?int $type_end = null; /** * Whether or not the property is deprecated - * - * @var bool */ - public $deprecated = false; + public bool $deprecated = false; /** * Whether or not the property is internal - * - * @var bool */ - public $internal = false; + public bool $internal = false; /** * If set, the property is internal to the given namespace. * * @var list */ - public $psalm_internal = []; + public array $psalm_internal = []; /** * Whether or not the property is readonly - * - * @var bool */ - public $readonly = false; + public bool $readonly = false; /** * Whether or not to allow mutation by internal methods - * - * @var bool */ - public $allow_private_mutation = false; + public bool $allow_private_mutation = false; /** * @var list */ - public $removed_taints = []; + public array $removed_taints = []; /** * @var array */ - public $suppressed_issues = []; + public array $suppressed_issues = []; - /** - * @var ?string - */ - public $description; + public ?string $description = null; } diff --git a/src/Psalm/Internal/Scope/CaseScope.php b/src/Psalm/Internal/Scope/CaseScope.php index a7ce48edf6d..a96832f4eff 100644 --- a/src/Psalm/Internal/Scope/CaseScope.php +++ b/src/Psalm/Internal/Scope/CaseScope.php @@ -10,15 +10,12 @@ */ class CaseScope { - /** - * @var Context - */ - public $parent_context; + public Context $parent_context; /** * @var array|null */ - public $break_vars; + public ?array $break_vars = null; public function __construct(Context $parent_context) { diff --git a/src/Psalm/Internal/Scope/FinallyScope.php b/src/Psalm/Internal/Scope/FinallyScope.php index 0343f193002..4fcda32379f 100644 --- a/src/Psalm/Internal/Scope/FinallyScope.php +++ b/src/Psalm/Internal/Scope/FinallyScope.php @@ -12,7 +12,7 @@ class FinallyScope /** * @var array */ - public $vars_in_scope = []; + public array $vars_in_scope = []; /** * @param array $vars_in_scope diff --git a/src/Psalm/Internal/Scope/IfConditionalScope.php b/src/Psalm/Internal/Scope/IfConditionalScope.php index 1f98135a08a..5d7579c594e 100644 --- a/src/Psalm/Internal/Scope/IfConditionalScope.php +++ b/src/Psalm/Internal/Scope/IfConditionalScope.php @@ -10,24 +10,22 @@ */ class IfConditionalScope { - /** @var Context */ - public $if_context; + public Context $if_context; - /** @var Context */ - public $post_if_context; + public Context $post_if_context; /** * @var array */ - public $cond_referenced_var_ids; + public array $cond_referenced_var_ids; /** * @var array */ - public $assigned_in_conditional_var_ids; + public array $assigned_in_conditional_var_ids; /** @var list */ - public $entry_clauses; + public array $entry_clauses; /** * @param array $cond_referenced_var_ids diff --git a/src/Psalm/Internal/Scope/IfScope.php b/src/Psalm/Internal/Scope/IfScope.php index 696e405ee10..27a5181d970 100644 --- a/src/Psalm/Internal/Scope/IfScope.php +++ b/src/Psalm/Internal/Scope/IfScope.php @@ -15,57 +15,57 @@ class IfScope /** * @var array|null */ - public $new_vars; + public ?array $new_vars = null; /** * @var array */ - public $new_vars_possibly_in_scope = []; + public array $new_vars_possibly_in_scope = []; /** * @var array|null */ - public $redefined_vars; + public ?array $redefined_vars = null; /** * @var array|null */ - public $assigned_var_ids; + public ?array $assigned_var_ids = null; /** * @var array */ - public $possibly_assigned_var_ids = []; + public array $possibly_assigned_var_ids = []; /** * @var array */ - public $possibly_redefined_vars = []; + public array $possibly_redefined_vars = []; /** * @var array */ - public $updated_vars = []; + public array $updated_vars = []; /** * @var array>> */ - public $negated_types = []; + public array $negated_types = []; /** * @var array */ - public $if_cond_changed_var_ids = []; + public array $if_cond_changed_var_ids = []; /** * @var array|null */ - public $negatable_if_types; + public ?array $negatable_if_types = null; /** * @var list */ - public $negated_clauses = []; + public array $negated_clauses = []; /** * These are the set of clauses that could be applied after the `if` @@ -74,20 +74,17 @@ class IfScope * * @var list */ - public $reasonable_clauses = []; + public array $reasonable_clauses = []; /** * @var string[] */ - public $if_actions = []; + public array $if_actions = []; /** * @var string[] */ - public $final_actions = []; + public array $final_actions = []; - /** - * @var ?Context - */ - public $post_leaving_if_context; + public ?Context $post_leaving_if_context = null; } diff --git a/src/Psalm/Internal/Scope/LoopScope.php b/src/Psalm/Internal/Scope/LoopScope.php index 90163c1a300..1eb1fa0026e 100644 --- a/src/Psalm/Internal/Scope/LoopScope.php +++ b/src/Psalm/Internal/Scope/LoopScope.php @@ -10,55 +10,46 @@ */ class LoopScope { - /** - * @var int - */ - public $iteration_count = 0; + public int $iteration_count = 0; - /** - * @var Context - */ - public $loop_context; + public Context $loop_context; - /** - * @var Context - */ - public $loop_parent_context; + public Context $loop_parent_context; /** * @var array */ - public $redefined_loop_vars = []; + public array $redefined_loop_vars = []; /** * @var array */ - public $possibly_redefined_loop_vars = []; + public array $possibly_redefined_loop_vars = []; /** * @var array */ - public $possibly_redefined_loop_parent_vars = []; + public array $possibly_redefined_loop_parent_vars = []; /** * @var array */ - public $possibly_defined_loop_parent_vars = []; + public array $possibly_defined_loop_parent_vars = []; /** * @var array */ - public $vars_possibly_in_scope = []; + public array $vars_possibly_in_scope = []; /** * @var array */ - public $protected_var_ids = []; + public array $protected_var_ids = []; /** * @var string[] */ - public $final_actions = []; + public array $final_actions = []; public function __construct(Context $loop_context, Context $parent_context) { diff --git a/src/Psalm/Internal/Scope/SwitchScope.php b/src/Psalm/Internal/Scope/SwitchScope.php index 35bb99cae84..64937c78ae3 100644 --- a/src/Psalm/Internal/Scope/SwitchScope.php +++ b/src/Psalm/Internal/Scope/SwitchScope.php @@ -14,40 +14,37 @@ class SwitchScope /** * @var array|null */ - public $new_vars_in_scope; + public ?array $new_vars_in_scope = null; /** * @var array */ - public $new_vars_possibly_in_scope = []; + public array $new_vars_possibly_in_scope = []; /** * @var array|null */ - public $redefined_vars; + public ?array $redefined_vars = null; /** * @var array|null */ - public $possibly_redefined_vars; + public ?array $possibly_redefined_vars = null; /** * @var array */ - public $leftover_statements = []; + public array $leftover_statements = []; - /** - * @var PhpParser\Node\Expr|null - */ - public $leftover_case_equality_expr; + public ?PhpParser\Node\Expr $leftover_case_equality_expr = null; /** * @var list */ - public $negated_clauses = []; + public array $negated_clauses = []; /** * @var array|null */ - public $new_assigned_var_ids; + public ?array $new_assigned_var_ids = null; } diff --git a/src/Psalm/Internal/Type/ArrayType.php b/src/Psalm/Internal/Type/ArrayType.php index 3b170c5bef1..afbce6d2f8f 100644 --- a/src/Psalm/Internal/Type/ArrayType.php +++ b/src/Psalm/Internal/Type/ArrayType.php @@ -14,14 +14,11 @@ */ class ArrayType { - /** @var Union */ - public $key; + public Union $key; - /** @var Union */ - public $value; + public Union $value; - /** @var bool */ - public $is_list; + public bool $is_list; public function __construct(Union $key, Union $value, bool $is_list) { diff --git a/src/Psalm/Internal/Type/AssertionReconciler.php b/src/Psalm/Internal/Type/AssertionReconciler.php index f6de512f671..5419b480624 100644 --- a/src/Psalm/Internal/Type/AssertionReconciler.php +++ b/src/Psalm/Internal/Type/AssertionReconciler.php @@ -236,9 +236,6 @@ public static function reconcile( ); } - /** - * @param array> $template_type_map - */ private static function getMissingType( Assertion $assertion, bool $inside_loop @@ -274,7 +271,6 @@ private static function getMissingType( * * @param Reconciler::RECONCILIATION_* $failed_reconciliation * @param string[] $suppressed_issues - * @param array> $template_type_map * @param-out Reconciler::RECONCILIATION_* $failed_reconciliation */ private static function refine( @@ -521,8 +517,6 @@ private static function refine( /** * This method receives two types. The goal is to use datas in the new type to reduce the existing_type to a more * precise version. For example: new is `array` old is `list` so the result is `list` - * - * @param array> $template_type_map */ private static function filterTypeWithAnother( Codebase $codebase, diff --git a/src/Psalm/Internal/Type/Comparator/ObjectComparator.php b/src/Psalm/Internal/Type/Comparator/ObjectComparator.php index a0a15900294..b775ae0f783 100644 --- a/src/Psalm/Internal/Type/Comparator/ObjectComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ObjectComparator.php @@ -23,7 +23,6 @@ class ObjectComparator /** * @param TNamedObject|TTemplateParam|TIterable $input_type_part * @param TNamedObject|TTemplateParam|TIterable $container_type_part - * */ public static function isShallowlyContainedBy( Codebase $codebase, @@ -122,7 +121,6 @@ private static function getIntersectionTypes(Atomic $type_part): array /** * @param TNamedObject|TTemplateParam|TIterable|TObjectWithProperties $intersection_input_type * @param TNamedObject|TTemplateParam|TIterable|TObjectWithProperties $intersection_container_type - * */ private static function isIntersectionShallowlyContainedBy( Codebase $codebase, diff --git a/src/Psalm/Internal/Type/Comparator/TypeComparisonResult.php b/src/Psalm/Internal/Type/Comparator/TypeComparisonResult.php index 0edffdbdc51..284d946b591 100644 --- a/src/Psalm/Internal/Type/Comparator/TypeComparisonResult.php +++ b/src/Psalm/Internal/Type/Comparator/TypeComparisonResult.php @@ -13,22 +13,16 @@ class TypeComparisonResult /** * This is used to trigger `InvalidScalarArgument` in situations where we know PHP * will try to coerce one scalar type to another. - * - * @var ?bool */ - public $scalar_type_match_found; + public ?bool $scalar_type_match_found = null; - /** @var ?bool */ - public $type_coerced; + public ?bool $type_coerced = null; - /** @var ?bool */ - public $type_coerced_from_mixed; + public ?bool $type_coerced_from_mixed = null; - /** @var ?bool */ - public $type_coerced_from_as_mixed; + public ?bool $type_coerced_from_as_mixed = null; - /** @var ?bool */ - public $to_string_cast; + public ?bool $to_string_cast = null; /** * This is primarily used for array access. @@ -38,17 +32,13 @@ class TypeComparisonResult * function takesAnInt(int $i): string { * return ["foo", "bar"][$i]; * } - * - * @var ?bool */ - public $type_coerced_from_scalar; + public ?bool $type_coerced_from_scalar = null; - /** @var ?Union */ - public $replacement_union_type; + public ?Union $replacement_union_type = null; - /** @var ?Atomic */ - public $replacement_atomic_type; + public ?Atomic $replacement_atomic_type = null; /** @var ?non-empty-list */ - public $missing_shape_fields; + public ?array $missing_shape_fields = null; } diff --git a/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php b/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php index c93c4b2ced0..484d6964b8d 100644 --- a/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php @@ -352,8 +352,6 @@ public static function isContainedBy( /** * Used for comparing signature typehints, uses PHP's light contravariance rules - * - * */ public static function isContainedByInPhp( ?Union $input_type, @@ -452,7 +450,6 @@ public static function canBeContainedBy( /** * Can any part of the $type1 be equal to any part of $type2 - * */ public static function canExpressionTypesBeIdentical( Codebase $codebase, diff --git a/src/Psalm/Internal/Type/NegatedAssertionReconciler.php b/src/Psalm/Internal/Type/NegatedAssertionReconciler.php index 4a8bb1ae49f..df3b3c92cf8 100644 --- a/src/Psalm/Internal/Type/NegatedAssertionReconciler.php +++ b/src/Psalm/Internal/Type/NegatedAssertionReconciler.php @@ -44,7 +44,6 @@ class NegatedAssertionReconciler extends Reconciler { /** - * @param array> $template_type_map * @param string[] $suppressed_issues * @param Reconciler::RECONCILIATION_* $failed_reconciliation */ @@ -302,7 +301,6 @@ public static function reconcile( /** * @param TLiteralInt|TLiteralString|TLiteralFloat|TEnumCase $assertion_type * @param string[] $suppressed_issues - * */ private static function handleLiteralNegatedEquality( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Type/ParseTree.php b/src/Psalm/Internal/Type/ParseTree.php index fa3f0b3b6b9..e181b07df84 100644 --- a/src/Psalm/Internal/Type/ParseTree.php +++ b/src/Psalm/Internal/Type/ParseTree.php @@ -10,17 +10,11 @@ class ParseTree /** * @var list */ - public $children = []; + public array $children = []; - /** - * @var null|ParseTree - */ - public $parent; + public ?ParseTree $parent = null; - /** - * @var bool - */ - public $possibly_undefined = false; + public bool $possibly_undefined = false; public function __construct(?ParseTree $parent = null) { diff --git a/src/Psalm/Internal/Type/ParseTree/CallableParamTree.php b/src/Psalm/Internal/Type/ParseTree/CallableParamTree.php index ae0b8cac104..4154483e76f 100644 --- a/src/Psalm/Internal/Type/ParseTree/CallableParamTree.php +++ b/src/Psalm/Internal/Type/ParseTree/CallableParamTree.php @@ -9,13 +9,7 @@ */ class CallableParamTree extends ParseTree { - /** - * @var bool - */ - public $variadic = false; + public bool $variadic = false; - /** - * @var bool - */ - public $has_default = false; + public bool $has_default = false; } diff --git a/src/Psalm/Internal/Type/ParseTree/CallableTree.php b/src/Psalm/Internal/Type/ParseTree/CallableTree.php index 404211d85f7..5f3c64014cc 100644 --- a/src/Psalm/Internal/Type/ParseTree/CallableTree.php +++ b/src/Psalm/Internal/Type/ParseTree/CallableTree.php @@ -9,15 +9,9 @@ */ class CallableTree extends ParseTree { - /** - * @var string - */ - public $value; + public string $value; - /** - * @var bool - */ - public $terminated = false; + public bool $terminated = false; public function __construct(string $value, ?ParseTree $parent = null) { diff --git a/src/Psalm/Internal/Type/ParseTree/ConditionalTree.php b/src/Psalm/Internal/Type/ParseTree/ConditionalTree.php index b743f0add38..786d1ca07b9 100644 --- a/src/Psalm/Internal/Type/ParseTree/ConditionalTree.php +++ b/src/Psalm/Internal/Type/ParseTree/ConditionalTree.php @@ -9,10 +9,7 @@ */ class ConditionalTree extends ParseTree { - /** - * @var TemplateIsTree - */ - public $condition; + public TemplateIsTree $condition; public function __construct(TemplateIsTree $condition, ?ParseTree $parent = null) { diff --git a/src/Psalm/Internal/Type/ParseTree/EncapsulationTree.php b/src/Psalm/Internal/Type/ParseTree/EncapsulationTree.php index 5fc34640e29..63fc3e0fafb 100644 --- a/src/Psalm/Internal/Type/ParseTree/EncapsulationTree.php +++ b/src/Psalm/Internal/Type/ParseTree/EncapsulationTree.php @@ -9,8 +9,5 @@ */ class EncapsulationTree extends ParseTree { - /** - * @var bool - */ - public $terminated = false; + public bool $terminated = false; } diff --git a/src/Psalm/Internal/Type/ParseTree/GenericTree.php b/src/Psalm/Internal/Type/ParseTree/GenericTree.php index fc17d029cac..cefe8e4bb66 100644 --- a/src/Psalm/Internal/Type/ParseTree/GenericTree.php +++ b/src/Psalm/Internal/Type/ParseTree/GenericTree.php @@ -9,15 +9,9 @@ */ class GenericTree extends ParseTree { - /** - * @var string - */ - public $value; + public string $value; - /** - * @var bool - */ - public $terminated = false; + public bool $terminated = false; public function __construct(string $value, ?ParseTree $parent = null) { diff --git a/src/Psalm/Internal/Type/ParseTree/IndexedAccessTree.php b/src/Psalm/Internal/Type/ParseTree/IndexedAccessTree.php index a38b8e7339e..c50f401d343 100644 --- a/src/Psalm/Internal/Type/ParseTree/IndexedAccessTree.php +++ b/src/Psalm/Internal/Type/ParseTree/IndexedAccessTree.php @@ -9,10 +9,7 @@ */ class IndexedAccessTree extends ParseTree { - /** - * @var string - */ - public $value; + public string $value; public function __construct(string $value, ?ParseTree $parent = null) { diff --git a/src/Psalm/Internal/Type/ParseTree/KeyedArrayPropertyTree.php b/src/Psalm/Internal/Type/ParseTree/KeyedArrayPropertyTree.php index e06d863030d..ba17ccfc1dd 100644 --- a/src/Psalm/Internal/Type/ParseTree/KeyedArrayPropertyTree.php +++ b/src/Psalm/Internal/Type/ParseTree/KeyedArrayPropertyTree.php @@ -9,10 +9,7 @@ */ class KeyedArrayPropertyTree extends ParseTree { - /** - * @var string - */ - public $value; + public string $value; public function __construct(string $value, ?ParseTree $parent = null) { diff --git a/src/Psalm/Internal/Type/ParseTree/KeyedArrayTree.php b/src/Psalm/Internal/Type/ParseTree/KeyedArrayTree.php index 4da6cf75cd5..90c1249bd1b 100644 --- a/src/Psalm/Internal/Type/ParseTree/KeyedArrayTree.php +++ b/src/Psalm/Internal/Type/ParseTree/KeyedArrayTree.php @@ -9,15 +9,9 @@ */ class KeyedArrayTree extends ParseTree { - /** - * @var string - */ - public $value; + public string $value; - /** - * @var bool - */ - public $terminated = false; + public bool $terminated = false; public function __construct(string $value, ?ParseTree $parent = null) { diff --git a/src/Psalm/Internal/Type/ParseTree/MethodParamTree.php b/src/Psalm/Internal/Type/ParseTree/MethodParamTree.php index a3a531e9b67..82f8bd80a01 100644 --- a/src/Psalm/Internal/Type/ParseTree/MethodParamTree.php +++ b/src/Psalm/Internal/Type/ParseTree/MethodParamTree.php @@ -9,25 +9,13 @@ */ class MethodParamTree extends ParseTree { - /** - * @var bool - */ - public $variadic; + public bool $variadic; - /** - * @var string - */ - public $default = ''; + public string $default = ''; - /** - * @var bool - */ - public $byref; + public bool $byref; - /** - * @var string - */ - public $name; + public string $name; public function __construct( string $name, diff --git a/src/Psalm/Internal/Type/ParseTree/MethodTree.php b/src/Psalm/Internal/Type/ParseTree/MethodTree.php index f21ef8e7789..f77494b405c 100644 --- a/src/Psalm/Internal/Type/ParseTree/MethodTree.php +++ b/src/Psalm/Internal/Type/ParseTree/MethodTree.php @@ -9,10 +9,7 @@ */ class MethodTree extends ParseTree { - /** - * @var string - */ - public $value; + public string $value; public function __construct(string $value, ?ParseTree $parent = null) { diff --git a/src/Psalm/Internal/Type/ParseTree/TemplateAsTree.php b/src/Psalm/Internal/Type/ParseTree/TemplateAsTree.php index c8dbd7998d8..bb5de0c72b6 100644 --- a/src/Psalm/Internal/Type/ParseTree/TemplateAsTree.php +++ b/src/Psalm/Internal/Type/ParseTree/TemplateAsTree.php @@ -9,15 +9,9 @@ */ class TemplateAsTree extends ParseTree { - /** - * @var string - */ - public $param_name; + public string $param_name; - /** - * @var string - */ - public $as; + public string $as; public function __construct(string $param_name, string $as, ?ParseTree $parent = null) { diff --git a/src/Psalm/Internal/Type/ParseTree/TemplateIsTree.php b/src/Psalm/Internal/Type/ParseTree/TemplateIsTree.php index 3a96b6cb85f..4ad27411daf 100644 --- a/src/Psalm/Internal/Type/ParseTree/TemplateIsTree.php +++ b/src/Psalm/Internal/Type/ParseTree/TemplateIsTree.php @@ -9,10 +9,7 @@ */ class TemplateIsTree extends ParseTree { - /** - * @var string - */ - public $param_name; + public string $param_name; public function __construct(string $param_name, ?ParseTree $parent = null) { diff --git a/src/Psalm/Internal/Type/ParseTree/Value.php b/src/Psalm/Internal/Type/ParseTree/Value.php index 952aad3b546..e61d14efbe6 100644 --- a/src/Psalm/Internal/Type/ParseTree/Value.php +++ b/src/Psalm/Internal/Type/ParseTree/Value.php @@ -9,29 +9,14 @@ */ class Value extends ParseTree { - /** - * @var string - */ - public $value; + public string $value; - /** - * @var int - */ - public $offset_start; + public int $offset_start; - /** - * @var int - */ - public $offset_end; + public int $offset_end; - /** - * @var ?string - */ - public $text; + public ?string $text = null; - /** - * @param ParseTree|null $parent - */ public function __construct( string $value, int $offset_start, diff --git a/src/Psalm/Internal/Type/ParseTreeCreator.php b/src/Psalm/Internal/Type/ParseTreeCreator.php index 0adebe41e1a..1049f804461 100644 --- a/src/Psalm/Internal/Type/ParseTreeCreator.php +++ b/src/Psalm/Internal/Type/ParseTreeCreator.php @@ -36,11 +36,9 @@ */ class ParseTreeCreator { - /** @var ParseTree */ - private $parse_tree; + private ParseTree $parse_tree; - /** @var ParseTree */ - private $current_leaf; + private ParseTree $current_leaf; /** @var array */ private array $type_tokens; diff --git a/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php index 172710f5fc1..edeef3adb43 100644 --- a/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php @@ -514,7 +514,6 @@ private static function reconcileBool( /** * @param string[] $suppressed_issues - * @param Reconciler::RECONCILIATION_* $failed_reconciliation */ private static function reconcileNotNonEmptyCountable( Assertion $assertion, diff --git a/src/Psalm/Internal/Type/TemplateBound.php b/src/Psalm/Internal/Type/TemplateBound.php index f454200589d..01aada21077 100644 --- a/src/Psalm/Internal/Type/TemplateBound.php +++ b/src/Psalm/Internal/Type/TemplateBound.php @@ -9,10 +9,7 @@ */ class TemplateBound { - /** - * @var Union - */ - public $type; + public Union $type; /** * This is the depth at which the template appears in a given type. @@ -20,26 +17,20 @@ class TemplateBound * In the type Foo>> the type T appears at three different depths. * * The shallowest-appearance of the template takes prominence when inferring the type of T. - * - * @var int */ - public $appearance_depth; + public int $appearance_depth; /** * The argument offset where this template was set * * In the type Foo the type appears at argument offsets 0 and 2 - * - * @var ?int */ - public $arg_offset; + public ?int $arg_offset = null; /** * When non-null, indicates an equality template bound (vs a lower or upper bound) - * - * @var ?string */ - public $equality_bound_classlike; + public ?string $equality_bound_classlike = null; public function __construct( Union $type, diff --git a/src/Psalm/Internal/Type/TemplateResult.php b/src/Psalm/Internal/Type/TemplateResult.php index 341c12ccaa9..35d98333479 100644 --- a/src/Psalm/Internal/Type/TemplateResult.php +++ b/src/Psalm/Internal/Type/TemplateResult.php @@ -26,29 +26,27 @@ class TemplateResult /** * @var array> */ - public $template_types; + public array $template_types; /** * @var array>> */ - public $lower_bounds; + public array $lower_bounds; /** * @var array> */ - public $upper_bounds = []; + public array $upper_bounds = []; /** * If set to true then we shouldn't update the template bounds - * - * @var bool */ - public $readonly = false; + public bool $readonly = false; /** * @var list */ - public $upper_bounds_unintersectable_types = []; + public array $upper_bounds_unintersectable_types = []; /** * @param array> $template_types diff --git a/src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php b/src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php index a874a4d4d91..b3fae414c6a 100644 --- a/src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php +++ b/src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php @@ -94,7 +94,6 @@ public static function fillTemplateResult( * * This method fills in the values in $template_result based on how the various atomic types * of $union_type match up to the types inside $input_type - * */ public static function replace( Union $union_type, diff --git a/src/Psalm/Internal/Type/TypeAlias/ClassTypeAlias.php b/src/Psalm/Internal/Type/TypeAlias/ClassTypeAlias.php index 6b7842ebc16..49267d9924e 100644 --- a/src/Psalm/Internal/Type/TypeAlias/ClassTypeAlias.php +++ b/src/Psalm/Internal/Type/TypeAlias/ClassTypeAlias.php @@ -13,7 +13,7 @@ class ClassTypeAlias implements TypeAlias /** * @var list */ - public $replacement_atomic_types; + public array $replacement_atomic_types; /** * @param list $replacement_atomic_types diff --git a/src/Psalm/Internal/Type/TypeAlias/InlineTypeAlias.php b/src/Psalm/Internal/Type/TypeAlias/InlineTypeAlias.php index a77cf531eb1..ab49068d4b1 100644 --- a/src/Psalm/Internal/Type/TypeAlias/InlineTypeAlias.php +++ b/src/Psalm/Internal/Type/TypeAlias/InlineTypeAlias.php @@ -7,7 +7,6 @@ /** * @psalm-immutable - * * @internal */ class InlineTypeAlias implements TypeAlias @@ -17,7 +16,7 @@ class InlineTypeAlias implements TypeAlias /** * @var list */ - public $replacement_tokens; + public array $replacement_tokens; /** * @param list $replacement_tokens diff --git a/src/Psalm/Internal/Type/TypeAlias/LinkableTypeAlias.php b/src/Psalm/Internal/Type/TypeAlias/LinkableTypeAlias.php index efe89975005..96aa6678936 100644 --- a/src/Psalm/Internal/Type/TypeAlias/LinkableTypeAlias.php +++ b/src/Psalm/Internal/Type/TypeAlias/LinkableTypeAlias.php @@ -7,22 +7,21 @@ /** * @psalm-immutable - * * @internal */ class LinkableTypeAlias implements TypeAlias { use ImmutableNonCloneableTrait; - public $declaring_fq_classlike_name; + public string $declaring_fq_classlike_name; - public $alias_name; + public string $alias_name; - public $line_number; + public int $line_number; - public $start_offset; + public int $start_offset; - public $end_offset; + public int $end_offset; public function __construct( string $declaring_fq_classlike_name, diff --git a/src/Psalm/Internal/Type/TypeCombination.php b/src/Psalm/Internal/Type/TypeCombination.php index 2d7c74b4af5..8531377860d 100644 --- a/src/Psalm/Internal/Type/TypeCombination.php +++ b/src/Psalm/Internal/Type/TypeCombination.php @@ -18,85 +18,74 @@ class TypeCombination { /** @var array */ - public $value_types = []; + public array $value_types = []; /** @var array|null */ - public $named_object_types = []; + public ?array $named_object_types = []; /** @var list */ - public $array_type_params = []; + public array $array_type_params = []; /** @var array> */ - public $builtin_type_params = []; + public array $builtin_type_params = []; /** @var array> */ - public $object_type_params = []; + public array $object_type_params = []; /** @var array */ - public $object_static = []; + public array $object_static = []; /** @var array|null */ - public $array_counts = []; + public ?array $array_counts = []; /** @var array|null */ - public $array_min_counts = []; + public ?array $array_min_counts = []; - /** @var bool */ - public $array_sometimes_filled = false; + public bool $array_sometimes_filled = false; - /** @var bool */ - public $array_always_filled = true; + public bool $array_always_filled = true; /** @var array */ - public $objectlike_entries = []; + public array $objectlike_entries = []; - /** @var bool */ - public $objectlike_sealed = true; + public bool $objectlike_sealed = true; - /** @var ?Union */ - public $objectlike_key_type; + public ?Union $objectlike_key_type = null; - /** @var ?Union */ - public $objectlike_value_type; + public ?Union $objectlike_value_type = null; - /** @var bool */ - public $empty_mixed = false; + public bool $empty_mixed = false; - /** @var bool */ - public $non_empty_mixed = false; + public bool $non_empty_mixed = false; - /** @var ?bool */ - public $mixed_from_loop_isset; + public ?bool $mixed_from_loop_isset = null; /** @var array|null */ - public $strings = []; + public ?array $strings = []; /** @var array|null */ - public $ints = []; + public ?array $ints = []; /** @var array|null */ - public $floats = []; + public ?array $floats = []; /** @var array|null */ - public $class_string_types = []; + public ?array $class_string_types = []; /** * @var array */ - public $extra_types = []; + public array $extra_types = []; - /** @var ?bool */ - public $all_arrays_lists; + public ?bool $all_arrays_lists = null; - /** @var ?bool */ - public $all_arrays_callable; + public ?bool $all_arrays_callable = null; - /** @var ?bool */ - public $all_arrays_class_string_maps; + public ?bool $all_arrays_class_string_maps = null; /** @var array */ - public $class_string_map_names = []; + public array $class_string_map_names = []; /** @var array */ - public $class_string_map_as_types = []; + public array $class_string_map_as_types = []; } diff --git a/src/Psalm/Internal/Type/TypeCombiner.php b/src/Psalm/Internal/Type/TypeCombiner.php index 79c5bf9d09e..f79e153a5f6 100644 --- a/src/Psalm/Internal/Type/TypeCombiner.php +++ b/src/Psalm/Internal/Type/TypeCombiner.php @@ -86,9 +86,7 @@ class TypeCombiner * - and `array + array = array` * * @psalm-external-mutation-free - * * @psalm-suppress ImpurePropertyAssignment We're not actually mutating any external instance - * * @param non-empty-list $types * @param int $literal_limit any greater number of literal types than this * will be merged to a scalar diff --git a/src/Psalm/Internal/Type/TypeExpander.php b/src/Psalm/Internal/Type/TypeExpander.php index 22e5d5d73eb..f87a16e66fd 100644 --- a/src/Psalm/Internal/Type/TypeExpander.php +++ b/src/Psalm/Internal/Type/TypeExpander.php @@ -130,7 +130,6 @@ public static function expandUnion( * @param string|TNamedObject|TTemplateParam|null $static_class_type * @param-out Atomic $return_type * @return non-empty-list - * * @psalm-suppress ConflictingReferenceConstraint, ReferenceConstraintViolation The output type is always Atomic * @psalm-suppress ComplexMethod */ @@ -766,7 +765,6 @@ private static function expandNamedObject( /** * @param string|TNamedObject|TTemplateParam|null $static_class_type - * * @return non-empty-list */ private static function expandConditional( diff --git a/src/Psalm/Internal/Type/TypeParser.php b/src/Psalm/Internal/Type/TypeParser.php index d12055a587b..552b94e054f 100644 --- a/src/Psalm/Internal/Type/TypeParser.php +++ b/src/Psalm/Internal/Type/TypeParser.php @@ -107,7 +107,6 @@ class TypeParser * @param array{int,int}|null $php_version * @param array> $template_type_map * @param array $type_aliases - * */ public static function parseTokens( array $type_tokens, @@ -166,7 +165,6 @@ public static function parseTokens( /** * @param array> $template_type_map * @param array $type_aliases - * * @return Atomic|Union */ public static function getTypeFromTree( diff --git a/src/Psalm/Internal/Type/TypeTokenizer.php b/src/Psalm/Internal/Type/TypeTokenizer.php index 07c926b1566..044d9981d5f 100644 --- a/src/Psalm/Internal/Type/TypeTokenizer.php +++ b/src/Psalm/Internal/Type/TypeTokenizer.php @@ -97,14 +97,13 @@ class TypeTokenizer /** * @var array> */ - private static $memoized_tokens = []; + private static array $memoized_tokens = []; /** * Tokenises a type string into an array of tuples where the first element * contains the string token and the second element contains its offset, * * @return list - * * @psalm-suppress PossiblyUndefinedIntArrayOffset */ public static function tokenize(string $string_type, bool $ignore_space = true): array @@ -349,7 +348,6 @@ public static function fixScalarTerms( /** * @param array|null $template_type_map * @param array|null $type_aliases - * * @return list */ public static function getFullyQualifiedTokens( diff --git a/src/Psalm/Internal/TypeVisitor/TypeChecker.php b/src/Psalm/Internal/TypeVisitor/TypeChecker.php index 0da7c7097c8..011d99c78ac 100644 --- a/src/Psalm/Internal/TypeVisitor/TypeChecker.php +++ b/src/Psalm/Internal/TypeVisitor/TypeChecker.php @@ -66,7 +66,7 @@ class TypeChecker extends TypeVisitor private bool $has_errors = false; - private ?string $calling_method_id; + private ?string $calling_method_id = null; /** * @param array $suppressed_issues diff --git a/src/Psalm/Internal/TypeVisitor/TypeScanner.php b/src/Psalm/Internal/TypeVisitor/TypeScanner.php index cad58880ef4..7a844910e25 100644 --- a/src/Psalm/Internal/TypeVisitor/TypeScanner.php +++ b/src/Psalm/Internal/TypeVisitor/TypeScanner.php @@ -19,7 +19,7 @@ class TypeScanner extends TypeVisitor { private Scanner $scanner; - private ?FileStorage $file_storage; + private ?FileStorage $file_storage = null; /** * @var array diff --git a/src/Psalm/Internal/VersionUtils.php b/src/Psalm/Internal/VersionUtils.php index c175b0ad581..7dbda1b6f54 100644 --- a/src/Psalm/Internal/VersionUtils.php +++ b/src/Psalm/Internal/VersionUtils.php @@ -21,7 +21,7 @@ final class VersionUtils private const PHP_PARSER_PACKAGE = 'nikic/php-parser'; /** @var null|_VersionData */ - private static $versions = null; + private static ?array $versions = null; /** @psalm-suppress UnusedConstructor it's here to prevent instantiations */ private function __construct() diff --git a/src/Psalm/IssueBuffer.php b/src/Psalm/IssueBuffer.php index bb20debfd46..0a86aaead14 100644 --- a/src/Psalm/IssueBuffer.php +++ b/src/Psalm/IssueBuffer.php @@ -127,6 +127,7 @@ final class IssueBuffer /** * This will add an issue to be emitted if it's not suppressed and return if it has been added + * * @param string[] $suppressed_issues */ public static function accepts(CodeIssue $e, array $suppressed_issues = [], bool $is_fixable = false): bool @@ -140,6 +141,7 @@ public static function accepts(CodeIssue $e, array $suppressed_issues = [], bool /** * This will add an issue to be emitted if it's not suppressed + * * @param string[] $suppressed_issues */ public static function maybeAdd(CodeIssue $e, array $suppressed_issues = [], bool $is_fixable = false): void @@ -176,6 +178,7 @@ public static function addUnusedSuppression(string $file_path, int $offset, stri * - The issue is suppressed in config * - We're in a recording state * - The issue is included in the list of issues to be suppressed in param + * * @param string[] $suppressed_issues */ public static function isSuppressed(CodeIssue $e, array $suppressed_issues = []): bool @@ -250,7 +253,6 @@ public static function isSuppressed(CodeIssue $e, array $suppressed_issues = []) * * @psalm-internal Psalm\IssueBuffer * @psalm-internal Psalm\Type\Reconciler::getValueForKey - * * @throws CodeException */ public static function add(CodeIssue $e, bool $is_fixable = false): bool @@ -514,7 +516,6 @@ public static function getErrorCount(): int /** * @param array> $issues_data - * */ public static function addIssues(array $issues_data): void { @@ -535,7 +536,6 @@ public static function addIssues(array $issues_data): void /** * @param array}>> $issue_baseline - * */ public static function finish( ProjectAnalyzer $project_analyzer, @@ -824,7 +824,6 @@ public static function printSuccessMessage(ProjectAnalyzer $project_analyzer): v /** * @param array> $issues_data * @param array{int, int} $mixed_counts - * */ public static function getOutput( array $issues_data, @@ -976,6 +975,7 @@ public static function startRecording(): void /** * Decrease the recording level after leaving a loop + * * @see startRecording */ public static function stopRecording(): void @@ -989,6 +989,7 @@ public static function stopRecording(): void /** * This will return the recorded issues for the current recording level + * * @return array */ public static function clearRecordingLevel(): array diff --git a/src/Psalm/Plugin/EventHandler/BeforeAddIssueInterface.php b/src/Psalm/Plugin/EventHandler/BeforeAddIssueInterface.php index 3942f9e5689..53f0eb57a69 100644 --- a/src/Psalm/Plugin/EventHandler/BeforeAddIssueInterface.php +++ b/src/Psalm/Plugin/EventHandler/BeforeAddIssueInterface.php @@ -15,7 +15,6 @@ interface BeforeAddIssueInterface * the handler registered earlier may prevent subsequent handlers from running by * returning a boolean value. * - * @param BeforeAddIssueEvent $event * @return null|bool $event How and whether to continue: * + `null` continues with next event handler * + `true` stops event handling & keeps issue diff --git a/src/Psalm/Plugin/EventHandler/Event/AddRemoveTaintsEvent.php b/src/Psalm/Plugin/EventHandler/Event/AddRemoveTaintsEvent.php index 8b3eee26aff..97934728826 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AddRemoveTaintsEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AddRemoveTaintsEvent.php @@ -16,6 +16,7 @@ final class AddRemoveTaintsEvent /** * Called after an expression has been checked + * * @internal */ public function __construct( diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterCodebasePopulatedEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterCodebasePopulatedEvent.php index bb82a57ff7c..238bf2489b5 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterCodebasePopulatedEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterCodebasePopulatedEvent.php @@ -10,6 +10,7 @@ final class AfterCodebasePopulatedEvent /** * Called after codebase has been populated + * * @internal */ public function __construct(Codebase $codebase) diff --git a/src/Psalm/Plugin/EventHandler/Event/BeforeAddIssueEvent.php b/src/Psalm/Plugin/EventHandler/Event/BeforeAddIssueEvent.php index 74ea1d6bc6f..190e3907fd7 100644 --- a/src/Psalm/Plugin/EventHandler/Event/BeforeAddIssueEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/BeforeAddIssueEvent.php @@ -8,14 +8,8 @@ final class BeforeAddIssueEvent { - /** - * @var CodeIssue - */ private CodeIssue $issue; - /** - * @var bool - */ private bool $fixable; /** @internal */ diff --git a/src/Psalm/Plugin/EventHandler/Event/BeforeFileAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/BeforeFileAnalysisEvent.php index 5a1e78e2421..249ab125b38 100644 --- a/src/Psalm/Plugin/EventHandler/Event/BeforeFileAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/BeforeFileAnalysisEvent.php @@ -16,6 +16,7 @@ final class BeforeFileAnalysisEvent /** * Called before a file has been checked + * * @internal */ public function __construct( diff --git a/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php index f1a034a8689..97a76196f35 100644 --- a/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php @@ -41,7 +41,6 @@ final class MethodReturnTypeProviderEvent * @param ?array $template_type_parameters * @param lowercase-string $method_name_lowercase * @param lowercase-string $called_method_name_lowercase - * * @internal */ public function __construct( diff --git a/src/Psalm/Plugin/EventHandler/Event/StringInterpreterEvent.php b/src/Psalm/Plugin/EventHandler/Event/StringInterpreterEvent.php index e5d6c282843..d027fdc4547 100644 --- a/src/Psalm/Plugin/EventHandler/Event/StringInterpreterEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/StringInterpreterEvent.php @@ -10,7 +10,6 @@ final class StringInterpreterEvent * Called after a statement has been checked * * @psalm-external-mutation-free - * * @internal */ public function __construct(string $value) diff --git a/src/Psalm/Plugin/EventHandler/FunctionExistenceProviderInterface.php b/src/Psalm/Plugin/EventHandler/FunctionExistenceProviderInterface.php index dbe4617b998..5a04a71b90e 100644 --- a/src/Psalm/Plugin/EventHandler/FunctionExistenceProviderInterface.php +++ b/src/Psalm/Plugin/EventHandler/FunctionExistenceProviderInterface.php @@ -15,7 +15,6 @@ public static function getFunctionIds(): array; * Use this hook for informing whether or not a global function exists. If you know the function does * not exist, return false. If you aren't sure if it exists or not, return null and the default analysis * will continue to determine if the function actually exists. - * */ public static function doesFunctionExist(FunctionExistenceProviderEvent $event): ?bool; } diff --git a/src/Psalm/Plugin/EventHandler/PropertyExistenceProviderInterface.php b/src/Psalm/Plugin/EventHandler/PropertyExistenceProviderInterface.php index b45434de976..9387f78b328 100644 --- a/src/Psalm/Plugin/EventHandler/PropertyExistenceProviderInterface.php +++ b/src/Psalm/Plugin/EventHandler/PropertyExistenceProviderInterface.php @@ -15,7 +15,6 @@ public static function getClassLikeNames(): array; * Use this hook for informing whether or not a property exists on a given object. If you know the property does * not exist, return false. If you aren't sure if it exists or not, return null and the default analysis will * continue to determine if the property actually exists. - * */ public static function doesPropertyExist(PropertyExistenceProviderEvent $event): ?bool; } diff --git a/src/Psalm/Plugin/Shepherd.php b/src/Psalm/Plugin/Shepherd.php index 16a66bdeb19..9cc1467abe2 100644 --- a/src/Psalm/Plugin/Shepherd.php +++ b/src/Psalm/Plugin/Shepherd.php @@ -130,7 +130,6 @@ public static function afterAnalysis( /** * @param mixed $ch - * * @psalm-pure */ public static function getCurlErrorMessage($ch): string diff --git a/src/Psalm/Report/ByIssueLevelAndTypeReport.php b/src/Psalm/Report/ByIssueLevelAndTypeReport.php index 85169c8121f..b2d43542636 100644 --- a/src/Psalm/Report/ByIssueLevelAndTypeReport.php +++ b/src/Psalm/Report/ByIssueLevelAndTypeReport.php @@ -105,6 +105,7 @@ private function format(IssueData $issue_data): string /** * Copied from ConsoleReport unchanged. We could consider moving to another class to reduce duplication. + * * @param non-empty-list $taint_trace */ private function getTaintSnippets(array $taint_trace): string @@ -140,6 +141,7 @@ private function getTaintSnippets(array $taint_trace): string /** * Copied from ConsoleReport unchanged. We could consider moving to another class to reduce duplication. + * * @param IssueData|DataFlowNodeData $data */ private function getFileReference($data): string diff --git a/src/Psalm/Report/CodeClimateReport.php b/src/Psalm/Report/CodeClimateReport.php index 8aa412a5aa9..a6163ec6708 100644 --- a/src/Psalm/Report/CodeClimateReport.php +++ b/src/Psalm/Report/CodeClimateReport.php @@ -17,7 +17,6 @@ * * @see https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html * @see https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types - * * @author Olivier Doucet */ final class CodeClimateReport extends Report diff --git a/src/Psalm/Report/JunitReport.php b/src/Psalm/Report/JunitReport.php index 9ff30590819..f917aa50699 100644 --- a/src/Psalm/Report/JunitReport.php +++ b/src/Psalm/Report/JunitReport.php @@ -146,7 +146,6 @@ private function createTestSuite(DOMDocument $dom, DOMElement $parent, string $f /** * @param list $failures - * * @return array> */ private function groupByType(array $failures): array diff --git a/src/Psalm/SourceControl/Git/CommitInfo.php b/src/Psalm/SourceControl/Git/CommitInfo.php index c157eefbd7a..afd52e1def8 100644 --- a/src/Psalm/SourceControl/Git/CommitInfo.php +++ b/src/Psalm/SourceControl/Git/CommitInfo.php @@ -85,7 +85,6 @@ public function setId(string $id): self /** * Return commit ID. - * */ public function getId(): ?string { @@ -104,7 +103,6 @@ public function setAuthorName(string $author_name): self /** * Return author name. - * */ public function getAuthorName(): ?string { @@ -113,7 +111,6 @@ public function getAuthorName(): ?string /** * Set author email. - * */ public function setAuthorEmail(string $author_email): self { @@ -124,7 +121,6 @@ public function setAuthorEmail(string $author_email): self /** * Return author email. - * */ public function getAuthorEmail(): ?string { @@ -143,7 +139,6 @@ public function setCommitterName(string $committer_name): self /** * Return committer name. - * */ public function getCommitterName(): ?string { @@ -162,7 +157,6 @@ public function setCommitterEmail(string $committer_email): self /** * Return committer email. - * */ public function getCommitterEmail(): ?string { @@ -181,7 +175,6 @@ public function setMessage(string $message): self /** * Return commit message. - * */ public function getMessage(): ?string { @@ -200,7 +193,6 @@ public function setDate(int $date): self /** * Return commit date. - * */ public function getDate(): ?int { diff --git a/src/Psalm/SourceControl/Git/GitInfo.php b/src/Psalm/SourceControl/Git/GitInfo.php index 83c0dbc6ea9..e086db55e22 100644 --- a/src/Psalm/SourceControl/Git/GitInfo.php +++ b/src/Psalm/SourceControl/Git/GitInfo.php @@ -83,7 +83,6 @@ public function toArray(): array /** * Return branch name. - * */ public function getBranch(): string { @@ -92,7 +91,6 @@ public function getBranch(): string /** * Return HEAD commit. - * */ public function getHead(): CommitInfo { diff --git a/src/Psalm/SourceControl/Git/RemoteInfo.php b/src/Psalm/SourceControl/Git/RemoteInfo.php index 212b6f5fa47..b96b2c68c2a 100644 --- a/src/Psalm/SourceControl/Git/RemoteInfo.php +++ b/src/Psalm/SourceControl/Git/RemoteInfo.php @@ -37,7 +37,6 @@ public function toArray(): array * Set remote name. * * @param string $name remote name - * * @return $this */ public function setName(string $name): RemoteInfo @@ -49,7 +48,6 @@ public function setName(string $name): RemoteInfo /** * Return remote name. - * */ public function getName(): ?string { @@ -60,7 +58,6 @@ public function getName(): ?string * Set remote URL. * * @param string $url remote URL - * * @return $this */ public function setUrl(string $url): RemoteInfo @@ -72,7 +69,6 @@ public function setUrl(string $url): RemoteInfo /** * Return remote URL. - * */ public function getUrl(): ?string { diff --git a/src/Psalm/Storage/AttributeStorage.php b/src/Psalm/Storage/AttributeStorage.php index 45651ec8eb5..7b9b0e7298a 100644 --- a/src/Psalm/Storage/AttributeStorage.php +++ b/src/Psalm/Storage/AttributeStorage.php @@ -22,14 +22,12 @@ final class AttributeStorage /** * @var CodeLocation - * * @psalm-suppress PossiblyUnusedProperty part of public API */ public $location; /** * @var CodeLocation - * * @psalm-suppress PossiblyUnusedProperty part of public API */ public $name_location; diff --git a/src/Psalm/Storage/ClassLikeStorage.php b/src/Psalm/Storage/ClassLikeStorage.php index 7bd81b13abc..aaacfc67555 100644 --- a/src/Psalm/Storage/ClassLikeStorage.php +++ b/src/Psalm/Storage/ClassLikeStorage.php @@ -341,7 +341,6 @@ final class ClassLikeStorage implements HasAttributesInterface * This is only used in the populator, which poulates the $template_extended_params property below. * * @internal - * * @var array>|null */ public $template_extended_offsets; diff --git a/src/Psalm/Storage/FunctionLikeParameter.php b/src/Psalm/Storage/FunctionLikeParameter.php index 3526dca3851..6c4a241080d 100644 --- a/src/Psalm/Storage/FunctionLikeParameter.php +++ b/src/Psalm/Storage/FunctionLikeParameter.php @@ -184,6 +184,10 @@ public function visit(TypeVisitor $visitor): bool return true; } + + /** + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint + */ public static function visitMutable(MutableTypeVisitor $visitor, &$node, bool $cloned): bool { foreach (['type', 'signature_type', 'out_type', 'default_type'] as $key) { diff --git a/src/Psalm/Storage/FunctionLikeStorage.php b/src/Psalm/Storage/FunctionLikeStorage.php index 0ddabfabbb7..736dc31c830 100644 --- a/src/Psalm/Storage/FunctionLikeStorage.php +++ b/src/Psalm/Storage/FunctionLikeStorage.php @@ -281,7 +281,6 @@ public function getSignature(bool $allow_newlines): string /** * @internal - * * @param list $params */ public function setParams(array $params): void diff --git a/src/Psalm/Storage/HasAttributesInterface.php b/src/Psalm/Storage/HasAttributesInterface.php index c8bca415ca2..50bfc8e624e 100644 --- a/src/Psalm/Storage/HasAttributesInterface.php +++ b/src/Psalm/Storage/HasAttributesInterface.php @@ -10,7 +10,6 @@ interface HasAttributesInterface * Returns a list of AttributeStorages with the same order they appear in the AttributeGroups they come from. * * @return list - * * @psalm-suppress PossiblyUnusedMethod part of public API */ public function getAttributeStorages(): array; diff --git a/src/Psalm/Type.php b/src/Psalm/Type.php index 05b2dcef4d7..46552de0710 100644 --- a/src/Psalm/Type.php +++ b/src/Psalm/Type.php @@ -118,7 +118,6 @@ public static function getFQCLNFromString( /** * @param array $aliased_classes - * * @psalm-pure */ public static function getStringFromFQCLN( @@ -553,9 +552,7 @@ public static function combineUnionTypeArray(array $union_types, ?Codebase $code * * @param int $literal_limit any greater number of literal types than this * will be merged to a scalar - * * @psalm-external-mutation-free - * * @psalm-suppress ImpurePropertyAssignment We're not mutating external instances * @psalm-suppress InaccessibleProperty We're not mutating external instances */ @@ -685,8 +682,6 @@ public static function combineUnionTypes( /** * Combines two union types into one via an intersection - * - * */ public static function intersectUnionTypes( ?Union $type_1, diff --git a/src/Psalm/Type/Atomic.php b/src/Psalm/Type/Atomic.php index 5e32b13caf3..7e76f674f07 100644 --- a/src/Psalm/Type/Atomic.php +++ b/src/Psalm/Type/Atomic.php @@ -148,7 +148,6 @@ public function replaceClassLike(string $old, string $new): self /** * @psalm-suppress InaccessibleProperty Allowed during construction - * * @param int $analysis_php_version_id contains php version when the type comes from signature * @param array> $template_type_map * @param array $type_aliases @@ -172,7 +171,6 @@ public static function create( } /** * @psalm-suppress InaccessibleProperty Allowed during construction - * * @param int $analysis_php_version_id contains php version when the type comes from signature * @param array> $template_type_map * @param array $type_aliases @@ -627,6 +625,9 @@ public function visit(TypeVisitor $visitor): bool return true; } + /** + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint + */ public static function visitMutable(MutableTypeVisitor $visitor, &$node, bool $cloned): bool { foreach ($node->getChildNodeKeys() as $key) { diff --git a/src/Psalm/Type/Atomic/GenericTrait.php b/src/Psalm/Type/Atomic/GenericTrait.php index d1155fc90ce..843fe8f93e6 100644 --- a/src/Psalm/Type/Atomic/GenericTrait.php +++ b/src/Psalm/Type/Atomic/GenericTrait.php @@ -27,7 +27,6 @@ trait GenericTrait { /** * @param TTypeParams $type_params - * * @return static */ public function setTypeParams(array $type_params): self @@ -70,7 +69,6 @@ public function getId(bool $exact = true, bool $nested = false): string /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/HasIntersectionTrait.php b/src/Psalm/Type/Atomic/HasIntersectionTrait.php index 30c78184321..306e49f1f16 100644 --- a/src/Psalm/Type/Atomic/HasIntersectionTrait.php +++ b/src/Psalm/Type/Atomic/HasIntersectionTrait.php @@ -54,7 +54,6 @@ private function getNamespacedIntersectionTypes( /** * @param TNamedObject|TTemplateParam|TIterable|TObjectWithProperties $type - * * @return static */ public function addIntersectionType(Atomic $type): self @@ -67,7 +66,6 @@ public function addIntersectionType(Atomic $type): self /** * @param array $types - * * @return static */ public function setIntersectionTypes(array $types): self diff --git a/src/Psalm/Type/Atomic/TAnonymousClassInstance.php b/src/Psalm/Type/Atomic/TAnonymousClassInstance.php index a6da68a042c..dd238814488 100644 --- a/src/Psalm/Type/Atomic/TAnonymousClassInstance.php +++ b/src/Psalm/Type/Atomic/TAnonymousClassInstance.php @@ -4,6 +4,7 @@ /** * Denotes an anonymous class (i.e. `new class{}`) with potential methods + * * @psalm-immutable */ final class TAnonymousClassInstance extends TNamedObject @@ -39,7 +40,6 @@ public function toPhpString( /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TArray.php b/src/Psalm/Type/Atomic/TArray.php index 7a15176dac7..ca379dab691 100644 --- a/src/Psalm/Type/Atomic/TArray.php +++ b/src/Psalm/Type/Atomic/TArray.php @@ -13,6 +13,7 @@ /** * Denotes a simple array of the form `array`. It expects an array with two elements, both union types. + * * @psalm-immutable */ class TArray extends Atomic diff --git a/src/Psalm/Type/Atomic/TArrayKey.php b/src/Psalm/Type/Atomic/TArrayKey.php index 9938d6a7082..07307cf25f9 100644 --- a/src/Psalm/Type/Atomic/TArrayKey.php +++ b/src/Psalm/Type/Atomic/TArrayKey.php @@ -4,6 +4,7 @@ /** * Denotes the `array-key` type, used for something that could be the offset of an `array`. + * * @psalm-immutable */ class TArrayKey extends Scalar diff --git a/src/Psalm/Type/Atomic/TBool.php b/src/Psalm/Type/Atomic/TBool.php index 2312152afbd..951485fef0e 100644 --- a/src/Psalm/Type/Atomic/TBool.php +++ b/src/Psalm/Type/Atomic/TBool.php @@ -4,6 +4,7 @@ /** * Denotes the `bool` type where the exact value is unknown. + * * @psalm-immutable */ class TBool extends Scalar diff --git a/src/Psalm/Type/Atomic/TCallable.php b/src/Psalm/Type/Atomic/TCallable.php index 994520585dc..71da1ee5be3 100644 --- a/src/Psalm/Type/Atomic/TCallable.php +++ b/src/Psalm/Type/Atomic/TCallable.php @@ -9,6 +9,7 @@ /** * Denotes the `callable` type. Can result from an `is_callable` check. + * * @psalm-immutable */ final class TCallable extends Atomic diff --git a/src/Psalm/Type/Atomic/TCallableArray.php b/src/Psalm/Type/Atomic/TCallableArray.php index 332dfb1118c..d4992523b06 100644 --- a/src/Psalm/Type/Atomic/TCallableArray.php +++ b/src/Psalm/Type/Atomic/TCallableArray.php @@ -4,6 +4,7 @@ /** * Denotes an array that is _also_ `callable`. + * * @psalm-immutable */ final class TCallableArray extends TNonEmptyArray diff --git a/src/Psalm/Type/Atomic/TCallableKeyedArray.php b/src/Psalm/Type/Atomic/TCallableKeyedArray.php index 4c452f8e942..b549c940357 100644 --- a/src/Psalm/Type/Atomic/TCallableKeyedArray.php +++ b/src/Psalm/Type/Atomic/TCallableKeyedArray.php @@ -4,6 +4,7 @@ /** * Denotes an object-like array that is _also_ `callable`. + * * @psalm-immutable */ final class TCallableKeyedArray extends TKeyedArray diff --git a/src/Psalm/Type/Atomic/TCallableObject.php b/src/Psalm/Type/Atomic/TCallableObject.php index 9114a313de2..db9985629ab 100644 --- a/src/Psalm/Type/Atomic/TCallableObject.php +++ b/src/Psalm/Type/Atomic/TCallableObject.php @@ -4,6 +4,7 @@ /** * Denotes an object that is also `callable` (i.e. it has `__invoke` defined). + * * @psalm-immutable */ final class TCallableObject extends TObject diff --git a/src/Psalm/Type/Atomic/TCallableString.php b/src/Psalm/Type/Atomic/TCallableString.php index c95456a0ede..f9c676f47af 100644 --- a/src/Psalm/Type/Atomic/TCallableString.php +++ b/src/Psalm/Type/Atomic/TCallableString.php @@ -4,6 +4,7 @@ /** * Denotes the `callable-string` type, used to represent an unknown string that is also `callable`. + * * @psalm-immutable */ final class TCallableString extends TNonFalsyString diff --git a/src/Psalm/Type/Atomic/TClassConstant.php b/src/Psalm/Type/Atomic/TClassConstant.php index dea31daa0c9..db10f48bb1a 100644 --- a/src/Psalm/Type/Atomic/TClassConstant.php +++ b/src/Psalm/Type/Atomic/TClassConstant.php @@ -7,6 +7,7 @@ /** * Denotes a class constant whose value might not yet be known. + * * @psalm-immutable */ final class TClassConstant extends Atomic @@ -58,7 +59,6 @@ public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TClassString.php b/src/Psalm/Type/Atomic/TClassString.php index a56ea416de2..ff90a1e7e09 100644 --- a/src/Psalm/Type/Atomic/TClassString.php +++ b/src/Psalm/Type/Atomic/TClassString.php @@ -20,6 +20,7 @@ /** * Denotes the `class-string` type, used to describe a string representing a valid PHP class. * The parent type from which the classes descend may or may not be specified in the constructor. + * * @psalm-immutable */ class TClassString extends TString diff --git a/src/Psalm/Type/Atomic/TClassStringMap.php b/src/Psalm/Type/Atomic/TClassStringMap.php index 71655b4409c..cf2f71fadff 100644 --- a/src/Psalm/Type/Atomic/TClassStringMap.php +++ b/src/Psalm/Type/Atomic/TClassStringMap.php @@ -17,6 +17,7 @@ /** * Represents an array where the type of each value * is a function of its string key value + * * @psalm-immutable */ final class TClassStringMap extends Atomic @@ -62,7 +63,6 @@ public function getId(bool $exact = true, bool $nested = false): string /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TClosedResource.php b/src/Psalm/Type/Atomic/TClosedResource.php index 3d867d73818..06d419ff13c 100644 --- a/src/Psalm/Type/Atomic/TClosedResource.php +++ b/src/Psalm/Type/Atomic/TClosedResource.php @@ -6,6 +6,7 @@ /** * Denotes the `resource` type that has been closed (e.g. a file handle through `fclose()`). + * * @psalm-immutable */ final class TClosedResource extends Atomic diff --git a/src/Psalm/Type/Atomic/TClosure.php b/src/Psalm/Type/Atomic/TClosure.php index 8b17a63963d..0865e9e3c77 100644 --- a/src/Psalm/Type/Atomic/TClosure.php +++ b/src/Psalm/Type/Atomic/TClosure.php @@ -13,6 +13,7 @@ /** * Represents a closure where we know the return type and params + * * @psalm-immutable */ final class TClosure extends TNamedObject diff --git a/src/Psalm/Type/Atomic/TConditional.php b/src/Psalm/Type/Atomic/TConditional.php index 3322400e9a0..116d40c761d 100644 --- a/src/Psalm/Type/Atomic/TConditional.php +++ b/src/Psalm/Type/Atomic/TConditional.php @@ -10,6 +10,7 @@ /** * Internal representation of a conditional return type in phpdoc. For example ($param1 is int ? int : string) + * * @psalm-immutable */ final class TConditional extends Atomic @@ -110,7 +111,6 @@ public function getId(bool $exact = true, bool $nested = false): string /** * @param array $aliased_classes - * * @return null */ public function toPhpString( @@ -124,7 +124,6 @@ public function toPhpString( /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TDependentGetClass.php b/src/Psalm/Type/Atomic/TDependentGetClass.php index bde7432c18b..61ebc89ac0f 100644 --- a/src/Psalm/Type/Atomic/TDependentGetClass.php +++ b/src/Psalm/Type/Atomic/TDependentGetClass.php @@ -6,6 +6,7 @@ /** * Represents a string whose value is a fully-qualified class found by get_class($var) + * * @psalm-immutable */ final class TDependentGetClass extends TString implements DependentType diff --git a/src/Psalm/Type/Atomic/TDependentGetDebugType.php b/src/Psalm/Type/Atomic/TDependentGetDebugType.php index fd56a78cbc9..8f33a19c720 100644 --- a/src/Psalm/Type/Atomic/TDependentGetDebugType.php +++ b/src/Psalm/Type/Atomic/TDependentGetDebugType.php @@ -4,6 +4,7 @@ /** * Represents a string whose value is that of a type found by get_debug_type($var) + * * @psalm-immutable */ final class TDependentGetDebugType extends TString implements DependentType diff --git a/src/Psalm/Type/Atomic/TDependentGetType.php b/src/Psalm/Type/Atomic/TDependentGetType.php index 44181f9d573..abec9425b5a 100644 --- a/src/Psalm/Type/Atomic/TDependentGetType.php +++ b/src/Psalm/Type/Atomic/TDependentGetType.php @@ -4,6 +4,7 @@ /** * Represents a string whose value is that of a type found by gettype($var) + * * @psalm-immutable */ final class TDependentGetType extends TString diff --git a/src/Psalm/Type/Atomic/TEmptyMixed.php b/src/Psalm/Type/Atomic/TEmptyMixed.php index fb4b5c297b6..a14b31f5ddf 100644 --- a/src/Psalm/Type/Atomic/TEmptyMixed.php +++ b/src/Psalm/Type/Atomic/TEmptyMixed.php @@ -5,6 +5,7 @@ /** * Denotes the `mixed` type, but empty. * Generated for `$x` inside the `if` statement `if (!$x) {...}` when `$x` is `mixed` outside. + * * @psalm-immutable */ final class TEmptyMixed extends TMixed diff --git a/src/Psalm/Type/Atomic/TEmptyNumeric.php b/src/Psalm/Type/Atomic/TEmptyNumeric.php index 1a3ce1f67c8..7b9d6dd8854 100644 --- a/src/Psalm/Type/Atomic/TEmptyNumeric.php +++ b/src/Psalm/Type/Atomic/TEmptyNumeric.php @@ -4,6 +4,7 @@ /** * Denotes the `numeric` type that's also empty (which can also result from an `is_numeric` and `empty` check). + * * @psalm-immutable */ final class TEmptyNumeric extends TNumeric diff --git a/src/Psalm/Type/Atomic/TEmptyScalar.php b/src/Psalm/Type/Atomic/TEmptyScalar.php index cb2543810d9..60a5abc3f30 100644 --- a/src/Psalm/Type/Atomic/TEmptyScalar.php +++ b/src/Psalm/Type/Atomic/TEmptyScalar.php @@ -4,6 +4,7 @@ /** * Denotes a `scalar` type that is also empty. + * * @psalm-immutable */ final class TEmptyScalar extends TScalar diff --git a/src/Psalm/Type/Atomic/TEnumCase.php b/src/Psalm/Type/Atomic/TEnumCase.php index 614a59c1d5d..502f9c8b9fa 100644 --- a/src/Psalm/Type/Atomic/TEnumCase.php +++ b/src/Psalm/Type/Atomic/TEnumCase.php @@ -4,6 +4,7 @@ /** * Denotes an enum with a specific value + * * @psalm-immutable */ final class TEnumCase extends TNamedObject @@ -46,7 +47,6 @@ public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TFalse.php b/src/Psalm/Type/Atomic/TFalse.php index 2ccd395d002..03d1e27c05f 100644 --- a/src/Psalm/Type/Atomic/TFalse.php +++ b/src/Psalm/Type/Atomic/TFalse.php @@ -4,6 +4,7 @@ /** * Denotes the `false` value type + * * @psalm-immutable */ final class TFalse extends TBool diff --git a/src/Psalm/Type/Atomic/TFloat.php b/src/Psalm/Type/Atomic/TFloat.php index d856df6e2cc..5e3af401888 100644 --- a/src/Psalm/Type/Atomic/TFloat.php +++ b/src/Psalm/Type/Atomic/TFloat.php @@ -4,6 +4,7 @@ /** * Denotes the `float` type, where the exact value is unknown. + * * @psalm-immutable */ class TFloat extends Scalar diff --git a/src/Psalm/Type/Atomic/TGenericObject.php b/src/Psalm/Type/Atomic/TGenericObject.php index 347d07a7b70..51080e93714 100644 --- a/src/Psalm/Type/Atomic/TGenericObject.php +++ b/src/Psalm/Type/Atomic/TGenericObject.php @@ -16,6 +16,7 @@ /** * Denotes an object type that has generic parameters e.g. `ArrayObject` + * * @psalm-immutable */ final class TGenericObject extends TNamedObject diff --git a/src/Psalm/Type/Atomic/TInt.php b/src/Psalm/Type/Atomic/TInt.php index fd7ad05cb7d..9cfd0de654d 100644 --- a/src/Psalm/Type/Atomic/TInt.php +++ b/src/Psalm/Type/Atomic/TInt.php @@ -4,6 +4,7 @@ /** * Denotes the `int` type, where the exact value is unknown. + * * @psalm-immutable */ class TInt extends Scalar diff --git a/src/Psalm/Type/Atomic/TIntMask.php b/src/Psalm/Type/Atomic/TIntMask.php index a77babf1062..09a2e83cb5d 100644 --- a/src/Psalm/Type/Atomic/TIntMask.php +++ b/src/Psalm/Type/Atomic/TIntMask.php @@ -7,6 +7,7 @@ /** * Represents the type that is the result of a bitmask combination of its parameters. * `int-mask<1, 2, 4>` corresponds to `0|1|2|3|4|5|6|7` + * * @psalm-immutable */ final class TIntMask extends TInt @@ -45,7 +46,6 @@ public function getId(bool $exact = true, bool $nested = false): string /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TIntMaskOf.php b/src/Psalm/Type/Atomic/TIntMaskOf.php index 33b9d8c3869..0048ee6f2e9 100644 --- a/src/Psalm/Type/Atomic/TIntMaskOf.php +++ b/src/Psalm/Type/Atomic/TIntMaskOf.php @@ -8,6 +8,7 @@ * Represents the type that is the result of a bitmask combination of its parameters. * This is the same concept as TIntMask but TIntMaskOf is used with a reference to constants in code * `int-mask-of` will corresponds to `0|1|2|3|4|5|6|7` if there are three constant 1, 2 and 4 + * * @psalm-immutable */ final class TIntMaskOf extends TInt diff --git a/src/Psalm/Type/Atomic/TIntRange.php b/src/Psalm/Type/Atomic/TIntRange.php index 080ce2c1cf4..ad2554729bc 100644 --- a/src/Psalm/Type/Atomic/TIntRange.php +++ b/src/Psalm/Type/Atomic/TIntRange.php @@ -7,6 +7,7 @@ /** * Denotes an interval of integers between two bounds + * * @psalm-immutable */ final class TIntRange extends TInt diff --git a/src/Psalm/Type/Atomic/TIterable.php b/src/Psalm/Type/Atomic/TIterable.php index 8df955ff520..e6d5ce74022 100644 --- a/src/Psalm/Type/Atomic/TIterable.php +++ b/src/Psalm/Type/Atomic/TIterable.php @@ -15,6 +15,7 @@ /** * denotes the `iterable` type(which can also result from an `is_iterable` check). + * * @psalm-immutable */ final class TIterable extends Atomic diff --git a/src/Psalm/Type/Atomic/TKeyOf.php b/src/Psalm/Type/Atomic/TKeyOf.php index d8fee1ac32b..691228179d2 100644 --- a/src/Psalm/Type/Atomic/TKeyOf.php +++ b/src/Psalm/Type/Atomic/TKeyOf.php @@ -10,6 +10,7 @@ /** * Represents an offset of an array. + * * @psalm-immutable */ final class TKeyOf extends TArrayKey diff --git a/src/Psalm/Type/Atomic/TKeyedArray.php b/src/Psalm/Type/Atomic/TKeyedArray.php index 92803f9991b..f0f898040c3 100644 --- a/src/Psalm/Type/Atomic/TKeyedArray.php +++ b/src/Psalm/Type/Atomic/TKeyedArray.php @@ -31,6 +31,7 @@ /** * Represents an 'object-like array' - an array with known keys. + * * @psalm-immutable */ class TKeyedArray extends Atomic @@ -88,7 +89,6 @@ public function __construct( /** * @param non-empty-array $properties - * * @return static */ public function setProperties(array $properties): self @@ -171,7 +171,6 @@ public function getId(bool $exact = true, bool $nested = false): string /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, @@ -416,6 +415,7 @@ public function getMinCount(): int /** * Returns null if there is no upper limit. + * * @return int<1, max>|null */ public function getMaxCount(): ?int diff --git a/src/Psalm/Type/Atomic/TList.php b/src/Psalm/Type/Atomic/TList.php index 888284f5268..6d7548ffabd 100644 --- a/src/Psalm/Type/Atomic/TList.php +++ b/src/Psalm/Type/Atomic/TList.php @@ -24,7 +24,6 @@ * - its keys are integers * - they start at 0 * - they are consecutive and go upwards (no negative int) - * * @psalm-immutable */ class TList extends Atomic @@ -71,7 +70,6 @@ public function getId(bool $exact = true, bool $nested = false): string /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TLiteralClassString.php b/src/Psalm/Type/Atomic/TLiteralClassString.php index cc17a77d61e..199af5bd28f 100644 --- a/src/Psalm/Type/Atomic/TLiteralClassString.php +++ b/src/Psalm/Type/Atomic/TLiteralClassString.php @@ -10,12 +10,14 @@ /** * Denotes a specific class string, generated by expressions like `A::class`. + * * @psalm-immutable */ final class TLiteralClassString extends TLiteralString { /** * Whether or not this type can represent a child of the class named in $value + * * @var bool */ public $definite_class = false; diff --git a/src/Psalm/Type/Atomic/TLiteralFloat.php b/src/Psalm/Type/Atomic/TLiteralFloat.php index 991625ec328..886c915284f 100644 --- a/src/Psalm/Type/Atomic/TLiteralFloat.php +++ b/src/Psalm/Type/Atomic/TLiteralFloat.php @@ -4,6 +4,7 @@ /** * Denotes a floating point value where the exact numeric value is known. + * * @psalm-immutable */ final class TLiteralFloat extends TFloat @@ -33,7 +34,6 @@ public function getId(bool $exact = true, bool $nested = false): string /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TLiteralInt.php b/src/Psalm/Type/Atomic/TLiteralInt.php index 6a506061d3f..b86495c619d 100644 --- a/src/Psalm/Type/Atomic/TLiteralInt.php +++ b/src/Psalm/Type/Atomic/TLiteralInt.php @@ -4,6 +4,7 @@ /** * Denotes an integer value where the exact numeric value is known. + * * @psalm-immutable */ final class TLiteralInt extends TInt @@ -38,7 +39,6 @@ public function getAssertionString(): string /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TLiteralString.php b/src/Psalm/Type/Atomic/TLiteralString.php index b8adfc6df7d..901fb866404 100644 --- a/src/Psalm/Type/Atomic/TLiteralString.php +++ b/src/Psalm/Type/Atomic/TLiteralString.php @@ -8,6 +8,7 @@ /** * Denotes a string whose value is known. + * * @psalm-immutable */ class TLiteralString extends TString @@ -61,7 +62,6 @@ public function getAssertionString(): string /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TNamedObject.php b/src/Psalm/Type/Atomic/TNamedObject.php index acd8192b7fe..ab1634d9fe9 100644 --- a/src/Psalm/Type/Atomic/TNamedObject.php +++ b/src/Psalm/Type/Atomic/TNamedObject.php @@ -15,6 +15,7 @@ /** * Denotes an object type where the type of the object is known e.g. `Exception`, `Throwable`, `Foo\Bar` + * * @psalm-immutable */ class TNamedObject extends Atomic @@ -38,6 +39,7 @@ class TNamedObject extends Atomic /** * Whether or not this type can represent a child of the class named in $value + * * @var bool */ public $definite_class = false; @@ -141,7 +143,6 @@ public function getId(bool $exact = true, bool $nested = false): string /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TNever.php b/src/Psalm/Type/Atomic/TNever.php index 9c468445de7..397424b860a 100644 --- a/src/Psalm/Type/Atomic/TNever.php +++ b/src/Psalm/Type/Atomic/TNever.php @@ -7,6 +7,7 @@ /** * Denotes the `no-return`/`never-return` type for functions that never return, either throwing an exception or * terminating (like the builtin `exit()`). + * * @psalm-immutable */ final class TNever extends Atomic diff --git a/src/Psalm/Type/Atomic/TNonEmptyArray.php b/src/Psalm/Type/Atomic/TNonEmptyArray.php index 2c2fba076c8..f1031de08f2 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyArray.php +++ b/src/Psalm/Type/Atomic/TNonEmptyArray.php @@ -7,6 +7,7 @@ /** * Denotes array known to be non-empty of the form `non-empty-array`. * It expects an array with two elements, both union types. + * * @psalm-immutable */ class TNonEmptyArray extends TArray @@ -47,7 +48,6 @@ public function __construct( /** * @param positive-int|null $count - * * @return static */ public function setCount(?int $count): self diff --git a/src/Psalm/Type/Atomic/TNonEmptyList.php b/src/Psalm/Type/Atomic/TNonEmptyList.php index a87f7da8902..c110f4f1690 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyList.php +++ b/src/Psalm/Type/Atomic/TNonEmptyList.php @@ -76,7 +76,6 @@ public function getKeyedArray(): TKeyedArray /** * @param positive-int|null $count - * * @return static */ public function setCount(?int $count): self diff --git a/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php b/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php index ab39bc3d497..a72f2a6e811 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php +++ b/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php @@ -4,6 +4,7 @@ /** * Denotes a non-empty-string where every character is lowercased. (which can also result from a `strtolower` call). + * * @psalm-immutable */ final class TNonEmptyLowercaseString extends TNonEmptyString diff --git a/src/Psalm/Type/Atomic/TNonEmptyMixed.php b/src/Psalm/Type/Atomic/TNonEmptyMixed.php index b7c829e079c..efc1dee105b 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyMixed.php +++ b/src/Psalm/Type/Atomic/TNonEmptyMixed.php @@ -5,6 +5,7 @@ /** * Denotes the `mixed` type, but not empty. * Generated for `$x` inside the `if` statement `if ($x) {...}` when `$x` is `mixed` outside. + * * @psalm-immutable */ final class TNonEmptyMixed extends TMixed diff --git a/src/Psalm/Type/Atomic/TNonEmptyNonspecificLiteralString.php b/src/Psalm/Type/Atomic/TNonEmptyNonspecificLiteralString.php index 6cfd2526f34..1953f40d658 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyNonspecificLiteralString.php +++ b/src/Psalm/Type/Atomic/TNonEmptyNonspecificLiteralString.php @@ -5,6 +5,7 @@ /** * Denotes the `literal-string` type, where the exact value is unknown but * we know that the string is not from user input + * * @psalm-immutable */ final class TNonEmptyNonspecificLiteralString extends TNonspecificLiteralString diff --git a/src/Psalm/Type/Atomic/TNonEmptyScalar.php b/src/Psalm/Type/Atomic/TNonEmptyScalar.php index 7de002334cd..44ce2f86f26 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyScalar.php +++ b/src/Psalm/Type/Atomic/TNonEmptyScalar.php @@ -4,6 +4,7 @@ /** * Denotes a `scalar` type that is also non-empty. + * * @psalm-immutable */ final class TNonEmptyScalar extends TScalar diff --git a/src/Psalm/Type/Atomic/TNonEmptyString.php b/src/Psalm/Type/Atomic/TNonEmptyString.php index 5aeedb303ba..7e7d9b85100 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyString.php +++ b/src/Psalm/Type/Atomic/TNonEmptyString.php @@ -4,6 +4,7 @@ /** * Denotes a string, that is also non-empty (every string except '') + * * @psalm-immutable */ class TNonEmptyString extends TString diff --git a/src/Psalm/Type/Atomic/TNonFalsyString.php b/src/Psalm/Type/Atomic/TNonFalsyString.php index e352d1d9f71..060382a9ed3 100644 --- a/src/Psalm/Type/Atomic/TNonFalsyString.php +++ b/src/Psalm/Type/Atomic/TNonFalsyString.php @@ -4,6 +4,7 @@ /** * Denotes a string, that is also non-falsy (every string except '' and '0') + * * @psalm-immutable */ class TNonFalsyString extends TNonEmptyString diff --git a/src/Psalm/Type/Atomic/TNonspecificLiteralInt.php b/src/Psalm/Type/Atomic/TNonspecificLiteralInt.php index fbc5e71f24f..930b5daef77 100644 --- a/src/Psalm/Type/Atomic/TNonspecificLiteralInt.php +++ b/src/Psalm/Type/Atomic/TNonspecificLiteralInt.php @@ -5,6 +5,7 @@ /** * Denotes the `literal-int` type, where the exact value is unknown but * we know that the int is not from user input + * * @psalm-immutable */ final class TNonspecificLiteralInt extends TInt diff --git a/src/Psalm/Type/Atomic/TNonspecificLiteralString.php b/src/Psalm/Type/Atomic/TNonspecificLiteralString.php index b6c73cc20ee..d94e9e2dfb0 100644 --- a/src/Psalm/Type/Atomic/TNonspecificLiteralString.php +++ b/src/Psalm/Type/Atomic/TNonspecificLiteralString.php @@ -5,6 +5,7 @@ /** * Denotes the `literal-string` type, where the exact value is unknown but * we know that the string is not from user input + * * @psalm-immutable */ class TNonspecificLiteralString extends TString diff --git a/src/Psalm/Type/Atomic/TNull.php b/src/Psalm/Type/Atomic/TNull.php index 685509d9678..7ce4717f701 100644 --- a/src/Psalm/Type/Atomic/TNull.php +++ b/src/Psalm/Type/Atomic/TNull.php @@ -6,6 +6,7 @@ /** * Denotes the `null` type + * * @psalm-immutable */ final class TNull extends Atomic diff --git a/src/Psalm/Type/Atomic/TNumeric.php b/src/Psalm/Type/Atomic/TNumeric.php index 942a1df0e2c..44f2a650d89 100644 --- a/src/Psalm/Type/Atomic/TNumeric.php +++ b/src/Psalm/Type/Atomic/TNumeric.php @@ -4,6 +4,7 @@ /** * Denotes the `numeric` type (which can also result from an `is_numeric` check). + * * @psalm-immutable */ class TNumeric extends Scalar diff --git a/src/Psalm/Type/Atomic/TNumericString.php b/src/Psalm/Type/Atomic/TNumericString.php index ed1040a3cb4..e6324530332 100644 --- a/src/Psalm/Type/Atomic/TNumericString.php +++ b/src/Psalm/Type/Atomic/TNumericString.php @@ -4,6 +4,7 @@ /** * Denotes a string that's also a numeric value e.g. `"5"`. It can result from `is_string($s) && is_numeric($s)`. + * * @psalm-immutable */ final class TNumericString extends TNonEmptyString diff --git a/src/Psalm/Type/Atomic/TObject.php b/src/Psalm/Type/Atomic/TObject.php index bffa66a5413..31e66c9b5a0 100644 --- a/src/Psalm/Type/Atomic/TObject.php +++ b/src/Psalm/Type/Atomic/TObject.php @@ -6,6 +6,7 @@ /** * Denotes the `object` type + * * @psalm-immutable */ class TObject extends Atomic diff --git a/src/Psalm/Type/Atomic/TObjectWithProperties.php b/src/Psalm/Type/Atomic/TObjectWithProperties.php index c02ab4b9f13..42e1443789d 100644 --- a/src/Psalm/Type/Atomic/TObjectWithProperties.php +++ b/src/Psalm/Type/Atomic/TObjectWithProperties.php @@ -17,6 +17,7 @@ /** * Denotes an object with specified member variables e.g. `object{foo:int, bar:string}`. + * * @psalm-immutable */ final class TObjectWithProperties extends TObject @@ -133,7 +134,6 @@ public function getId(bool $exact = true, bool $nested = false): string /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TPropertiesOf.php b/src/Psalm/Type/Atomic/TPropertiesOf.php index 57f02a9c394..ce0283a6a34 100644 --- a/src/Psalm/Type/Atomic/TPropertiesOf.php +++ b/src/Psalm/Type/Atomic/TPropertiesOf.php @@ -9,7 +9,6 @@ * their apropriate types as values. * * @psalm-type TokenName = 'properties-of'|'public-properties-of'|'protected-properties-of'|'private-properties-of' - * * @psalm-immutable */ final class TPropertiesOf extends Atomic @@ -54,7 +53,6 @@ public function __construct( } /** - * @param TokenName $tokenName * @return self::VISIBILITY_*|null */ public static function filterForTokenName(string $token_name): ?int diff --git a/src/Psalm/Type/Atomic/TResource.php b/src/Psalm/Type/Atomic/TResource.php index bb7c8f3a95d..1d99eef800c 100644 --- a/src/Psalm/Type/Atomic/TResource.php +++ b/src/Psalm/Type/Atomic/TResource.php @@ -6,6 +6,7 @@ /** * Denotes the `resource` type (e.g. a file handle). + * * @psalm-immutable */ final class TResource extends Atomic diff --git a/src/Psalm/Type/Atomic/TScalar.php b/src/Psalm/Type/Atomic/TScalar.php index de32876a374..8a5d0d6b264 100644 --- a/src/Psalm/Type/Atomic/TScalar.php +++ b/src/Psalm/Type/Atomic/TScalar.php @@ -5,6 +5,7 @@ /** * Denotes the `scalar` super type (which can also result from an `is_scalar` check). * This type encompasses `float`, `int`, `bool` and `string`. + * * @psalm-immutable */ class TScalar extends Scalar diff --git a/src/Psalm/Type/Atomic/TSingleLetter.php b/src/Psalm/Type/Atomic/TSingleLetter.php index 23e8a354b64..c12ad3d2148 100644 --- a/src/Psalm/Type/Atomic/TSingleLetter.php +++ b/src/Psalm/Type/Atomic/TSingleLetter.php @@ -4,6 +4,7 @@ /** * Denotes a string that has a length of 1 + * * @psalm-immutable */ final class TSingleLetter extends TString diff --git a/src/Psalm/Type/Atomic/TString.php b/src/Psalm/Type/Atomic/TString.php index 2cfd5f51474..0cffd68df64 100644 --- a/src/Psalm/Type/Atomic/TString.php +++ b/src/Psalm/Type/Atomic/TString.php @@ -4,6 +4,7 @@ /** * Denotes the `string` type, where the exact value is unknown. + * * @psalm-immutable */ class TString extends Scalar diff --git a/src/Psalm/Type/Atomic/TTemplateKeyOf.php b/src/Psalm/Type/Atomic/TTemplateKeyOf.php index 9f667a225ca..a4c1ad2cac6 100644 --- a/src/Psalm/Type/Atomic/TTemplateKeyOf.php +++ b/src/Psalm/Type/Atomic/TTemplateKeyOf.php @@ -10,6 +10,7 @@ /** * Represents the type used when using TKeyOf when the type of the array is a template + * * @psalm-immutable */ final class TTemplateKeyOf extends Atomic diff --git a/src/Psalm/Type/Atomic/TTemplateParam.php b/src/Psalm/Type/Atomic/TTemplateParam.php index 7bf2f330748..25b4e8e4a42 100644 --- a/src/Psalm/Type/Atomic/TTemplateParam.php +++ b/src/Psalm/Type/Atomic/TTemplateParam.php @@ -12,6 +12,7 @@ /** * denotes a template parameter that has been previously specified in a `@template` tag. + * * @psalm-immutable */ final class TTemplateParam extends Atomic @@ -96,7 +97,6 @@ public function getId(bool $exact = true, bool $nested = false): string /** * @param array $aliased_classes - * * @return null */ public function toPhpString( @@ -110,7 +110,6 @@ public function toPhpString( /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TTemplateParamClass.php b/src/Psalm/Type/Atomic/TTemplateParamClass.php index 62544ab6217..900451eba6a 100644 --- a/src/Psalm/Type/Atomic/TTemplateParamClass.php +++ b/src/Psalm/Type/Atomic/TTemplateParamClass.php @@ -4,6 +4,7 @@ /** * Denotes a `class-string` corresponding to a template parameter previously specified in a `@template` tag. + * * @psalm-immutable */ final class TTemplateParamClass extends TClassString @@ -50,7 +51,6 @@ public function getAssertionString(): string /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php b/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php index 59fbb539153..563d69f4c39 100644 --- a/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php +++ b/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php @@ -10,6 +10,7 @@ /** * Represents the type used when using TPropertiesOf when the type of the array is a template + * * @psalm-immutable */ final class TTemplatePropertiesOf extends Atomic diff --git a/src/Psalm/Type/Atomic/TTemplateValueOf.php b/src/Psalm/Type/Atomic/TTemplateValueOf.php index bcae2992e87..d0924f07805 100644 --- a/src/Psalm/Type/Atomic/TTemplateValueOf.php +++ b/src/Psalm/Type/Atomic/TTemplateValueOf.php @@ -10,6 +10,7 @@ /** * Represents the type used when using TValueOf when the type of the array or enum is a template + * * @psalm-immutable */ final class TTemplateValueOf extends Atomic diff --git a/src/Psalm/Type/Atomic/TTraitString.php b/src/Psalm/Type/Atomic/TTraitString.php index eb0f4b44593..07f38880e2a 100644 --- a/src/Psalm/Type/Atomic/TTraitString.php +++ b/src/Psalm/Type/Atomic/TTraitString.php @@ -4,6 +4,7 @@ /** * Denotes the `trait-string` type, used to describe a string representing a valid PHP trait. + * * @psalm-immutable */ final class TTraitString extends TString @@ -27,7 +28,6 @@ public function toPhpString( /** * @param array $aliased_classes - * */ public function toNamespacedString( ?string $namespace, diff --git a/src/Psalm/Type/Atomic/TTrue.php b/src/Psalm/Type/Atomic/TTrue.php index fa0293dd01d..5209cbc4058 100644 --- a/src/Psalm/Type/Atomic/TTrue.php +++ b/src/Psalm/Type/Atomic/TTrue.php @@ -4,6 +4,7 @@ /** * Denotes the `true` value type + * * @psalm-immutable */ final class TTrue extends TBool diff --git a/src/Psalm/Type/Atomic/TValueOf.php b/src/Psalm/Type/Atomic/TValueOf.php index bf43ed7b62d..af609ed5d94 100644 --- a/src/Psalm/Type/Atomic/TValueOf.php +++ b/src/Psalm/Type/Atomic/TValueOf.php @@ -16,6 +16,7 @@ /** * Represents a value of an array or enum. + * * @psalm-immutable */ final class TValueOf extends Atomic diff --git a/src/Psalm/Type/Atomic/TVoid.php b/src/Psalm/Type/Atomic/TVoid.php index dfd0657c8d7..e122d9a8e1c 100644 --- a/src/Psalm/Type/Atomic/TVoid.php +++ b/src/Psalm/Type/Atomic/TVoid.php @@ -6,6 +6,7 @@ /** * Denotes the `void` type, normally just used to annotate a function/method that returns nothing + * * @psalm-immutable */ final class TVoid extends Atomic diff --git a/src/Psalm/Type/MutableTypeVisitor.php b/src/Psalm/Type/MutableTypeVisitor.php index aa9be575caf..a61f69dad9f 100644 --- a/src/Psalm/Type/MutableTypeVisitor.php +++ b/src/Psalm/Type/MutableTypeVisitor.php @@ -19,7 +19,6 @@ abstract protected function enterNode(TypeNode &$type): ?int; * @template T as TypeNode * @param T $node * @param-out T $node - * * @psalm-suppress ReferenceConstraintViolation */ public function traverse(TypeNode &$node): bool diff --git a/src/Psalm/Type/MutableUnion.php b/src/Psalm/Type/MutableUnion.php index 754ec934e30..7f58f011d33 100644 --- a/src/Psalm/Type/MutableUnion.php +++ b/src/Psalm/Type/MutableUnion.php @@ -137,7 +137,6 @@ final class MutableUnion implements TypeNode, Stringable * since it's the bottom type, it's combined into everything else and lost * * @psalm-suppress PossiblyUnusedProperty used in setTypes and addType - * * @var bool */ public $explicit_never = false; @@ -202,12 +201,14 @@ final class MutableUnion implements TypeNode, Stringable /** * This is a cache of getId on non-exact mode + * * @var null|string */ private $id; /** * This is a cache of getId on exact mode + * * @var null|string */ private $exact_id; @@ -492,6 +493,9 @@ public function freeze(): Union return new Union($this->getAtomicTypes(), get_object_vars($this)); } + /** + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint + */ public static function visitMutable(MutableTypeVisitor $visitor, &$node, bool $cloned): bool { $result = true; diff --git a/src/Psalm/Type/Reconciler.php b/src/Psalm/Type/Reconciler.php index 3391a49e2a1..7e3068c4803 100644 --- a/src/Psalm/Type/Reconciler.php +++ b/src/Psalm/Type/Reconciler.php @@ -96,9 +96,7 @@ class Reconciler * @param array $changed_var_ids * @param array $referenced_var_ids * @param array> $template_type_map - * * @return array{array, array} - * * @psalm-suppress ComplexMethod */ public static function reconcileKeyedTypes( @@ -420,7 +418,6 @@ public static function reconcileKeyedTypes( * * @param array>> $new_types * @param array $existing_types - * * @return array>> */ private static function addNestedAssertions(array $new_types, array $existing_types): array diff --git a/src/Psalm/Type/TypeNode.php b/src/Psalm/Type/TypeNode.php index 978eace6954..f6eaa1a08c6 100644 --- a/src/Psalm/Type/TypeNode.php +++ b/src/Psalm/Type/TypeNode.php @@ -6,6 +6,7 @@ interface TypeNode { /** @internal Should only be used by the TypeVisitor */ public function visit(TypeVisitor $visitor): bool; + /** * @param static $node * @param-out static $node diff --git a/src/Psalm/Type/Union.php b/src/Psalm/Type/Union.php index 49beae793cf..28feb978ac1 100644 --- a/src/Psalm/Type/Union.php +++ b/src/Psalm/Type/Union.php @@ -213,12 +213,14 @@ final class Union implements TypeNode, Stringable /** * This is a cache of getId on non-exact mode + * * @var null|string */ private $id; /** * This is a cache of getId on exact mode + * * @var null|string */ private $exact_id; @@ -360,6 +362,9 @@ public function setFromDocblock(bool $fromDocblock = true): self return $cloned; } + /** + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint + */ public static function visitMutable(MutableTypeVisitor $visitor, &$node, bool $cloned): bool { $result = true; diff --git a/src/Psalm/Type/UnionTrait.php b/src/Psalm/Type/UnionTrait.php index 75859ba3576..df57af1cce1 100644 --- a/src/Psalm/Type/UnionTrait.php +++ b/src/Psalm/Type/UnionTrait.php @@ -62,7 +62,6 @@ trait UnionTrait * Constructs an Union instance * * @psalm-external-mutation-free - * * @param non-empty-array $types * @param TProperties $properties */ @@ -1471,7 +1470,6 @@ public function isSingleFloatLiteral(): bool /** * @psalm-mutation-free * @throws InvalidArgumentException if isSingleFloatLiteral is false - * * @return TLiteralFloat the only float literal represented by this union type */ public function getSingleFloatLiteral(): TLiteralFloat diff --git a/tests/AnnotationTest.php b/tests/AnnotationTest.php index 86aac93081c..17f97c8aef2 100644 --- a/tests/AnnotationTest.php +++ b/tests/AnnotationTest.php @@ -1251,9 +1251,6 @@ public function __construct( ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ArgTest.php b/tests/ArgTest.php index d803723e13a..6443da045ba 100644 --- a/tests/ArgTest.php +++ b/tests/ArgTest.php @@ -12,9 +12,6 @@ class ArgTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -362,9 +359,6 @@ function foo($a, $b, $c) {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ArrayAccessTest.php b/tests/ArrayAccessTest.php index f4d99cc4b91..95f41587f57 100644 --- a/tests/ArrayAccessTest.php +++ b/tests/ArrayAccessTest.php @@ -430,9 +430,6 @@ function foo(array $a, int $b): void { $this->analyzeFile('somefile.php', new Context()); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -1127,9 +1124,6 @@ function f($p): int { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ArrayAssignmentTest.php b/tests/ArrayAssignmentTest.php index 2e9eee02944..4a47e7fedb9 100644 --- a/tests/ArrayAssignmentTest.php +++ b/tests/ArrayAssignmentTest.php @@ -31,9 +31,6 @@ public function testConditionalAssignment(): void $this->assertFalse(isset($context->vars_in_scope['$foo[\'a\']'])); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -2030,9 +2027,6 @@ function getSections(): array { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ArrayFunctionCallTest.php b/tests/ArrayFunctionCallTest.php index 9a2312f25fd..369b6aae59c 100644 --- a/tests/ArrayFunctionCallTest.php +++ b/tests/ArrayFunctionCallTest.php @@ -12,9 +12,6 @@ class ArrayFunctionCallTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -2483,9 +2480,6 @@ function findit(Closure $x): void ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ArrayKeysTest.php b/tests/ArrayKeysTest.php index 0ee994848d3..51513c3aade 100644 --- a/tests/ArrayKeysTest.php +++ b/tests/ArrayKeysTest.php @@ -12,9 +12,6 @@ class ArrayKeysTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -103,9 +100,6 @@ function getKey() { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/AssertAnnotationTest.php b/tests/AssertAnnotationTest.php index 40f070d0d13..43c5c04b9d6 100644 --- a/tests/AssertAnnotationTest.php +++ b/tests/AssertAnnotationTest.php @@ -90,9 +90,6 @@ function requiresString(string $_str): void {} $this->analyzeFile('somefile.php', new Context()); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -2116,9 +2113,6 @@ function consumeAOrB(string $aOrB): void {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/AssignmentTest.php b/tests/AssignmentTest.php index 76d047fbe8d..d26268aae5f 100644 --- a/tests/AssignmentTest.php +++ b/tests/AssignmentTest.php @@ -94,9 +94,6 @@ function foo2(?string &$u, ?string &$v): void {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/AttributeTest.php b/tests/AttributeTest.php index 0544fd1b0df..e6517be09fe 100644 --- a/tests/AttributeTest.php +++ b/tests/AttributeTest.php @@ -433,9 +433,6 @@ public function __construct() {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/BinaryOperationTest.php b/tests/BinaryOperationTest.php index 63e529d2d3b..dfa9f0940ae 100644 --- a/tests/BinaryOperationTest.php +++ b/tests/BinaryOperationTest.php @@ -992,9 +992,6 @@ function toPositiveInt(int $i): int ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/CallableTest.php b/tests/CallableTest.php index 682fe04a758..05605dd8432 100644 --- a/tests/CallableTest.php +++ b/tests/CallableTest.php @@ -1330,9 +1330,6 @@ abstract class TestClass { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ClassLikeStringTest.php b/tests/ClassLikeStringTest.php index 8ac7e60b4a8..b12e73a8323 100644 --- a/tests/ClassLikeStringTest.php +++ b/tests/ClassLikeStringTest.php @@ -882,9 +882,6 @@ class TypeTwo {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ClassLoadOrderTest.php b/tests/ClassLoadOrderTest.php index 706df50b735..9d8f36c3893 100644 --- a/tests/ClassLoadOrderTest.php +++ b/tests/ClassLoadOrderTest.php @@ -119,9 +119,6 @@ class C extends B { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ClassScopeTest.php b/tests/ClassScopeTest.php index c00d1c590e2..3f6b950308b 100644 --- a/tests/ClassScopeTest.php +++ b/tests/ClassScopeTest.php @@ -150,9 +150,6 @@ protected static function foo(): void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ClassTest.php b/tests/ClassTest.php index 001dc5b5a87..25288267227 100644 --- a/tests/ClassTest.php +++ b/tests/ClassTest.php @@ -39,9 +39,6 @@ public function real_escape_string(string $string) ); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -845,9 +842,6 @@ function f(): I { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/CloneTest.php b/tests/CloneTest.php index 6b19178a337..4595d0049bd 100644 --- a/tests/CloneTest.php +++ b/tests/CloneTest.php @@ -12,9 +12,6 @@ class CloneTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -48,9 +45,6 @@ public function foo(): self { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ClosureTest.php b/tests/ClosureTest.php index 8ec439bdf8d..7e271c3eeee 100644 --- a/tests/ClosureTest.php +++ b/tests/ClosureTest.php @@ -12,9 +12,6 @@ class ClosureTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -920,9 +917,6 @@ private function handler(): void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/CodebaseTest.php b/tests/CodebaseTest.php index 4083e836a0e..8bb104e3a20 100644 --- a/tests/CodebaseTest.php +++ b/tests/CodebaseTest.php @@ -36,7 +36,6 @@ public function setUp(): void /** * @test * @dataProvider typeContainments - * */ public function isTypeContainedByType(string $input, string $container, bool $expected): void { @@ -66,7 +65,6 @@ public function typeContainments(): iterable /** * @test * @dataProvider typeIntersections - * */ public function canTypeBeContainedByType(string $input, string $container, bool $expected): void { @@ -94,9 +92,7 @@ public function typeIntersections(): iterable /** * @test * @dataProvider iterableParams - * * @param array{string,string} $expected - * */ public function getKeyValueParamsForTraversableObject(string $input, array $expected): void { @@ -129,7 +125,6 @@ public function iterableParams(): iterable /** * @test - * */ public function customMetadataIsPersisted(): void { @@ -201,7 +196,6 @@ public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event) /** * @test - * */ public function classExtendsRejectsUnpopulatedClasslikes(): void { diff --git a/tests/CommandFunctions/GetMemoryLimitInBytesTest.php b/tests/CommandFunctions/GetMemoryLimitInBytesTest.php index b842143df06..2ca629e6908 100644 --- a/tests/CommandFunctions/GetMemoryLimitInBytesTest.php +++ b/tests/CommandFunctions/GetMemoryLimitInBytesTest.php @@ -38,7 +38,6 @@ public function memoryLimitSettingProvider(): array /** * @dataProvider memoryLimitSettingProvider - * * @param int|string $setting * @param int|string $expectedBytes */ diff --git a/tests/ComposerLockTest.php b/tests/ComposerLockTest.php index fc46ccefe33..5a727e4ba99 100644 --- a/tests/ComposerLockTest.php +++ b/tests/ComposerLockTest.php @@ -213,7 +213,6 @@ private function pluginEntry(string $package_name, string $package_class): array /** * @param mixed $data - * * @psalm-pure */ private function jsonFile($data): string diff --git a/tests/Config/ConfigFileTest.php b/tests/Config/ConfigFileTest.php index 805fc88136c..32d1fc570ff 100644 --- a/tests/Config/ConfigFileTest.php +++ b/tests/Config/ConfigFileTest.php @@ -262,13 +262,9 @@ public function testInvalidExtension(): void } /** - * @param string $expected_template - * @param string $contents - * - * * @psalm-pure */ - protected static function compareContentWithTemplateAndTrailingLineEnding($expected_template, $contents): bool + protected static function compareContentWithTemplateAndTrailingLineEnding(string $expected_template, string $contents): bool { $passed = false; diff --git a/tests/Config/ConfigTest.php b/tests/Config/ConfigTest.php index 3fff4089e50..321bb8c48d2 100644 --- a/tests/Config/ConfigTest.php +++ b/tests/Config/ConfigTest.php @@ -866,7 +866,6 @@ public function testAllPossibleIssues(): void array_map( /** * @param string $issue_name - * * @return string */ fn($issue_name): string => '<' . $issue_name . ' errorLevel="suppress" />' . "\n", diff --git a/tests/Config/Plugin/Hook/AfterAnalysis.php b/tests/Config/Plugin/Hook/AfterAnalysis.php index 3c2e7186e76..d7fff9b7637 100644 --- a/tests/Config/Plugin/Hook/AfterAnalysis.php +++ b/tests/Config/Plugin/Hook/AfterAnalysis.php @@ -2,7 +2,6 @@ namespace Psalm\Test\Config\Plugin\Hook; -use Psalm\Internal\Analyzer\IssueData; use Psalm\Plugin\EventHandler\AfterAnalysisInterface; use Psalm\Plugin\EventHandler\Event\AfterAnalysisEvent; @@ -10,8 +9,6 @@ class AfterAnalysis implements AfterAnalysisInterface { /** * Called after analysis is complete - * - * @param array> $issues */ public static function afterAnalysis(AfterAnalysisEvent $event): void { diff --git a/tests/ConstValuesTest.php b/tests/ConstValuesTest.php index 643e69d8444..7ff3c51f7e1 100644 --- a/tests/ConstValuesTest.php +++ b/tests/ConstValuesTest.php @@ -10,9 +10,6 @@ class ConstValuesTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -108,9 +105,6 @@ class C {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ConstantTest.php b/tests/ConstantTest.php index 516c967750d..70b33cc5c7a 100644 --- a/tests/ConstantTest.php +++ b/tests/ConstantTest.php @@ -83,9 +83,6 @@ function bar(): Bar $this->analyzeFile($file2, new Context()); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -1527,9 +1524,6 @@ class Baz implements Foo ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/DeprecatedAnnotationTest.php b/tests/DeprecatedAnnotationTest.php index 9d817a24eb4..1accf441645 100644 --- a/tests/DeprecatedAnnotationTest.php +++ b/tests/DeprecatedAnnotationTest.php @@ -10,9 +10,6 @@ class DeprecatedAnnotationTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -105,9 +102,6 @@ class A { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/DocblockInheritanceTest.php b/tests/DocblockInheritanceTest.php index e532185ae88..bf5306244e8 100644 --- a/tests/DocblockInheritanceTest.php +++ b/tests/DocblockInheritanceTest.php @@ -10,9 +10,6 @@ class DocblockInheritanceTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -153,9 +150,6 @@ function takesF(F $f) : B { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/DocumentationTest.php b/tests/DocumentationTest.php index 3811396bb66..99616bbac55 100644 --- a/tests/DocumentationTest.php +++ b/tests/DocumentationTest.php @@ -200,14 +200,9 @@ public function testAllIssuesCovered(): void /** * @dataProvider providerInvalidCodeParse * @small - * - * @param string $code - * @param string $error_message * @param array $ignored_issues - * @param bool $check_references - * */ - public function testInvalidCode($code, $error_message, $ignored_issues = [], $check_references = false, string $php_version = '8.0'): void + public function testInvalidCode(string $code, string $error_message, array $ignored_issues = [], bool $check_references = false, string $php_version = '8.0'): void { if (strpos($this->getTestName(), 'SKIPPED-') !== false) { $this->markTestSkipped(); @@ -407,11 +402,17 @@ public function toString(): string return $this->inner->toString(); } + /** + * @param mixed $other + */ protected function matches($other): bool { return $this->inner->matches($other); } + /** + * @param mixed $other + */ protected function failureDescription($other): string { return $this->exporter()->shortenedExport($other) . ' ' . $this->toString(); diff --git a/tests/EndToEnd/PsalmRunnerTrait.php b/tests/EndToEnd/PsalmRunnerTrait.php index 75065071af7..309de6a6e66 100644 --- a/tests/EndToEnd/PsalmRunnerTrait.php +++ b/tests/EndToEnd/PsalmRunnerTrait.php @@ -16,7 +16,6 @@ trait PsalmRunnerTrait /** * @param list $args - * * @return array{STDOUT: string, STDERR: string, CODE: int|null} */ private function runPsalm( diff --git a/tests/EnumTest.php b/tests/EnumTest.php index f0b0b8af044..00489ac4740 100644 --- a/tests/EnumTest.php +++ b/tests/EnumTest.php @@ -10,9 +10,6 @@ class EnumTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -459,9 +456,6 @@ enum Test: string ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ExtendsFinalClassTest.php b/tests/ExtendsFinalClassTest.php index a0fb1e67560..a6ad592ed88 100644 --- a/tests/ExtendsFinalClassTest.php +++ b/tests/ExtendsFinalClassTest.php @@ -10,9 +10,6 @@ class ExtendsFinalClassTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -42,9 +39,6 @@ class B extends A {}' ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/FileDiffTest.php b/tests/FileDiffTest.php index 3b18fdb6900..278142d39b2 100644 --- a/tests/FileDiffTest.php +++ b/tests/FileDiffTest.php @@ -18,9 +18,7 @@ class FileDiffTest extends TestCase { /** * @dataProvider getChanges - * * @param string[] $same_methods - * */ public function testCode( string $a, @@ -62,7 +60,6 @@ public function testCode( $found_offsets = array_map( /** * @param array{0: int, 1: int, 2: int, 3: int} $arr - * * @return array{0: int, 1: int} */ fn(array $arr): array => [$arr[2], $arr[3]], @@ -76,12 +73,10 @@ public function testCode( /** * @dataProvider getChanges - * * @param string[] $same_methods * @param string[] $same_signatures * @param string[] $changed_methods * @param array $diff_map_offsets - * */ public function testPartialAstDiff( string $a, @@ -136,7 +131,6 @@ public function testPartialAstDiff( $found_offsets = array_map( /** * @param array{0: int, 1: int, 2: int, 3: int} $arr - * * @return array{0: int, 1: int} */ fn(array $arr): array => [$arr[2], $arr[3]], @@ -149,7 +143,6 @@ public function testPartialAstDiff( /** * @param array $a * @param array $b - * */ private function assertTreesEqual(array $a, array $b): void { diff --git a/tests/FileManipulation/ClassConstantMoveTest.php b/tests/FileManipulation/ClassConstantMoveTest.php index 707664328a1..767d0d67d7e 100644 --- a/tests/FileManipulation/ClassConstantMoveTest.php +++ b/tests/FileManipulation/ClassConstantMoveTest.php @@ -27,7 +27,6 @@ public function setUp(): void /** * @dataProvider providerValidCodeParse - * * @param array $constants_to_move */ public function testValidCode( diff --git a/tests/FileManipulation/ClassMoveTest.php b/tests/FileManipulation/ClassMoveTest.php index 5100b03087a..6dd79265e84 100644 --- a/tests/FileManipulation/ClassMoveTest.php +++ b/tests/FileManipulation/ClassMoveTest.php @@ -27,7 +27,6 @@ public function setUp(): void /** * @dataProvider providerValidCodeParse - * * @param array $constants_to_move */ public function testValidCode( diff --git a/tests/FileManipulation/FileManipulationTestCase.php b/tests/FileManipulation/FileManipulationTestCase.php index a916ecbb9af..627b31ebb9b 100644 --- a/tests/FileManipulation/FileManipulationTestCase.php +++ b/tests/FileManipulation/FileManipulationTestCase.php @@ -27,9 +27,7 @@ public function setUp(): void /** * @dataProvider providerValidCodeParse - * * @param string[] $issues_to_fix - * */ public function testValidCode( string $input_code, diff --git a/tests/FileManipulation/MethodMoveTest.php b/tests/FileManipulation/MethodMoveTest.php index ef195c582d9..0542c6ed538 100644 --- a/tests/FileManipulation/MethodMoveTest.php +++ b/tests/FileManipulation/MethodMoveTest.php @@ -27,7 +27,6 @@ public function setUp(): void /** * @dataProvider providerValidCodeParse - * * @param array $methods_to_move */ public function testValidCode( diff --git a/tests/FileManipulation/NamespaceMoveTest.php b/tests/FileManipulation/NamespaceMoveTest.php index 129663dfbb4..f72feb277f7 100644 --- a/tests/FileManipulation/NamespaceMoveTest.php +++ b/tests/FileManipulation/NamespaceMoveTest.php @@ -27,7 +27,6 @@ public function setUp(): void /** * @dataProvider providerValidCodeParse - * * @param array $namespaces_to_move */ public function testValidCode( diff --git a/tests/FileManipulation/PropertyMoveTest.php b/tests/FileManipulation/PropertyMoveTest.php index e9e98429e85..b313ada0269 100644 --- a/tests/FileManipulation/PropertyMoveTest.php +++ b/tests/FileManipulation/PropertyMoveTest.php @@ -27,7 +27,6 @@ public function setUp(): void /** * @dataProvider providerValidCodeParse - * * @param array $properties_to_move */ public function testValidCode( diff --git a/tests/FileReferenceTest.php b/tests/FileReferenceTest.php index c2c03ecd172..42d7d959780 100644 --- a/tests/FileReferenceTest.php +++ b/tests/FileReferenceTest.php @@ -38,13 +38,9 @@ public function setUp(): void /** * @dataProvider providerReferenceLocations - * - * @param string $input_code - * @param string $symbol * @param array $expected_locations - * */ - public function testReferenceLocations($input_code, $symbol, $expected_locations): void + public function testReferenceLocations(string $input_code, string $symbol, array $expected_locations): void { $test_name = $this->getTestName(); if (strpos($test_name, 'SKIPPED-') !== false) { @@ -80,12 +76,10 @@ public function testReferenceLocations($input_code, $symbol, $expected_locations /** * @dataProvider providerReferencedMethods - * * @param array> $expected_method_references_to_members * @param array> $expected_file_references_to_members * @param array> $expected_method_references_to_missing_members * @param array> $expected_file_references_to_missing_members - * */ public function testReferencedMethods( string $input_code, diff --git a/tests/FileUpdates/AnalyzedMethodTest.php b/tests/FileUpdates/AnalyzedMethodTest.php index 7908bffb7b3..5ac02a8e447 100644 --- a/tests/FileUpdates/AnalyzedMethodTest.php +++ b/tests/FileUpdates/AnalyzedMethodTest.php @@ -46,11 +46,9 @@ public function setUp(): void /** * @dataProvider providerTestValidUpdates - * * @param array $start_files * @param array $end_files * @param array $ignored_issues - * */ public function testValidInclude( array $start_files, diff --git a/tests/FileUpdates/ErrorAfterUpdateTest.php b/tests/FileUpdates/ErrorAfterUpdateTest.php index 08941b43263..804705ae7b8 100644 --- a/tests/FileUpdates/ErrorAfterUpdateTest.php +++ b/tests/FileUpdates/ErrorAfterUpdateTest.php @@ -48,10 +48,8 @@ public function setUp(): void /** * @dataProvider providerTestInvalidUpdates - * * @param array> $file_stages * @param array $ignored_issues - * */ public function testErrorAfterUpdate( array $file_stages, diff --git a/tests/FileUpdates/ErrorFixTest.php b/tests/FileUpdates/ErrorFixTest.php index 138eda5474c..ea9d24626de 100644 --- a/tests/FileUpdates/ErrorFixTest.php +++ b/tests/FileUpdates/ErrorFixTest.php @@ -48,11 +48,9 @@ public function setUp(): void /** * @dataProvider providerTestErrorFix - * * @param array> $files * @param array $error_counts * @param array $ignored_issues - * */ public function testErrorFix( array $files, diff --git a/tests/FileUpdates/TemporaryUpdateTest.php b/tests/FileUpdates/TemporaryUpdateTest.php index 24d3d2a6370..c33377d2d1e 100644 --- a/tests/FileUpdates/TemporaryUpdateTest.php +++ b/tests/FileUpdates/TemporaryUpdateTest.php @@ -51,11 +51,9 @@ public function setUp(): void /** * @dataProvider providerTestErrorFix - * * @param array> $file_stages * @param array> $error_positions * @param array $ignored_issues - * */ public function testErrorFix( array $file_stages, diff --git a/tests/ForbiddenCodeTest.php b/tests/ForbiddenCodeTest.php index aa57a589685..d4c248daad3 100644 --- a/tests/ForbiddenCodeTest.php +++ b/tests/ForbiddenCodeTest.php @@ -19,9 +19,6 @@ class ForbiddenCodeTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ @@ -53,9 +50,6 @@ public function providerInvalidCodeParse(): iterable ]; } - /** - * - */ public function providerValidCodeParse(): iterable { return [ diff --git a/tests/FunctionCallTest.php b/tests/FunctionCallTest.php index b96e58556ad..e2495965fe9 100644 --- a/tests/FunctionCallTest.php +++ b/tests/FunctionCallTest.php @@ -14,9 +14,6 @@ class FunctionCallTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -2035,9 +2032,6 @@ function foo(): string { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/GeneratorTest.php b/tests/GeneratorTest.php index a5ecb5e45f3..e0a8cd65248 100644 --- a/tests/GeneratorTest.php +++ b/tests/GeneratorTest.php @@ -10,9 +10,6 @@ class GeneratorTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -297,9 +294,6 @@ function generator(): Generator ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/IfThisIsTest.php b/tests/IfThisIsTest.php index fcd58bc0fda..ae9a973d7b3 100644 --- a/tests/IfThisIsTest.php +++ b/tests/IfThisIsTest.php @@ -10,9 +10,6 @@ class IfThisIsTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ diff --git a/tests/ImmutableAnnotationTest.php b/tests/ImmutableAnnotationTest.php index ddc02f659bd..afe1005eb02 100644 --- a/tests/ImmutableAnnotationTest.php +++ b/tests/ImmutableAnnotationTest.php @@ -10,9 +10,6 @@ class ImmutableAnnotationTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -550,9 +547,6 @@ function getDataItem(string $key) { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/IncludeTest.php b/tests/IncludeTest.php index bc20bdb840c..fafebbce394 100644 --- a/tests/IncludeTest.php +++ b/tests/IncludeTest.php @@ -16,17 +16,14 @@ class IncludeTest extends TestCase { /** * @dataProvider providerTestValidIncludes - * * @param array $files_to_check * @param array $files - * @param bool $hoist_constants * @param list $ignored_issues - * */ public function testValidInclude( array $files, array $files_to_check, - $hoist_constants = false, + bool $hoist_constants = false, array $ignored_issues = [] ): void { $codebase = $this->project_analyzer->getCodebase(); @@ -59,15 +56,13 @@ public function testValidInclude( /** * @dataProvider providerTestInvalidIncludes - * * @param array $files_to_check * @param array $files - * @param string $error_message */ public function testInvalidInclude( array $files, array $files_to_check, - $error_message + string $error_message ): void { if (strpos($this->getTestName(), 'SKIPPED-') !== false) { $this->markTestSkipped(); diff --git a/tests/IntRangeTest.php b/tests/IntRangeTest.php index 31d3350ead9..1a9b78a6124 100644 --- a/tests/IntRangeTest.php +++ b/tests/IntRangeTest.php @@ -22,9 +22,6 @@ public function testCombineIntRangeDoesntAffectOriginal(): void $this->assertEquals(10, $range->max_bound); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -860,9 +857,6 @@ function bar(int $_a, int $_b): void {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/InterfaceTest.php b/tests/InterfaceTest.php index 01b6af37641..84cd7430aff 100644 --- a/tests/InterfaceTest.php +++ b/tests/InterfaceTest.php @@ -12,9 +12,6 @@ class InterfaceTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -742,9 +739,6 @@ function takesAorB(SomeClass|SomeInterface $some): void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index a73750c4d71..4d4c7ce74ae 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -49,6 +49,7 @@ class InternalCallMapHandlerTest extends TestCase /** * Specify a function name as value, or a function name as key and * an array containing the PHP versions in which to ignore this function as values. + * * @var array> */ private static $ignoredFunctions = [ @@ -1304,7 +1305,6 @@ class InternalCallMapHandlerTest extends TestCase ]; /** - * * @var Codebase */ private static $codebase; @@ -1358,7 +1358,6 @@ public function testGetcallmapReturnsAValidCallmap(): void } /** - * * @return iterable}> */ public function callMapEntryProvider(): iterable @@ -1394,8 +1393,6 @@ public function callMapEntryProvider(): iterable } } - /** - */ private function isIgnored(string $functionName): bool { if (in_array($functionName, self::$ignoredFunctions)) { @@ -1411,8 +1408,6 @@ private function isIgnored(string $functionName): bool return false; } - /** - */ private function isReturnTypeOnlyIgnored(string $functionName): bool { if (in_array($functionName, static::$ignoredReturnTypeOnlyFunctions, true)) { @@ -1428,8 +1423,6 @@ private function isReturnTypeOnlyIgnored(string $functionName): bool return false; } - /** - */ private function isUnreflectableIgnored(string $functionName): bool { if (in_array($functionName, static::$ignoredUnreflectableFunctions, true)) { @@ -1503,6 +1496,7 @@ public function testIgnoredFunctionsStillFail(string $functionName, array $callM /** * This function will test functions that are in the callmap AND currently defined + * * @coversNothing * @depends testGetcallmapReturnsAValidCallmap * @depends testIgnoresAreSortedAndUnique @@ -1553,13 +1547,13 @@ private function getReflectionFunction(string $functionName): ?ReflectionFunctio } /** - * * @param array $entryParameters */ private function assertEntryParameters(ReflectionFunctionAbstract $function, array $entryParameters): void { /** * Parse the parameter names from the map. + * * @var array */ $normalizedEntries = []; @@ -1615,7 +1609,6 @@ private function assertEntryParameters(ReflectionFunctionAbstract $function, arr } /** - * * @param array{byRef: bool, name?: string, refMode: 'rw'|'w'|'r', variadic: bool, optional: bool, type: string} $normalizedEntry */ private function assertParameter(array $normalizedEntry, ReflectionParameter $param): void diff --git a/tests/Internal/Provider/ClassLikeStorageInstanceCacheProvider.php b/tests/Internal/Provider/ClassLikeStorageInstanceCacheProvider.php index 93015cd7d7a..d68083af077 100644 --- a/tests/Internal/Provider/ClassLikeStorageInstanceCacheProvider.php +++ b/tests/Internal/Provider/ClassLikeStorageInstanceCacheProvider.php @@ -34,11 +34,7 @@ public function getLatestFromCache(string $fq_classlike_name_lc, ?string $file_p return $cached_value; } - /** - * @param string $fq_classlike_name_lc - * - */ - private function loadFromCache($fq_classlike_name_lc): ?ClassLikeStorage + private function loadFromCache(string $fq_classlike_name_lc): ?ClassLikeStorage { return $this->cache[$fq_classlike_name_lc] ?? null; } diff --git a/tests/Internal/Provider/ParserInstanceCacheProvider.php b/tests/Internal/Provider/ParserInstanceCacheProvider.php index 766772cd600..e0bc1ef5671 100644 --- a/tests/Internal/Provider/ParserInstanceCacheProvider.php +++ b/tests/Internal/Provider/ParserInstanceCacheProvider.php @@ -59,7 +59,6 @@ public function loadExistingStatementsFromCache(string $file_path): ?array /** * @param list $stmts - * */ public function saveStatementsToCache(string $file_path, string $file_content_hash, array $stmts, bool $touch_only): void { diff --git a/tests/InternalAnnotationTest.php b/tests/InternalAnnotationTest.php index 6e2a8684911..3c31b09592e 100644 --- a/tests/InternalAnnotationTest.php +++ b/tests/InternalAnnotationTest.php @@ -10,9 +10,6 @@ class InternalAnnotationTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -612,9 +609,6 @@ public function baz(): void ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/IssueSuppressionTest.php b/tests/IssueSuppressionTest.php index 2c4847b9640..f8ef6835849 100644 --- a/tests/IssueSuppressionTest.php +++ b/tests/IssueSuppressionTest.php @@ -250,9 +250,6 @@ class Foo { IssueBuffer::processUnusedSuppressions($this->project_analyzer->getCodebase()->file_provider); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -409,9 +406,6 @@ public function foobar(): string ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/KeyOfArrayTest.php b/tests/KeyOfArrayTest.php index 1568392fd03..f22727dde60 100644 --- a/tests/KeyOfArrayTest.php +++ b/tests/KeyOfArrayTest.php @@ -12,9 +12,6 @@ class KeyOfArrayTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -154,9 +151,6 @@ function returnPropertyOfA() { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ListTest.php b/tests/ListTest.php index 0fd00501b3a..5dce65e5491 100644 --- a/tests/ListTest.php +++ b/tests/ListTest.php @@ -12,9 +12,6 @@ class ListTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -155,9 +152,6 @@ function foo(array $vars): void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Loop/DoTest.php b/tests/Loop/DoTest.php index cf7f0dc9573..d3a436c031f 100644 --- a/tests/Loop/DoTest.php +++ b/tests/Loop/DoTest.php @@ -13,9 +13,6 @@ class DoTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -365,9 +362,6 @@ function nextEvent(bool $c): void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Loop/ForTest.php b/tests/Loop/ForTest.php index 7c658b1bfa4..828d5c208ec 100644 --- a/tests/Loop/ForTest.php +++ b/tests/Loop/ForTest.php @@ -13,9 +13,6 @@ class ForTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -184,9 +181,6 @@ function h() { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Loop/ForeachTest.php b/tests/Loop/ForeachTest.php index ec0ab856d26..d5e498a1f08 100644 --- a/tests/Loop/ForeachTest.php +++ b/tests/Loop/ForeachTest.php @@ -13,9 +13,6 @@ class ForeachTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -1165,9 +1162,6 @@ function foo(array $files): void ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Loop/WhileTest.php b/tests/Loop/WhileTest.php index 3fa0380f8e2..2b90c10e11a 100644 --- a/tests/Loop/WhileTest.php +++ b/tests/Loop/WhileTest.php @@ -11,9 +11,6 @@ class WhileTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -694,9 +691,6 @@ function f() ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/MagicMethodAnnotationTest.php b/tests/MagicMethodAnnotationTest.php index 3ebf108d20c..6b431b8b71e 100644 --- a/tests/MagicMethodAnnotationTest.php +++ b/tests/MagicMethodAnnotationTest.php @@ -147,9 +147,6 @@ function foo(MyException $e): int { $this->analyzeFile('somefile.php', $context); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -943,9 +940,6 @@ class D extends C {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/MagicPropertyTest.php b/tests/MagicPropertyTest.php index 445b3ee1f12..72aeda98350 100644 --- a/tests/MagicPropertyTest.php +++ b/tests/MagicPropertyTest.php @@ -35,9 +35,6 @@ class Child {} $this->analyzeFile('somefile.php', new Context()); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -769,9 +766,6 @@ public function updateStatus(): array { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/MatchTest.php b/tests/MatchTest.php index fcb3aa9ae4d..943d3c296e8 100644 --- a/tests/MatchTest.php +++ b/tests/MatchTest.php @@ -10,9 +10,6 @@ class MatchTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -101,9 +98,6 @@ function test(array $array): array ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/MethodCallTest.php b/tests/MethodCallTest.php index ab39a66acaa..80abdecfddf 100644 --- a/tests/MethodCallTest.php +++ b/tests/MethodCallTest.php @@ -193,9 +193,6 @@ function printInt(int $int): void { $this->analyzeFile('somefile.php', new Context()); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -1029,9 +1026,6 @@ public function create($input): BlahModel ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/MethodSignatureTest.php b/tests/MethodSignatureTest.php index 5b503f2aff3..1a67e863598 100644 --- a/tests/MethodSignatureTest.php +++ b/tests/MethodSignatureTest.php @@ -289,9 +289,6 @@ public function __soapCall( $this->analyzeFile('somefile.php', new Context()); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -922,9 +919,6 @@ public function a(mixed $a): void {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/MixinAnnotationTest.php b/tests/MixinAnnotationTest.php index b1b088d5c4c..a1651c63686 100644 --- a/tests/MixinAnnotationTest.php +++ b/tests/MixinAnnotationTest.php @@ -10,9 +10,6 @@ class MixinAnnotationTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -600,9 +597,6 @@ class FooModel extends Model {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/NamespaceTest.php b/tests/NamespaceTest.php index 3f31eddb055..60d989a22bd 100644 --- a/tests/NamespaceTest.php +++ b/tests/NamespaceTest.php @@ -10,9 +10,6 @@ class NamespaceTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -92,9 +89,6 @@ function foo() : void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/NativeIntersectionsTest.php b/tests/NativeIntersectionsTest.php index 4ffe3366278..2bea8a9f40f 100644 --- a/tests/NativeIntersectionsTest.php +++ b/tests/NativeIntersectionsTest.php @@ -10,9 +10,6 @@ class NativeIntersectionsTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -57,9 +54,6 @@ function test(A&B $in): void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/NativeUnionsTest.php b/tests/NativeUnionsTest.php index cdae3105432..d28a9cbb5f6 100644 --- a/tests/NativeUnionsTest.php +++ b/tests/NativeUnionsTest.php @@ -65,9 +65,6 @@ function test(string|null $in): ?string { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Php40Test.php b/tests/Php40Test.php index 9cc142cbe05..fa2a661ff4c 100644 --- a/tests/Php40Test.php +++ b/tests/Php40Test.php @@ -8,9 +8,6 @@ class Php40Test extends TestCase { use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ diff --git a/tests/Php55Test.php b/tests/Php55Test.php index 5458a051018..fbfbc6e207b 100644 --- a/tests/Php55Test.php +++ b/tests/Php55Test.php @@ -8,9 +8,6 @@ class Php55Test extends TestCase { use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ diff --git a/tests/Php56Test.php b/tests/Php56Test.php index 699d10da9db..5dc67c79e7e 100644 --- a/tests/Php56Test.php +++ b/tests/Php56Test.php @@ -8,9 +8,6 @@ class Php56Test extends TestCase { use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ diff --git a/tests/Php70Test.php b/tests/Php70Test.php index e735000a59a..c8d31743d84 100644 --- a/tests/Php70Test.php +++ b/tests/Php70Test.php @@ -10,9 +10,6 @@ class Php70Test extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -216,9 +213,6 @@ class B { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Php71Test.php b/tests/Php71Test.php index 2ee9fa8f66c..4e8fe09f1d6 100644 --- a/tests/Php71Test.php +++ b/tests/Php71Test.php @@ -10,9 +10,6 @@ class Php71Test extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -275,9 +272,6 @@ function create_resource($op) { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/PropertiesOfTest.php b/tests/PropertiesOfTest.php index 2ea5cc03be6..0f36623ab01 100644 --- a/tests/PropertiesOfTest.php +++ b/tests/PropertiesOfTest.php @@ -10,9 +10,6 @@ class PropertiesOfTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -252,9 +249,6 @@ public function asArray() { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/PropertyTypeInvarianceTest.php b/tests/PropertyTypeInvarianceTest.php index 19e30a39837..fdf00095bab 100644 --- a/tests/PropertyTypeInvarianceTest.php +++ b/tests/PropertyTypeInvarianceTest.php @@ -10,9 +10,6 @@ class PropertyTypeInvarianceTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ diff --git a/tests/PropertyTypeTest.php b/tests/PropertyTypeTest.php index 9fdbe8d9b36..1a29a4d7e28 100644 --- a/tests/PropertyTypeTest.php +++ b/tests/PropertyTypeTest.php @@ -550,9 +550,6 @@ public function getX(bool $b): int { $this->analyzeFile('somefile.php', new Context()); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -2693,9 +2690,6 @@ class Baz ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/PureAnnotationTest.php b/tests/PureAnnotationTest.php index 00b0f8dc5a6..c5cdd484f92 100644 --- a/tests/PureAnnotationTest.php +++ b/tests/PureAnnotationTest.php @@ -10,9 +10,6 @@ class PureAnnotationTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -466,9 +463,6 @@ class Date2{ ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/PureCallableTest.php b/tests/PureCallableTest.php index 67feb644a05..79817fb3a0e 100644 --- a/tests/PureCallableTest.php +++ b/tests/PureCallableTest.php @@ -10,9 +10,6 @@ class PureCallableTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -237,9 +234,6 @@ function max_by(array $values, callable $num_func) : ?int { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ReadonlyPropertyTest.php b/tests/ReadonlyPropertyTest.php index 797d90b1f3e..69164c1f17f 100644 --- a/tests/ReadonlyPropertyTest.php +++ b/tests/ReadonlyPropertyTest.php @@ -12,9 +12,6 @@ class ReadonlyPropertyTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -134,9 +131,6 @@ public function __construct() { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ReferenceConstraintTest.php b/tests/ReferenceConstraintTest.php index 7c78b6214d9..4359edef594 100644 --- a/tests/ReferenceConstraintTest.php +++ b/tests/ReferenceConstraintTest.php @@ -10,9 +10,6 @@ class ReferenceConstraintTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -199,9 +196,6 @@ function takesNullableObj(?A &$a): bool { return true; } ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ReferenceTest.php b/tests/ReferenceTest.php index b920c58c278..b50f79fee7d 100644 --- a/tests/ReferenceTest.php +++ b/tests/ReferenceTest.php @@ -12,9 +12,6 @@ class ReferenceTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -300,9 +297,6 @@ function func(array &$a): void ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/ReturnTypeProvider/ExceptionCodeTest.php b/tests/ReturnTypeProvider/ExceptionCodeTest.php index ec1e389604d..cf78634153a 100644 --- a/tests/ReturnTypeProvider/ExceptionCodeTest.php +++ b/tests/ReturnTypeProvider/ExceptionCodeTest.php @@ -9,9 +9,6 @@ class ExceptionCodeTest extends TestCase { use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { yield 'RuntimeException' => [ diff --git a/tests/ReturnTypeTest.php b/tests/ReturnTypeTest.php index 3483dbe58cd..65d6796e79e 100644 --- a/tests/ReturnTypeTest.php +++ b/tests/ReturnTypeTest.php @@ -12,9 +12,6 @@ class ReturnTypeTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -1182,9 +1179,6 @@ function alwaysNull(): null { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/SuperGlobalsTest.php b/tests/SuperGlobalsTest.php index f3d70f36caf..84d4018d846 100644 --- a/tests/SuperGlobalsTest.php +++ b/tests/SuperGlobalsTest.php @@ -8,9 +8,6 @@ class SuperGlobalsTest extends TestCase { use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { yield 'http_response_headerIsList' => [ diff --git a/tests/SwitchTypeTest.php b/tests/SwitchTypeTest.php index a1fbb3641f0..75aa02319c2 100644 --- a/tests/SwitchTypeTest.php +++ b/tests/SwitchTypeTest.php @@ -12,9 +12,6 @@ class SwitchTypeTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -1090,9 +1087,6 @@ function bar (string $name): int { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TaintTest.php b/tests/TaintTest.php index 744f046a172..fd461807e81 100644 --- a/tests/TaintTest.php +++ b/tests/TaintTest.php @@ -2393,7 +2393,6 @@ public static function getPrevious(string $s): string { } /** - * @param string $code * @param list $expectedIssuesTypes * @test * @dataProvider multipleTaintIssuesAreDetectedDataProvider diff --git a/tests/Template/ClassStringMapTest.php b/tests/Template/ClassStringMapTest.php index f3a4a47a947..2bf4aca174e 100644 --- a/tests/Template/ClassStringMapTest.php +++ b/tests/Template/ClassStringMapTest.php @@ -11,9 +11,6 @@ class ClassStringMapTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -89,9 +86,6 @@ function foo(array $arr) : void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Template/ClassTemplateCovarianceTest.php b/tests/Template/ClassTemplateCovarianceTest.php index 07a0b71e7a5..8c3110681e9 100644 --- a/tests/Template/ClassTemplateCovarianceTest.php +++ b/tests/Template/ClassTemplateCovarianceTest.php @@ -11,9 +11,6 @@ class ClassTemplateCovarianceTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -534,9 +531,6 @@ function run(Container $container): void{} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Template/ClassTemplateExtendsTest.php b/tests/Template/ClassTemplateExtendsTest.php index 8492327357b..537b2535269 100644 --- a/tests/Template/ClassTemplateExtendsTest.php +++ b/tests/Template/ClassTemplateExtendsTest.php @@ -13,9 +13,6 @@ class ClassTemplateExtendsTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -4636,9 +4633,6 @@ class Secondary {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Template/ClassTemplateTest.php b/tests/Template/ClassTemplateTest.php index 677c078bacb..f447f8d8c00 100644 --- a/tests/Template/ClassTemplateTest.php +++ b/tests/Template/ClassTemplateTest.php @@ -13,9 +13,6 @@ class ClassTemplateTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -3992,9 +3989,6 @@ function foobar(DoesNotExist $baz): void {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Template/ConditionalReturnTypeTest.php b/tests/Template/ConditionalReturnTypeTest.php index 98f13c0a74e..dca767b77a0 100644 --- a/tests/Template/ConditionalReturnTypeTest.php +++ b/tests/Template/ConditionalReturnTypeTest.php @@ -9,9 +9,6 @@ class ConditionalReturnTypeTest extends TestCase { use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ diff --git a/tests/Template/FunctionClassStringTemplateTest.php b/tests/Template/FunctionClassStringTemplateTest.php index 46ef12118dd..d6c4312c93f 100644 --- a/tests/Template/FunctionClassStringTemplateTest.php +++ b/tests/Template/FunctionClassStringTemplateTest.php @@ -11,9 +11,6 @@ class FunctionClassStringTemplateTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -779,9 +776,6 @@ function getSourceAssertType(string $class, MyObject $source): MyObject { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Template/FunctionTemplateAssertTest.php b/tests/Template/FunctionTemplateAssertTest.php index a71c2d8815e..19cf9b9b4b1 100644 --- a/tests/Template/FunctionTemplateAssertTest.php +++ b/tests/Template/FunctionTemplateAssertTest.php @@ -11,9 +11,6 @@ class FunctionTemplateAssertTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -922,9 +919,6 @@ function acceptsArray(array $_list): void {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Template/FunctionTemplateTest.php b/tests/Template/FunctionTemplateTest.php index 954156d68c3..a6edfaac9e4 100644 --- a/tests/Template/FunctionTemplateTest.php +++ b/tests/Template/FunctionTemplateTest.php @@ -11,9 +11,6 @@ class FunctionTemplateTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -1665,9 +1662,6 @@ function normalizeField(mixed $value, Norm $n): void ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Template/KeyOfTemplateTest.php b/tests/Template/KeyOfTemplateTest.php index 1da3d777e03..c59619ee347 100644 --- a/tests/Template/KeyOfTemplateTest.php +++ b/tests/Template/KeyOfTemplateTest.php @@ -13,9 +13,6 @@ class KeyOfTemplateTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -98,9 +95,6 @@ function toListOfKeys(array $array): array { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Template/NestedTemplateTest.php b/tests/Template/NestedTemplateTest.php index fceb2620d9d..dd1bca2081b 100644 --- a/tests/Template/NestedTemplateTest.php +++ b/tests/Template/NestedTemplateTest.php @@ -11,9 +11,6 @@ class NestedTemplateTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -127,9 +124,6 @@ function toList(array $arr): array { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Template/PropertiesOfTemplateTest.php b/tests/Template/PropertiesOfTemplateTest.php index b3411c349de..cdcb95c5865 100644 --- a/tests/Template/PropertiesOfTemplateTest.php +++ b/tests/Template/PropertiesOfTemplateTest.php @@ -11,9 +11,6 @@ class PropertiesOfTemplateTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -194,9 +191,6 @@ class A { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Template/TraitTemplateTest.php b/tests/Template/TraitTemplateTest.php index 2bdf83381da..f7651b3f5de 100644 --- a/tests/Template/TraitTemplateTest.php +++ b/tests/Template/TraitTemplateTest.php @@ -11,9 +11,6 @@ class TraitTemplateTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -516,9 +513,6 @@ public function get() { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Template/ValueOfTemplateTest.php b/tests/Template/ValueOfTemplateTest.php index 2d5247436d9..0f66feb9814 100644 --- a/tests/Template/ValueOfTemplateTest.php +++ b/tests/Template/ValueOfTemplateTest.php @@ -13,9 +13,6 @@ class ValueOfTemplateTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -74,9 +71,6 @@ function toList(array $array): array { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TestCase.php b/tests/TestCase.php index b219a29a7f2..bca0036a1e8 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -92,32 +92,19 @@ public function tearDown(): void RuntimeCaches::clearAll(); } - /** - * @param string $file_path - * @param string $contents - * - */ - public function addFile($file_path, $contents): void + public function addFile(string $file_path, string $contents): void { $this->file_provider->registerFile($file_path, $contents); $this->project_analyzer->getCodebase()->scanner->addFileToShallowScan($file_path); } - /** - * @param string $file_path - * @param string $contents - */ - public function addStubFile($file_path, $contents): void + public function addStubFile(string $file_path, string $contents): void { $this->file_provider->registerFile($file_path, $contents); $this->project_analyzer->getConfig()->addStubFile($file_path); } - /** - * @param string $file_path - * - */ - public function analyzeFile($file_path, Context $context, bool $track_unused_suppressions = true, bool $taint_flow_tracking = false): void + public function analyzeFile(string $file_path, Context $context, bool $track_unused_suppressions = true, bool $taint_flow_tracking = false): void { $codebase = $this->project_analyzer->getCodebase(); @@ -153,11 +140,7 @@ public function analyzeFile($file_path, Context $context, bool $track_unused_sup } } - /** - * @param bool $withDataSet - * - */ - protected function getTestName($withDataSet = true): string + protected function getTestName(bool $withDataSet = true): string { return $this->getName($withDataSet); } diff --git a/tests/ThisOutTest.php b/tests/ThisOutTest.php index b3652771543..b0d4b4f6436 100644 --- a/tests/ThisOutTest.php +++ b/tests/ThisOutTest.php @@ -8,9 +8,6 @@ class ThisOutTest extends TestCase { use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ diff --git a/tests/ToStringTest.php b/tests/ToStringTest.php index d59c03a6959..4b89a00a74f 100644 --- a/tests/ToStringTest.php +++ b/tests/ToStringTest.php @@ -10,9 +10,6 @@ class ToStringTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -210,9 +207,6 @@ public function __toString() { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TraceTest.php b/tests/TraceTest.php index 50c463885f8..f4c4a4cc9c0 100644 --- a/tests/TraceTest.php +++ b/tests/TraceTest.php @@ -8,9 +8,6 @@ class TraceTest extends TestCase { use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TraitTest.php b/tests/TraitTest.php index 68e61d23b65..f6d75d7903e 100644 --- a/tests/TraitTest.php +++ b/tests/TraitTest.php @@ -12,9 +12,6 @@ class TraitTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -1007,9 +1004,6 @@ trait T {} ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/Traits/InvalidCodeAnalysisTestTrait.php b/tests/Traits/InvalidCodeAnalysisTestTrait.php index d139f74c9f6..fc022cd7a75 100644 --- a/tests/Traits/InvalidCodeAnalysisTestTrait.php +++ b/tests/Traits/InvalidCodeAnalysisTestTrait.php @@ -26,7 +26,6 @@ abstract public function providerInvalidCodeParse(): iterable; /** * @dataProvider providerInvalidCodeParse * @small - * * @param list $error_levels */ public function testInvalidCode( diff --git a/tests/Traits/ValidCodeAnalysisTestTrait.php b/tests/Traits/ValidCodeAnalysisTestTrait.php index ad346b3771c..f5f710ecbaa 100644 --- a/tests/Traits/ValidCodeAnalysisTestTrait.php +++ b/tests/Traits/ValidCodeAnalysisTestTrait.php @@ -24,16 +24,13 @@ abstract public function providerValidCodeParse(): iterable; /** * @dataProvider providerValidCodeParse - * - * @param string $code * @param array $assertions * @param list $ignored_issues - * * @small */ public function testValidCode( - $code, - $assertions = [], + string $code, + array $assertions = [], $ignored_issues = [], string $php_version = '7.3' ): void { diff --git a/tests/TryCatchTest.php b/tests/TryCatchTest.php index de74cceb8fb..444ce65e509 100644 --- a/tests/TryCatchTest.php +++ b/tests/TryCatchTest.php @@ -10,9 +10,6 @@ class TryCatchTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -494,9 +491,6 @@ function foo() : void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TypeAnnotationTest.php b/tests/TypeAnnotationTest.php index 8cadb208886..ec23ccd462c 100644 --- a/tests/TypeAnnotationTest.php +++ b/tests/TypeAnnotationTest.php @@ -10,9 +10,6 @@ class TypeAnnotationTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -659,9 +656,6 @@ public function doStuff(): array { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TypeCombinationTest.php b/tests/TypeCombinationTest.php index e0a83fd68bf..b2219e92007 100644 --- a/tests/TypeCombinationTest.php +++ b/tests/TypeCombinationTest.php @@ -13,12 +13,9 @@ class TypeCombinationTest extends TestCase /** * @dataProvider providerTestValidTypeCombination - * - * @param string $expected * @param non-empty-list $types - * */ - public function testValidTypeCombination($expected, $types): void + public function testValidTypeCombination(string $expected, array $types): void { $converted_types = []; @@ -35,9 +32,6 @@ public function testValidTypeCombination($expected, $types): void ); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -826,11 +820,7 @@ public function providerTestValidTypeCombination(): array ]; } - /** - * @param string $string - * - */ - private static function getAtomic($string): Atomic + private static function getAtomic(string $string): Atomic { return Type::parseString($string)->getSingleAtomic(); } diff --git a/tests/TypeReconciliation/ArrayKeyExistsTest.php b/tests/TypeReconciliation/ArrayKeyExistsTest.php index 1a67cc9bea4..a8e7aeaea50 100644 --- a/tests/TypeReconciliation/ArrayKeyExistsTest.php +++ b/tests/TypeReconciliation/ArrayKeyExistsTest.php @@ -13,9 +13,6 @@ class ArrayKeyExistsTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -491,9 +488,6 @@ public function isCriticalError(int|string $key): bool { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TypeReconciliation/AssignmentInConditionalTest.php b/tests/TypeReconciliation/AssignmentInConditionalTest.php index f589ec80d9d..6a8e3f7aab7 100644 --- a/tests/TypeReconciliation/AssignmentInConditionalTest.php +++ b/tests/TypeReconciliation/AssignmentInConditionalTest.php @@ -11,9 +11,6 @@ class AssignmentInConditionalTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -458,9 +455,6 @@ function foo(int $b): void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TypeReconciliation/ConditionalTest.php b/tests/TypeReconciliation/ConditionalTest.php index 10caa709a29..a8d9a2378b0 100644 --- a/tests/TypeReconciliation/ConditionalTest.php +++ b/tests/TypeReconciliation/ConditionalTest.php @@ -11,9 +11,6 @@ class ConditionalTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -2976,9 +2973,6 @@ function bar($m): void ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TypeReconciliation/EmptyTest.php b/tests/TypeReconciliation/EmptyTest.php index 90a6f3bf252..f3b0644aba3 100644 --- a/tests/TypeReconciliation/EmptyTest.php +++ b/tests/TypeReconciliation/EmptyTest.php @@ -11,9 +11,6 @@ class EmptyTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -449,9 +446,6 @@ function foo(array $arr): void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TypeReconciliation/InArrayTest.php b/tests/TypeReconciliation/InArrayTest.php index 718354c7d1a..13bf529d3fc 100644 --- a/tests/TypeReconciliation/InArrayTest.php +++ b/tests/TypeReconciliation/InArrayTest.php @@ -13,9 +13,6 @@ class InArrayTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -231,9 +228,6 @@ function contains(string $a, string $b, mixed $element): void ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TypeReconciliation/IssetTest.php b/tests/TypeReconciliation/IssetTest.php index 7df17565a40..63f6980e654 100644 --- a/tests/TypeReconciliation/IssetTest.php +++ b/tests/TypeReconciliation/IssetTest.php @@ -11,9 +11,6 @@ class IssetTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -1032,9 +1029,6 @@ function foo(array $test) : void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TypeReconciliation/ReconcilerTest.php b/tests/TypeReconciliation/ReconcilerTest.php index 4f86dbbc9c0..44363d6f20b 100644 --- a/tests/TypeReconciliation/ReconcilerTest.php +++ b/tests/TypeReconciliation/ReconcilerTest.php @@ -89,12 +89,8 @@ public function testReconcilation(string $expected_type, Assertion $assertion, s /** * @dataProvider providerTestTypeIsContainedBy - * - * @param string $input - * @param string $container - * */ - public function testTypeIsContainedBy($input, $container): void + public function testTypeIsContainedBy(string $input, string $container): void { $this->assertTrue( UnionTypeComparator::isContainedBy( diff --git a/tests/TypeReconciliation/RedundantConditionTest.php b/tests/TypeReconciliation/RedundantConditionTest.php index 439142e8f8f..330eba4cd3a 100644 --- a/tests/TypeReconciliation/RedundantConditionTest.php +++ b/tests/TypeReconciliation/RedundantConditionTest.php @@ -13,9 +13,6 @@ class RedundantConditionTest extends TestCase use ValidCodeAnalysisTestTrait; use InvalidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -921,9 +918,6 @@ function f(array $p) : void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TypeReconciliation/ScopeTest.php b/tests/TypeReconciliation/ScopeTest.php index c8cc2ed7e72..eaf26ef7fbf 100644 --- a/tests/TypeReconciliation/ScopeTest.php +++ b/tests/TypeReconciliation/ScopeTest.php @@ -13,9 +13,6 @@ class ScopeTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -214,9 +211,6 @@ function a(): ?int { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TypeReconciliation/TypeAlgebraTest.php b/tests/TypeReconciliation/TypeAlgebraTest.php index b5e0a31e137..6e5b6c5b690 100644 --- a/tests/TypeReconciliation/TypeAlgebraTest.php +++ b/tests/TypeReconciliation/TypeAlgebraTest.php @@ -11,9 +11,6 @@ class TypeAlgebraTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -1217,9 +1214,6 @@ function test(string|object $s, bool $b) : string { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/TypeReconciliation/TypeTest.php b/tests/TypeReconciliation/TypeTest.php index 491451fcbd8..8e1edbe77f0 100644 --- a/tests/TypeReconciliation/TypeTest.php +++ b/tests/TypeReconciliation/TypeTest.php @@ -13,9 +13,6 @@ class TypeTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ diff --git a/tests/TypeReconciliation/ValueTest.php b/tests/TypeReconciliation/ValueTest.php index 8722a5694b8..ab3b2d1e1a7 100644 --- a/tests/TypeReconciliation/ValueTest.php +++ b/tests/TypeReconciliation/ValueTest.php @@ -34,9 +34,6 @@ public function setUp(): void $this->project_analyzer->setPhpVersion('7.3', 'tests'); } - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -920,9 +917,6 @@ function foo(string $s) : void { ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/UnusedCodeTest.php b/tests/UnusedCodeTest.php index 9398e66f68a..bb061f0330a 100644 --- a/tests/UnusedCodeTest.php +++ b/tests/UnusedCodeTest.php @@ -43,12 +43,9 @@ public function setUp(): void /** * @dataProvider providerValidCodeParse - * - * @param string $code * @param array $ignored_issues - * */ - public function testValidCode($code, array $ignored_issues = []): void + public function testValidCode(string $code, array $ignored_issues = []): void { $test_name = $this->getTestName(); if (strpos($test_name, 'SKIPPED-') !== false) { @@ -77,13 +74,9 @@ public function testValidCode($code, array $ignored_issues = []): void /** * @dataProvider providerInvalidCodeParse - * - * @param string $code - * @param string $error_message * @param array $ignored_issues - * */ - public function testInvalidCode($code, $error_message, $ignored_issues = []): void + public function testInvalidCode(string $code, string $error_message, array $ignored_issues = []): void { if (strpos($this->getTestName(), 'SKIPPED-') !== false) { $this->markTestSkipped(); diff --git a/tests/UnusedVariableTest.php b/tests/UnusedVariableTest.php index a086b691410..8ea31daa19d 100644 --- a/tests/UnusedVariableTest.php +++ b/tests/UnusedVariableTest.php @@ -40,12 +40,9 @@ public function setUp(): void /** * @dataProvider providerValidCodeParse - * - * @param string $code * @param array $ignored_issues - * */ - public function testValidCode($code, array $ignored_issues = [], string $php_version = '7.4'): void + public function testValidCode(string $code, array $ignored_issues = [], string $php_version = '7.4'): void { $test_name = $this->getTestName(); if (strpos($test_name, 'SKIPPED-') !== false) { @@ -70,13 +67,9 @@ public function testValidCode($code, array $ignored_issues = [], string $php_ver /** * @dataProvider providerInvalidCodeParse - * - * @param string $code - * @param string $error_message * @param array $ignored_issues - * */ - public function testInvalidCode($code, $error_message, $ignored_issues = []): void + public function testInvalidCode(string $code, string $error_message, array $ignored_issues = []): void { if (strpos($this->getTestName(), 'SKIPPED-') !== false) { $this->markTestSkipped(); diff --git a/tests/ValueOfTest.php b/tests/ValueOfTest.php index 344a03fc844..83a4ad8c408 100644 --- a/tests/ValueOfTest.php +++ b/tests/ValueOfTest.php @@ -12,9 +12,6 @@ class ValueOfTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - /** - * - */ public function providerValidCodeParse(): iterable { return [ @@ -212,9 +209,6 @@ function foobar(int|string $arg): void ]; } - /** - * - */ public function providerInvalidCodeParse(): iterable { return [