1
0
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:
Tyson Andre 2019-07-18 23:37:36 -04:00 committed by Matthew Brown
parent e0a59ce117
commit 5d5a9c6eac
13 changed files with 7 additions and 28 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -3,7 +3,6 @@ namespace Psalm\Internal\Analyzer;
use Psalm\Aliases;
use Psalm\Codebase;
use Psalm\Context;
use Psalm\StatementsSource;
use Psalm\Type;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;

View File

@ -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;