Skip to content
Permalink
Browse files

Fix #2521 - use correct context class when analysing trait

  • Loading branch information
muglug committed Dec 28, 2019
1 parent 4110ec3 commit ce9435da194b1eea80d5c698328fe00f77654d61
@@ -1025,7 +1025,7 @@ protected static function analyzeElseIfBlock(
$elseif_clauses = Algebra::getFormula(
\spl_object_id($elseif->cond),
$elseif->cond,
$statements_analyzer->getFQCLN(),
$else_context->self,
$statements_analyzer,
$codebase
);
@@ -102,7 +102,7 @@ public static function analyze(
$left_clauses = Algebra::getFormula(
\spl_object_id($stmt->left),
$stmt->left,
$statements_analyzer->getFQCLN(),
$context->self,
$statements_analyzer,
$codebase
);
@@ -330,7 +330,7 @@ function ($c) {
$left_clauses = Algebra::getFormula(
\spl_object_id($stmt->left),
$stmt->left,
$statements_analyzer->getFQCLN(),
$context->self,
$statements_analyzer,
$codebase
);
@@ -562,7 +562,7 @@ function ($c) {
$if_clauses = Algebra::getFormula(
\spl_object_id($stmt),
$stmt,
$statements_analyzer->getFQCLN(),
$context->self,
$statements_analyzer,
$codebase
);
@@ -601,7 +601,7 @@ public static function analyze(
$assert_clauses = \Psalm\Type\Algebra::getFormula(
\spl_object_id($stmt->args[0]->value),
$stmt->args[0]->value,
$statements_analyzer->getFQCLN(),
$context->self,
$statements_analyzer,
$codebase
);
@@ -3464,15 +3464,15 @@ protected static function applyAssertionsToContext(
$assert_clauses = \Psalm\Type\Algebra::getFormula(
\spl_object_id($conditional),
$conditional,
$statements_analyzer->getFQCLN(),
$context->self,
$statements_analyzer,
$statements_analyzer->getCodebase()
);
} else {
$assert_clauses = \Psalm\Type\Algebra::getFormula(
\spl_object_id($arg_value),
$arg_value,
$statements_analyzer->getFQCLN(),
$context->self,
$statements_analyzer,
$statements_analyzer->getCodebase()
);
@@ -65,7 +65,7 @@ public static function analyze(
$if_clauses = \Psalm\Type\Algebra::getFormula(
\spl_object_id($stmt->cond),
$stmt->cond,
$statements_analyzer->getFQCLN(),
$context->self,
$statements_analyzer,
$codebase
);
@@ -920,6 +920,22 @@ protected function orginalSayHello() : string {
}
}',
],
'instanceofStaticInsideTrait' => [
'<?php
trait T {
/**
* @param mixed $instance
* @return ?static
*/
public static function filterInstance($instance) {
return $instance instanceof static ? $instance : null;
}
}
class A {
use T;
}'
],
];
}

0 comments on commit ce9435d

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