mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Remove more dead code
This commit is contained in:
parent
b3505cfbef
commit
765d82548d
@ -17,7 +17,6 @@ class CommentChecker
|
||||
|
||||
/**
|
||||
* @param string $comment
|
||||
* @param Context|null $context
|
||||
* @param StatementsSource $source
|
||||
* @param Aliases $aliases
|
||||
* @param array<string, string>|null $template_types
|
||||
@ -31,7 +30,6 @@ class CommentChecker
|
||||
*/
|
||||
public static function getTypeFromComment(
|
||||
$comment,
|
||||
$context,
|
||||
StatementsSource $source,
|
||||
Aliases $aliases,
|
||||
array $template_types = null,
|
||||
|
@ -101,13 +101,11 @@ class FileChecker extends SourceChecker implements StatementsSource
|
||||
* @param string $file_path
|
||||
* @param ProjectChecker $project_checker
|
||||
* @param bool $will_analyze
|
||||
* @param array<string, bool> $included_file_paths
|
||||
*/
|
||||
public function __construct(
|
||||
$file_path,
|
||||
ProjectChecker $project_checker,
|
||||
$will_analyze = true,
|
||||
array $included_file_paths = []
|
||||
$will_analyze = true
|
||||
) {
|
||||
$this->file_path = $file_path;
|
||||
$this->file_name = Config::getInstance()->shortenFileName($this->file_path);
|
||||
|
@ -336,7 +336,7 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo
|
||||
} else { // Closure
|
||||
$file_storage = $file_storage_provider->get($this->source->getFilePath());
|
||||
|
||||
$function_id = $cased_function_id = $this->getMethodId();
|
||||
$function_id = $this->getMethodId();
|
||||
|
||||
if (!isset($file_storage->functions[$function_id])) {
|
||||
throw new \UnexpectedValueException('Closure function ' . $function_id . ' should exist');
|
||||
|
@ -721,14 +721,12 @@ class ProjectChecker
|
||||
|
||||
/**
|
||||
* @param string $fq_class_name
|
||||
* @param string $parent_class
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function inheritMethodsFromParent(ClassLikeStorage $storage, ClassLikeStorage $parent_storage)
|
||||
{
|
||||
$fq_class_name = $storage->name;
|
||||
$parent_class = $parent_storage->name;
|
||||
|
||||
// register where they appear (can never be in a trait)
|
||||
foreach ($parent_storage->appearing_method_ids as $method_name => $appearing_method_id) {
|
||||
|
@ -229,7 +229,6 @@ class ForeachChecker
|
||||
if ($doc_comment_text) {
|
||||
$var_comment = CommentChecker::getTypeFromComment(
|
||||
$doc_comment_text,
|
||||
$foreach_context,
|
||||
$statements_checker->getSource(),
|
||||
$statements_checker->getSource()->getAliases()
|
||||
);
|
||||
|
@ -47,7 +47,6 @@ class AssignmentChecker
|
||||
* @param Type\Union|null $assign_value_type
|
||||
* @param Context $context
|
||||
* @param string $doc_comment
|
||||
* @param bool $by_reference
|
||||
* @param int|null $came_from_line_number
|
||||
*
|
||||
* @return false|Type\Union
|
||||
@ -59,7 +58,6 @@ class AssignmentChecker
|
||||
$assign_value_type,
|
||||
Context $context,
|
||||
$doc_comment,
|
||||
$by_reference = false,
|
||||
$came_from_line_number = null
|
||||
) {
|
||||
$var_id = ExpressionChecker::getVarId(
|
||||
@ -81,7 +79,6 @@ class AssignmentChecker
|
||||
if ($doc_comment) {
|
||||
$var_comment = CommentChecker::getTypeFromComment(
|
||||
$doc_comment,
|
||||
$context,
|
||||
$statements_checker->getSource(),
|
||||
$statements_checker->getAliases(),
|
||||
null,
|
||||
@ -440,8 +437,7 @@ class AssignmentChecker
|
||||
$stmt->expr,
|
||||
null,
|
||||
$context,
|
||||
(string)$stmt->getDocComment(),
|
||||
true
|
||||
(string)$stmt->getDocComment()
|
||||
) === false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -240,7 +240,6 @@ class CallChecker
|
||||
if (!$in_call_map && !$is_stubbed) {
|
||||
if ($context->check_functions) {
|
||||
if (self::checkFunctionExists(
|
||||
$project_checker,
|
||||
$statements_checker,
|
||||
$method_id,
|
||||
$code_location
|
||||
@ -2441,7 +2440,6 @@ class CallChecker
|
||||
}
|
||||
} else {
|
||||
if (self::checkFunctionExists(
|
||||
$project_checker,
|
||||
$statements_checker,
|
||||
$function_id,
|
||||
$code_location
|
||||
@ -2522,7 +2520,6 @@ class CallChecker
|
||||
* @return bool
|
||||
*/
|
||||
protected static function checkFunctionExists(
|
||||
ProjectChecker $project_checker,
|
||||
StatementsChecker $statements_checker,
|
||||
&$function_id,
|
||||
CodeLocation $code_location
|
||||
|
@ -84,7 +84,6 @@ class ExpressionChecker
|
||||
null,
|
||||
$context,
|
||||
(string)$stmt->getDocComment(),
|
||||
false,
|
||||
$stmt->getLine()
|
||||
);
|
||||
|
||||
@ -1891,7 +1890,6 @@ class ExpressionChecker
|
||||
if ($doc_comment_text) {
|
||||
$var_comment = CommentChecker::getTypeFromComment(
|
||||
$doc_comment_text,
|
||||
$context,
|
||||
$statements_checker,
|
||||
$statements_checker->getAliases()
|
||||
);
|
||||
|
@ -330,7 +330,6 @@ class StatementsChecker extends SourceChecker implements StatementsSource
|
||||
if ((string)$stmt->getDocComment()) {
|
||||
$var_comment = CommentChecker::getTypeFromComment(
|
||||
(string)$stmt->getDocComment(),
|
||||
$context,
|
||||
$this->getSource(),
|
||||
$this->getSource()->getAliases()
|
||||
);
|
||||
@ -893,7 +892,6 @@ class StatementsChecker extends SourceChecker implements StatementsSource
|
||||
if ($doc_comment_text) {
|
||||
$var_comment = CommentChecker::getTypeFromComment(
|
||||
$doc_comment_text,
|
||||
$context,
|
||||
$this->source,
|
||||
$this->source->getAliases()
|
||||
);
|
||||
|
@ -377,7 +377,6 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
|
||||
if ($doc_comment = $node->getDocComment()) {
|
||||
$var_comment = CommentChecker::getTypeFromComment(
|
||||
(string)$doc_comment,
|
||||
null,
|
||||
$this->file_checker,
|
||||
$this->aliases,
|
||||
null,
|
||||
@ -1073,7 +1072,6 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
|
||||
$property_type_line_number = $comment->getLine();
|
||||
$var_comment = CommentChecker::getTypeFromComment(
|
||||
$comment->getText(),
|
||||
null,
|
||||
$this->file_checker,
|
||||
$this->aliases,
|
||||
$this->function_template_types + $this->class_template_types,
|
||||
|
@ -89,7 +89,7 @@ class MethodMutationTest extends TestCase
|
||||
}'
|
||||
);
|
||||
|
||||
$file_checker = new FileChecker('somefile.php', $this->project_checker);
|
||||
new FileChecker('somefile.php', $this->project_checker);
|
||||
$this->project_checker->scanFiles();
|
||||
$method_context = new Context();
|
||||
$this->project_checker->getMethodMutations('FooController::barBar', $method_context);
|
||||
@ -125,7 +125,7 @@ class MethodMutationTest extends TestCase
|
||||
}'
|
||||
);
|
||||
|
||||
$file_checker = new FileChecker('somefile.php', $this->project_checker);
|
||||
new FileChecker('somefile.php', $this->project_checker);
|
||||
$this->project_checker->scanFiles();
|
||||
$method_context = new Context();
|
||||
$this->project_checker->getMethodMutations('FooController::__construct', $method_context);
|
||||
@ -161,7 +161,7 @@ class MethodMutationTest extends TestCase
|
||||
}'
|
||||
);
|
||||
|
||||
$file_checker = new FileChecker('somefile.php', $this->project_checker);
|
||||
new FileChecker('somefile.php', $this->project_checker);
|
||||
$this->project_checker->scanFiles();
|
||||
$method_context = new Context();
|
||||
$this->project_checker->getMethodMutations('FooController::__construct', $method_context);
|
||||
|
@ -38,7 +38,7 @@ class ReportOutputTest extends TestCase
|
||||
{
|
||||
// No exception
|
||||
foreach (['.xml', '.txt', '.json', '.emacs'] as $extension) {
|
||||
$checker = new \Psalm\Checker\ProjectChecker(
|
||||
new \Psalm\Checker\ProjectChecker(
|
||||
$this->file_provider,
|
||||
new Provider\FakeParserCacheProvider(),
|
||||
false,
|
||||
@ -61,7 +61,7 @@ class ReportOutputTest extends TestCase
|
||||
*/
|
||||
public function testReportFormatException()
|
||||
{
|
||||
$checker = new \Psalm\Checker\ProjectChecker(
|
||||
new \Psalm\Checker\ProjectChecker(
|
||||
$this->file_provider,
|
||||
new Provider\FakeParserCacheProvider(),
|
||||
false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user