From ac562563a70453fd9688b8acba4ac00f51a1ae64 Mon Sep 17 00:00:00 2001 From: Brown Date: Wed, 17 Apr 2019 15:12:52 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20remove=20trait=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Psalm/Internal/Codebase/ClassLikes.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 90fd42e63..0b78ed918 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -776,6 +776,8 @@ class ClassLikes $method_id = $appearing_method_id; + $declaring_classlike_storage = $classlike_storage; + if (isset($classlike_storage->methods[$method_name])) { $method_storage = $classlike_storage->methods[$method_name]; } else { @@ -846,7 +848,7 @@ class ClassLikes if ($codebase->alter_code) { if ($method_storage->stmt_location - && !$classlike_storage->is_trait + && !$declaring_classlike_storage->is_trait && isset($project_analyzer->getIssuesToFix()['PossiblyUnusedMethod']) && !$codebase->analyzer->hasMixedMemberName(strtolower($method_name)) && !IssueBuffer::isSuppressed($issue, $method_storage->suppressed_issues) @@ -873,7 +875,7 @@ class ClassLikes if ($codebase->alter_code) { if ($method_storage->stmt_location - && !$classlike_storage->is_trait + && !$declaring_classlike_storage->is_trait && isset($project_analyzer->getIssuesToFix()['UnusedMethod']) && !$codebase->analyzer->hasMixedMemberName(strtolower($method_name)) && !IssueBuffer::isSuppressed($issue, $method_storage->suppressed_issues) @@ -944,7 +946,6 @@ class ClassLikes if ($codebase->alter_code) { if ($property_storage->stmt_location - && !$classlike_storage->is_trait && isset($project_analyzer->getIssuesToFix()['PossiblyUnusedProperty']) && !$codebase->analyzer->hasMixedMemberName('$' . $property_name) && !IssueBuffer::isSuppressed($issue, $classlike_storage->suppressed_issues) @@ -969,7 +970,6 @@ class ClassLikes if ($codebase->alter_code) { if ($property_storage->stmt_location - && !$classlike_storage->is_trait && isset($project_analyzer->getIssuesToFix()['UnusedProperty']) && !$codebase->analyzer->hasMixedMemberName('$' . $property_name) && !IssueBuffer::isSuppressed($issue, $classlike_storage->suppressed_issues)