Skip to content
Permalink
Browse files

Remove redundant casts and unused use statements (#1955)

* Remove redundant casts

(not sure about older versions of php-parser)

* Remove unused use statements
  • Loading branch information...
TysonAndre authored and muglug committed Jul 19, 2019
1 parent e0a59ce commit 5d5a9c6eacb0654b5cbf3316dd9c424fba40e2d3
@@ -3,7 +3,6 @@
use PhpParser;
use Psalm\Aliases;
use Psalm\Codebase;
use Psalm\DocComment;
use Psalm\Exception\DocblockParseException;
use Psalm\Exception\IncorrectDocblockException;
@@ -3,7 +3,6 @@
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\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\StatementsSource;
use Psalm\Type;
use function implode;
use function array_merge;
use function strtolower;
use function trim;
use function strpos;
@@ -3,7 +3,6 @@
use Psalm\Aliases;
use Psalm\Codebase;
use Psalm\Context;
use Psalm\StatementsSource;
use Psalm\Type;
@@ -4,7 +4,6 @@
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\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 @@
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 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 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 @@ function (FileManipulation $a, FileManipulation $b) {
])
);
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\Success;
use function count;
use function error_log;
use LanguageServerProtocol\CompletionItem;
use LanguageServerProtocol\CompletionList;
use LanguageServerProtocol\Hover;
use LanguageServerProtocol\Location;
@@ -1003,8 +1003,8 @@ private function registerClassLike(PhpParser\Node\Stmt\ClassLike $node)
$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 @@ private function registerFunctionLike(PhpParser\Node\FunctionLike $stmt, $fake_m
$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 @@ private function registerFunctionLike(PhpParser\Node\FunctionLike $stmt, $fake_m
$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 @@ private function visitPropertyDeclaration(
$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;

0 comments on commit 5d5a9c6

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