Skip to content
Permalink
Browse files

Fix #1556 - allow internal method calls when checking property initia…

…lisation s
  • Loading branch information...
muglug committed Apr 14, 2019
1 parent 8454c0d commit ffec25da20c2784677d2545f44332b7660ef8de3
Showing with 18 additions and 4 deletions.
  1. +4 −4 src/Psalm/Internal/Analyzer/ProjectAnalyzer.php
  2. +14 −0 tests/PropertyTypeTest.php
@@ -808,10 +808,6 @@ public function getMethodMutations(
) {
list($fq_class_name) = explode('::', $original_method_id);
$file_analyzer = $this->getFileAnalyzerForClassLike($fq_class_name);
$file_analyzer->setRootFilePath($root_file_path, $root_file_name);
$appearing_method_id = $this->codebase->methods->getAppearingMethodId($original_method_id);
if (!$appearing_method_id) {
@@ -827,6 +823,10 @@ public function getMethodMutations(
return;
}
$file_analyzer = $this->getFileAnalyzerForClassLike($fq_class_name);
$file_analyzer->setRootFilePath($root_file_path, $root_file_name);
if (strtolower($appearing_fq_class_name) !== strtolower($fq_class_name)) {
$file_analyzer = $this->getFileAnalyzerForClassLike($appearing_fq_class_name);
}
@@ -1547,6 +1547,20 @@ public static function getInstance(): self { return new static; }
class Concrete extends Base {}'
],
'preventCrashWhenCallingInternalMethodInPropertyInitialisationChecks' => [
'<?php
class Foo extends \RuntimeException {
/** @var array */
protected $serializableTrace;
public function __construct() {
parent::__construct("hello", 0);
$this->serializableTrace = $this->getTrace();
}
}
class Bar extends Foo {}',
],
];
}

0 comments on commit ffec25d

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