Skip to content
Permalink
Browse files

Fix redundant casts/conditions in psalm (#1874)

This includes a check for array_map that was accidentally an assignment
  • Loading branch information...
TysonAndre authored and muglug committed Jun 29, 2019
1 parent fc549a4 commit 791b30a6d8c87513236262c4d48abbdf6fe6528e
@@ -160,7 +160,7 @@ public function registerClass(\ReflectionClass $reflected_class)
}
$reflection_methods = $reflected_class->getMethods(
(int) (\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED)
(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED)
);
if ($class_name_lower === 'generator') {
@@ -779,7 +779,7 @@ private function registerClassMapFunctionCall(
if (($function_id === 'array_map' && isset($node->args[0]))
|| ($function_id === 'array_filter' && isset($node->args[1]))
) {
$node_arg_value = $function_id = 'array_map' ? $node->args[0]->value : $node->args[1]->value;
$node_arg_value = $function_id === 'array_map' ? $node->args[0]->value : $node->args[1]->value;
if ($node_arg_value instanceof PhpParser\Node\Scalar\String_
|| $node_arg_value instanceof PhpParser\Node\Expr\Array_
@@ -1647,7 +1647,7 @@ private function registerFunctionLike(PhpParser\Node\FunctionLike $stmt, $fake_m
if ($param->var instanceof PhpParser\Node\Expr\Error) {
if (IssueBuffer::accepts(
new InvalidDocblock(
'Param' . ((int) $i + 1) . ' of ' . $cased_function_id . ' has invalid syntax',
'Param' . ($i + 1) . ' of ' . $cased_function_id . ' has invalid syntax',
new CodeLocation($this->file_scanner, $param, null, true)
)
)) {
@@ -100,8 +100,8 @@ function requireAutoloaders($current_dir, $has_explicit_root, $vendor_dir)
exit(1);
}
define('PSALM_VERSION', (string) \PackageVersions\Versions::getVersion('vimeo/psalm'));
define('PHP_PARSER_VERSION', (string) \PackageVersions\Versions::getVersion('nikic/php-parser'));
define('PSALM_VERSION', \PackageVersions\Versions::getVersion('vimeo/psalm'));
define('PHP_PARSER_VERSION', \PackageVersions\Versions::getVersion('nikic/php-parser'));
return $first_autoloader;
}
@@ -13,7 +13,7 @@
requireAutoloaders($current_dir, false, $vendor_dir);
$app = new Application('psalm-plugin', (string) Versions::getVersion('vimeo/psalm'));
$app = new Application('psalm-plugin', Versions::getVersion('vimeo/psalm'));
$psalm_root = dirname(__DIR__) . DIRECTORY_SEPARATOR;

0 comments on commit 791b30a

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