Skip to content

Commit

Permalink
@psalm-public-api annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-worman committed Dec 22, 2022
1 parent 3536a0c commit df08336
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/Psalm/Internal/Codebase/ClassLikes.php
Expand Up @@ -851,8 +851,7 @@ public function consolidateAnalyzedData(Methods $methods, ?Progress $progress, b
&& !$classlike_storage->is_trait
) {
if ($find_unused_code) {
if (
$classlike_storage->public_api
if ($classlike_storage->public_api
|| $this->file_reference_provider->isClassReferenced($fq_class_name_lc)
) {
$this->checkMethodReferences($classlike_storage, $methods);
Expand Down Expand Up @@ -1694,8 +1693,7 @@ private function checkMethodReferences(ClassLikeStorage $classlike_storage, Meth
}

// TODO: UnusedParam should always be checked.
if (
$classlike_storage->public_api
if ($classlike_storage->public_api
&& ($method_storage->visibility === ClassLikeAnalyzer::VISIBILITY_PUBLIC
|| ($method_storage->visibility === ClassLikeAnalyzer::VISIBILITY_PROTECTED
&& !$classlike_storage->final
Expand Down Expand Up @@ -1730,7 +1728,7 @@ private function checkMethodReferences(ClassLikeStorage $classlike_storage, Meth
&& $method_name !== '__unserialize'
&& $method_name !== '__set_state'
&& $method_name !== '__debuginfo'
&& $method_name !== '__tostring' // can be called in array_unique)
&& $method_name !== '__tostring' // can be called in array_unique
) {
$method_location = $method_storage->location;

Expand Down Expand Up @@ -2079,8 +2077,7 @@ private function checkPropertyReferences(ClassLikeStorage $classlike_storage): v
$codebase = $project_analyzer->getCodebase();

foreach ($classlike_storage->properties as $property_name => $property_storage) {
if (
$classlike_storage->public_api
if ($classlike_storage->public_api
&& ($property_storage->visibility === ClassLikeAnalyzer::VISIBILITY_PUBLIC
|| ($property_storage->visibility === ClassLikeAnalyzer::VISIBILITY_PROTECTED
&& !$classlike_storage->final
Expand Down

0 comments on commit df08336

Please sign in to comment.