Skip to content
Permalink
Browse files

Remove redundant @psalm-suppress in Psalm’s codebsae

  • Loading branch information...
muglug committed Aug 18, 2019
1 parent 5d94e34 commit c5f62d261d2350926e035b7ec5006b3899e610b5
Showing with 21 additions and 305 deletions.
  1. +0 −1 examples/TemplateChecker.php
  2. +0 −1 examples/TemplateScanner.php
  3. +0 −7 src/Psalm/Config.php
  4. +0 −3 src/Psalm/Config/Creator.php
  5. +0 −1 src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php
  6. +0 −2 src/Psalm/Internal/Analyzer/CommentAnalyzer.php
  7. +0 −2 src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
  8. +0 −3 src/Psalm/Internal/Analyzer/MethodAnalyzer.php
  9. +0 −2 src/Psalm/Internal/Analyzer/ProjectAnalyzer.php
  10. +0 −1 src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php
  11. +0 −1 src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php
  12. +0 −3 src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php
  13. +0 −1 src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php
  14. +0 −2 src/Psalm/Internal/Analyzer/StatementsAnalyzer.php
  15. +4 −3 src/Psalm/Internal/Codebase/Analyzer.php
  16. +0 −1 src/Psalm/Internal/Codebase/CallMap.php
  17. +0 −2 src/Psalm/Internal/Codebase/PropertyMap.php
  18. +0 −3 src/Psalm/Internal/Codebase/Scanner.php
  19. +0 −1 src/Psalm/Internal/Diff/DiffElem.php
  20. +0 −1 src/Psalm/Internal/Diff/FileStatementsDiffer.php
  21. +0 −4 src/Psalm/Internal/Fork/Pool.php
  22. +0 −5 src/Psalm/Internal/PluginManager/Command/DisableCommand.php
  23. +0 −5 src/Psalm/Internal/PluginManager/Command/EnableCommand.php
  24. +0 −9 src/Psalm/Internal/Provider/FileReferenceCacheProvider.php
  25. +1 −18 src/Psalm/Internal/Provider/FileReferenceProvider.php
  26. +1 −15 src/Psalm/Internal/Provider/FunctionExistenceProvider.php
  27. +1 −15 src/Psalm/Internal/Provider/FunctionParamsProvider.php
  28. +1 −15 src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php
  29. +1 −15 src/Psalm/Internal/Provider/MethodExistenceProvider.php
  30. +1 −15 src/Psalm/Internal/Provider/MethodParamsProvider.php
  31. +1 −15 src/Psalm/Internal/Provider/MethodReturnTypeProvider.php
  32. +1 −15 src/Psalm/Internal/Provider/MethodVisibilityProvider.php
  33. +1 −15 src/Psalm/Internal/Provider/PropertyExistenceProvider.php
  34. +1 −15 src/Psalm/Internal/Provider/PropertyTypeProvider.php
  35. +1 −15 src/Psalm/Internal/Provider/PropertyVisibilityProvider.php
  36. +0 −1 src/Psalm/Internal/Type/TypeCombination.php
  37. +0 −1 src/Psalm/Internal/Visitor/PartialParserVisitor.php
  38. +0 −2 src/Psalm/Internal/Visitor/ReflectorVisitor.php
  39. +0 −2 src/Psalm/Internal/Visitor/SimpleNameResolver.php
  40. +0 −1 src/Psalm/PluginRegistrationSocket.php
  41. +0 −2 src/Psalm/Type/Algebra.php
  42. +0 −5 src/command_functions.php
  43. +0 −10 tests/Config/PluginListTest.php
  44. +0 −27 tests/Internal/Provider/FakeFileReferenceCacheProvider.php
  45. +0 −1 tests/MethodMutationTest.php
  46. +0 −1 tests/ProjectCheckerTest.php
  47. +6 −20 tests/PsalmPluginTest.php
@@ -44,7 +44,6 @@ public function analyze(Context $context = null, $update_docblocks = false, Cont
throw new \InvalidArgumentException('Could not interpret doc comment correctly');
}
/** @psalm-suppress MixedArgument */
$this_params = $this->checkMethod($matches[1], $first_stmt, $codebase);
if ($this_params === false) {
@@ -49,7 +49,6 @@ public function scan(
throw new \InvalidArgumentException('Could not interpret doc comment correctly');
}
/** @psalm-suppress MixedArgument */
list($fq_class_name) = explode('::', $matches[1]);
$codebase->scanner->queueClassLikeForScanning(
@@ -648,7 +648,6 @@ private static function validateXmlConfig(string $file_contents): void
* @psalm-suppress MixedMethodCall
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedOperand
* @psalm-suppress MixedPropertyAssignment
* @psalm-suppress MixedArgument
* @psalm-suppress MixedPropertyFetch
*
@@ -1538,7 +1537,6 @@ public function getPredefinedConstants()
/**
* @return void
* @psalm-suppress MixedTypeCoercion
*/
public function collectPredefinedConstants()
{
@@ -1555,9 +1553,6 @@ public function getPredefinedFunctions()
/**
* @return void
* @psalm-suppress InvalidPropertyAssignment
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedArrayOffset
*/
public function collectPredefinedFunctions()
{
@@ -1600,7 +1595,6 @@ public function visitComposerAutoloadFiles(ProjectAnalyzer $project_analyzer, Pr
}
if (file_exists($composer_json_path)) {
/** @psalm-suppress PossiblyFalseArgument */
if (!$composer_json = json_decode(file_get_contents($composer_json_path), true)) {
throw new \UnexpectedValueException('Invalid composer.json at ' . $composer_json_path);
}
@@ -1625,7 +1619,6 @@ public function visitComposerAutoloadFiles(ProjectAnalyzer $project_analyzer, Pr
if (file_exists($vendor_autoload_files_path)) {
/**
* @var string[]
* @psalm-suppress UnresolvableInclude
*/
$vendor_autoload_files = require $vendor_autoload_files_path;
@@ -88,7 +88,6 @@ public static function getContents(
/**
* @return string[]
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedOperand
* @psalm-suppress MixedArgument
*/
private static function getPsr4Or0Paths(string $current_dir, array $composer_json) : array
@@ -138,8 +137,6 @@ private static function getPsr4Or0Paths(string $current_dir, array $composer_jso
/**
* @return string[]
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedOperand
*/
private static function guessPhpFileDirs(string $current_dir) : array
{
@@ -374,7 +374,6 @@ public static function checkFullyQualifiedClassLikeName(
}
if ($file_manipulations) {
/** @psalm-suppress MixedTypeCoercion */
FileManipulationBuffer::add($code_location->file_path, $file_manipulations);
}
}
@@ -49,7 +49,6 @@ class CommentAnalyzer
* @throws DocblockParseException if there was a problem parsing the docblock
*
* @return VarDocblockComment[]
* @psalm-suppress MixedArrayAccess
*/
public static function getTypeFromComment(
PhpParser\Comment\Doc $comment,
@@ -322,7 +321,6 @@ private static function getTypeAliasesFromCommentLines(
* @throws DocblockParseException if there was a problem parsing the docblock
*
* @return FunctionDocblockComment
* @psalm-suppress MixedArrayAccess
*/
public static function extractFunctionDocblockInfo(PhpParser\Comment\Doc $comment)
{
@@ -620,8 +620,6 @@ function (FunctionLikeParameter $p) {
}
/**
* @psalm-suppress MixedArrayAccess
*
* @var PhpParser\Node\Param
*/
$parser_param = $this->function->getParams()[$offset];
@@ -35,9 +35,6 @@
*/
class MethodAnalyzer extends FunctionLikeAnalyzer
{
/**
* @psalm-suppress MixedAssignment
*/
public function __construct(
PhpParser\Node\Stmt\ClassMethod $function,
SourceAnalyzer $source,
@@ -1199,8 +1199,6 @@ public function setAllIssuesToFix(): void
/**
* @return array<string, bool>
*
* @psalm-suppress PossiblyUnusedMethod - need to fix #422
*/
public function getIssuesToFix()
{
@@ -32,7 +32,6 @@ class ArrayAssignmentAnalyzer
* @param Type\Union $assignment_value_type
*
* @return void
* @psalm-suppress MixedMethodCall - some funky logic here
*/
public static function analyze(
StatementsAnalyzer $statements_analyzer,
@@ -1312,7 +1312,6 @@ function (Assertion $assertion) use ($class_template_params) : Assertion {
}
if ($file_manipulations) {
/** @psalm-suppress MixedTypeCoercion */
FileManipulationBuffer::add($statements_analyzer->getFilePath(), $file_manipulations);
}
}
@@ -984,7 +984,6 @@ function (Assertion $assertion) use ($found_generic_params) : Assertion {
}
if ($file_manipulations) {
/** @psalm-suppress MixedTypeCoercion */
FileManipulationBuffer::add($statements_analyzer->getFilePath(), $file_manipulations);
}
}
@@ -1075,7 +1074,6 @@ function (Assertion $assertion) use ($found_generic_params) : Assertion {
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
/** @psalm-suppress PossiblyInvalidArgument never a string, PHP Parser bug */
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->name,
@@ -1088,7 +1086,6 @@ function (Assertion $assertion) use ($found_generic_params) : Assertion {
&& !$context->collect_mutations
&& isset($stmt->inferredType)
) {
/** @psalm-suppress PossiblyInvalidArgument never a string, PHP Parser bug */
$codebase->analyzer->addNodeType(
$statements_analyzer->getFilePath(),
$stmt->name,
@@ -721,7 +721,6 @@ public static function analyze(
}
if ($file_manipulations) {
/** @psalm-suppress MixedTypeCoercion */
FileManipulationBuffer::add($statements_analyzer->getFilePath(), $file_manipulations);
}
}
@@ -818,13 +818,11 @@ function ($line) {
}
if ($file_manipulations) {
/** @psalm-suppress MixedTypeCoercion */
FileManipulationBuffer::add($this->getFilePath(), $file_manipulations);
}
}
if ($new_issues) {
/** @psalm-suppress MixedTypeCoercion */
$this->removeSuppressedIssues($new_issues);
}
@@ -211,8 +211,6 @@ public function canReportIssues($file_path)
* @param array<string, class-string<FileAnalyzer>> $filetype_analyzers
*
* @return FileAnalyzer
*
* @psalm-suppress MixedOperand
*/
private function getFileAnalyzer(ProjectAnalyzer $project_analyzer, $file_path, array $filetype_analyzers)
{
@@ -276,6 +274,10 @@ function (string $file_path) : bool {
$project_analyzer->checkClassReferences();
}
if ($codebase->track_unused_suppressions) {
IssueBuffer::processUnusedSuppressions($codebase->file_provider);
}
$scanned_files = $codebase->scanner->getScannedFiles();
$codebase->file_reference_provider->setAnalyzedMethods($this->analyzed_methods);
$codebase->file_reference_provider->setFileMaps($this->getFileMaps());
@@ -991,7 +993,6 @@ public function hasMixedMemberName(string $member_id) : bool
* @param array<string, array<string, bool>> $names
*
* @return void
* @psalm-suppress MixedPropertyTypeCoercion
*/
public function addMixedMemberNames(array $names)
{
@@ -279,7 +279,6 @@ public static function getCallablesFromCallMap($function_id)
*
* @return array<string, array<int|string, string>>
* @psalm-suppress MixedInferredReturnType as the use of require buggers things up
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedTypeCoercion
* @psalm-suppress MixedReturnStatement
*/
@@ -17,8 +17,6 @@ class PropertyMap
* Gets the method/function call map
*
* @return array<string, array<string, string>>
* @psalm-suppress MixedInferredReturnType as the use of require buggers things up
* @psalm-suppress MixedAssignment
*/
public static function getPropertyMap()
{
@@ -573,8 +573,6 @@ private function convertClassesToFilePaths(ClassLikes $classlikes)
* @param bool $will_analyze
*
* @return FileScanner
*
* @psalm-suppress MixedOffset
*/
private function scanFile(
$file_path,
@@ -748,7 +746,6 @@ private function fileExistsForClassLike(ClassLikes $classlikes, $fq_class_name)
error_reporting($old_level);
/** @psalm-suppress MixedMethodCall due to Reflection class weirdness */
$file_path = (string)$reflected_class->getFileName();
// if the file was autoloaded but exists in evaled code only, return false
@@ -24,7 +24,6 @@ class DiffElem
* @param int $type
* @param mixed $old
* @param mixed $new
* @psalm-suppress PossiblyUnusedMethod
*/
public function __construct($type, $old, $new)
{
@@ -33,7 +33,6 @@ public static function diff(array $a, array $b, $a_code, $b_code)
/**
* @param string $a_code
* @param string $b_code
* @psalm-suppress UnusedParam
*
* @return bool
*/
@@ -90,7 +90,6 @@ class Pool
* A closure to execute when a task is done
*
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedArgument
*/
public function __construct(
array $process_task_data_iterator,
@@ -275,7 +274,6 @@ private static function streamForChild(array $sockets)
* @return array
*
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedOperand
*/
private function readResultsFromChildren()
{
@@ -399,8 +397,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.
*
* @return bool
*
* @psalm-suppress PossiblyUnusedMethod because we may in the future
*/
public function didHaveError()
{
@@ -28,8 +28,6 @@ public function __construct(PluginListFactory $plugin_list_factory)
}
/**
* @psalm-suppress UnusedMethod
*
* @return void
*/
protected function configure()
@@ -47,8 +45,6 @@ protected function configure()
}
/**
* @psalm-suppress UnusedMethod
*
* @return null|int
*/
protected function execute(InputInterface $i, OutputInterface $o)
@@ -66,7 +62,6 @@ protected function execute(InputInterface $i, OutputInterface $o)
$plugin_list = ($this->plugin_list_factory)($current_dir, $config_file_path);
try {
/** @psalm-suppress MixedAssignment */
$plugin_name = $i->getArgument('pluginName');
assert(is_string($plugin_name));
@@ -28,8 +28,6 @@ public function __construct(PluginListFactory $plugin_list_factory)
}
/**
* @psalm-suppress UnusedMethod
*
* @return void
*/
protected function configure()
@@ -47,8 +45,6 @@ protected function configure()
}
/**
* @psalm-suppress UnusedMethod
*
* @return null|int
*/
protected function execute(InputInterface $i, OutputInterface $o)
@@ -66,7 +62,6 @@ protected function execute(InputInterface $i, OutputInterface $o)
$plugin_list = ($this->plugin_list_factory)($current_dir, $config_file_path);
try {
/** @psalm-suppress MixedAssignment */
$plugin_name = $i->getArgument('pluginName');
assert(is_string($plugin_name));

0 comments on commit c5f62d2

Please sign in to comment.
You can’t perform that action at this time.