mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Remove redundant casts and unused use statements (#1955)
* Remove redundant casts (not sure about older versions of php-parser) * Remove unused use statements
This commit is contained in:
parent
e0a59ce117
commit
5d5a9c6eac
@ -3,7 +3,6 @@ namespace Psalm\Internal\Analyzer;
|
||||
|
||||
use PhpParser;
|
||||
use Psalm\Aliases;
|
||||
use Psalm\Codebase;
|
||||
use Psalm\DocComment;
|
||||
use Psalm\Exception\DocblockParseException;
|
||||
use Psalm\Exception\IncorrectDocblockException;
|
||||
|
@ -3,7 +3,6 @@ namespace Psalm\Internal\Analyzer;
|
||||
|
||||
use PhpParser;
|
||||
use Psalm\Codebase;
|
||||
use Psalm\CodeLocation;
|
||||
use Psalm\Context;
|
||||
use Psalm\Exception\UnpreparedAnalysisException;
|
||||
use Psalm\Internal\FileManipulation\FileManipulationBuffer;
|
||||
|
@ -9,7 +9,6 @@ use Psalm\Codebase;
|
||||
use Psalm\Internal\Analyzer\FunctionLike\ReturnTypeAnalyzer;
|
||||
use Psalm\Internal\Analyzer\FunctionLike\ReturnTypeCollector;
|
||||
use Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer;
|
||||
use Psalm\Internal\Codebase\CallMap;
|
||||
use Psalm\CodeLocation;
|
||||
use Psalm\Context;
|
||||
use Psalm\Internal\FileManipulation\FunctionDocblockManipulator;
|
||||
|
@ -7,7 +7,6 @@ use Psalm\Context;
|
||||
use Psalm\StatementsSource;
|
||||
use Psalm\Type;
|
||||
use function implode;
|
||||
use function array_merge;
|
||||
use function strtolower;
|
||||
use function trim;
|
||||
use function strpos;
|
||||
|
@ -3,7 +3,6 @@ namespace Psalm\Internal\Analyzer;
|
||||
|
||||
use Psalm\Aliases;
|
||||
use Psalm\Codebase;
|
||||
use Psalm\Context;
|
||||
use Psalm\StatementsSource;
|
||||
use Psalm\Type;
|
||||
|
||||
|
@ -4,7 +4,6 @@ namespace Psalm\Internal\Analyzer\Statements\Block;
|
||||
use PhpParser;
|
||||
use Psalm\Codebase;
|
||||
use Psalm\Internal\Analyzer\AlgebraAnalyzer;
|
||||
use Psalm\Internal\Analyzer\FunctionLikeAnalyzer;
|
||||
use Psalm\Internal\Analyzer\ScopeAnalyzer;
|
||||
use Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer;
|
||||
use Psalm\Internal\Analyzer\StatementsAnalyzer;
|
||||
|
@ -2,7 +2,6 @@
|
||||
namespace Psalm\Internal\Analyzer\Statements\Expression;
|
||||
|
||||
use PhpParser;
|
||||
use Psalm\Internal\Analyzer\FunctionLikeAnalyzer;
|
||||
use Psalm\Internal\Analyzer\Statements\Expression\Assignment\ArrayAssignmentAnalyzer;
|
||||
use Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer;
|
||||
use Psalm\Internal\Analyzer\StatementsAnalyzer;
|
||||
@ -28,14 +27,12 @@ use Psalm\Type\Atomic\TFalse;
|
||||
use Psalm\Type\Atomic\TFloat;
|
||||
use Psalm\Type\Atomic\TTemplateParam;
|
||||
use Psalm\Type\Atomic\TInt;
|
||||
use Psalm\Type\Atomic\TLiteralString;
|
||||
use Psalm\Type\Atomic\TMixed;
|
||||
use Psalm\Type\Atomic\TNamedObject;
|
||||
use Psalm\Type\Atomic\TNull;
|
||||
use Psalm\Type\Atomic\TNumeric;
|
||||
use Psalm\Type\Reconciler;
|
||||
use Psalm\Internal\Type\TypeCombination;
|
||||
use Psalm\Type\Union;
|
||||
use function array_merge;
|
||||
use function array_diff_key;
|
||||
use function array_filter;
|
||||
|
@ -3,7 +3,6 @@ namespace Psalm\Internal\Analyzer\Statements\Expression\Call;
|
||||
|
||||
use PhpParser;
|
||||
use Psalm\Internal\Analyzer\FunctionAnalyzer;
|
||||
use Psalm\Internal\Analyzer\FunctionLikeAnalyzer;
|
||||
use Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer;
|
||||
use Psalm\Internal\Analyzer\Statements\Expression\AssertionFinder;
|
||||
use Psalm\Internal\Analyzer\StatementsAnalyzer;
|
||||
|
@ -47,11 +47,6 @@ use function explode;
|
||||
use function array_search;
|
||||
use function array_keys;
|
||||
use function in_array;
|
||||
use function substr;
|
||||
use function token_get_all;
|
||||
use function array_reverse;
|
||||
use function strlen;
|
||||
use function reset;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
@ -2,7 +2,6 @@
|
||||
namespace Psalm\Internal\Analyzer\Statements\Expression\Call;
|
||||
|
||||
use PhpParser;
|
||||
use Psalm\Codebase;
|
||||
use Psalm\Internal\Analyzer\ClassLikeAnalyzer;
|
||||
use Psalm\Internal\Analyzer\MethodAnalyzer;
|
||||
use Psalm\Internal\Analyzer\NamespaceAnalyzer;
|
||||
@ -32,10 +31,6 @@ use function strpos;
|
||||
use function is_string;
|
||||
use function strlen;
|
||||
use function substr;
|
||||
use function token_get_all;
|
||||
use function array_reverse;
|
||||
use function array_shift;
|
||||
use function reset;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
@ -1250,7 +1250,7 @@ class Analyzer
|
||||
])
|
||||
);
|
||||
|
||||
echo (string) $differ->diff($this->file_provider->getContents($file_path), $existing_contents);
|
||||
echo $differ->diff($this->file_provider->getContents($file_path), $existing_contents);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ use Amp\Promise;
|
||||
use Amp\Success;
|
||||
use function count;
|
||||
use function error_log;
|
||||
use LanguageServerProtocol\CompletionItem;
|
||||
use LanguageServerProtocol\CompletionList;
|
||||
use LanguageServerProtocol\Hover;
|
||||
use LanguageServerProtocol\Location;
|
||||
|
@ -1003,8 +1003,8 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
$this->classlike_storages[] = $storage;
|
||||
|
||||
if ($node instanceof PhpParser\Node\Stmt\Class_) {
|
||||
$storage->abstract = (bool)$node->isAbstract();
|
||||
$storage->final = (bool)$node->isFinal();
|
||||
$storage->abstract = $node->isAbstract();
|
||||
$storage->final = $node->isFinal();
|
||||
|
||||
$this->codebase->classlikes->addFullyQualifiedClassName($fq_classlike_name, $this->file_path);
|
||||
|
||||
@ -1473,7 +1473,7 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
|
||||
$storage = new MethodStorage();
|
||||
$storage->defining_fqcln = '';
|
||||
$storage->is_static = (bool) $stmt->isStatic();
|
||||
$storage->is_static = $stmt->isStatic();
|
||||
} elseif ($stmt instanceof PhpParser\Node\Stmt\Function_) {
|
||||
$cased_function_id =
|
||||
($this->aliases->namespace ? $this->aliases->namespace . '\\' : '') . $stmt->name->name;
|
||||
@ -1624,8 +1624,8 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
$class_storage->overridden_method_ids[strtolower($stmt->name->name)] = [];
|
||||
}
|
||||
|
||||
$storage->is_static = (bool) $stmt->isStatic();
|
||||
$storage->abstract = (bool) $stmt->isAbstract();
|
||||
$storage->is_static = $stmt->isStatic();
|
||||
$storage->abstract = $stmt->isAbstract();
|
||||
|
||||
$storage->final = $class_storage->final || $stmt->isFinal();
|
||||
|
||||
@ -2893,7 +2893,7 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
$doc_var_location = null;
|
||||
|
||||
$property_storage = $storage->properties[$property->name->name] = new PropertyStorage();
|
||||
$property_storage->is_static = (bool)$stmt->isStatic();
|
||||
$property_storage->is_static = $stmt->isStatic();
|
||||
$property_storage->type = $signature_type;
|
||||
$property_storage->signature_type = $signature_type;
|
||||
$property_storage->signature_type_location = $signature_type_location;
|
||||
|
Loading…
x
Reference in New Issue
Block a user