mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
Fix redundant casts/conditions in psalm (#1874)
This includes a check for array_map that was accidentally an assignment
This commit is contained in:
parent
fc549a431f
commit
791b30a6d8
@ -160,7 +160,7 @@ class Reflection
|
||||
}
|
||||
|
||||
$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 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
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 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
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 @@ $vendor_dir = getVendorDir($current_dir);
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user