1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Remove more dead code found by Psalm

This commit is contained in:
Matthew Brown 2018-01-28 12:43:19 -05:00
parent 59cdc5494f
commit dd32452d90
7 changed files with 6 additions and 13 deletions

View File

@ -830,8 +830,6 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo
}
}
list($implemented_fq_class_name) = explode('::', $implementer_method_id);
foreach ($guide_method_storage->params as $i => $guide_param) {
if (!isset($implementer_method_storage->params[$i])) {
if (IssueBuffer::accepts(

View File

@ -79,7 +79,6 @@ class MethodChecker extends FunctionLikeChecker
return null;
}
list($declaring_fq_class_name, $declaring_method_name) = explode('::', $declaring_method_id);
list($appearing_fq_class_name, $appearing_method_name) = explode('::', $appearing_method_id);
if (!ClassLikeChecker::isUserDefined($project_checker, $appearing_fq_class_name)

View File

@ -1287,7 +1287,7 @@ class CallChecker
$context->vars_in_scope[$var] = $type;
}
foreach ($local_vars_possibly_in_scope as $var => $type) {
foreach ($local_vars_possibly_in_scope as $var => $_) {
$context->vars_possibly_in_scope[$var] = true;
}
}
@ -1363,13 +1363,13 @@ class CallChecker
$local_vars_in_scope = [];
$local_vars_possibly_in_scope = [];
foreach ($context->vars_in_scope as $var => $type) {
foreach ($context->vars_in_scope as $var => $_) {
if (strpos($var, '$this->') !== 0 && $var !== '$this') {
$local_vars_in_scope[$var] = $context->vars_in_scope[$var];
}
}
foreach ($context->vars_possibly_in_scope as $var => $type) {
foreach ($context->vars_possibly_in_scope as $var => $_) {
if (strpos($var, '$this->') !== 0 && $var !== '$this') {
$local_vars_possibly_in_scope[$var] = $context->vars_possibly_in_scope[$var];
}

View File

@ -263,7 +263,7 @@ class ExpressionChecker
}
}
foreach ($context->vars_possibly_in_scope as $var => $type) {
foreach ($context->vars_possibly_in_scope as $var => $_) {
if (strpos($var, '$this->') === 0) {
$use_context->vars_possibly_in_scope[$var] = true;
}

View File

@ -259,13 +259,12 @@ class Config
throw new \InvalidArgumentException('Cannot open ' . $file_path);
}
return self::loadFromXML($file_path, $base_dir, $file_contents);
return self::loadFromXML($base_dir, $file_contents);
}
/**
* Creates a new config object from an XML string
*
* @param string $file_path
* @param string $base_dir
* @param string $file_contents
*
@ -277,7 +276,7 @@ class Config
* @psalm-suppress MixedOperand
* @psalm-suppress MixedPropertyAssignment
*/
public static function loadFromXML($file_path, $base_dir, $file_contents)
public static function loadFromXML($base_dir, $file_contents)
{
$config = new static();

View File

@ -29,8 +29,6 @@ class EffectsAnalyser
) {
$return_types = [];
$last_stmt = null;
foreach ($stmts as $stmt) {
if (!$stmt instanceof PhpParser\Node\Stmt\Nop) {
$last_stmt = $stmt;

View File

@ -1149,7 +1149,6 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
$comment = $stmt->getDocComment();
$var_comment = null;
$property_type_line_number = null;
$property_is_initialized = false;