1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix #1556 - allow internal method calls when checking property initialisation s

This commit is contained in:
Matthew Brown 2019-04-14 12:19:07 -04:00
parent 8454c0db39
commit ffec25da20
2 changed files with 18 additions and 4 deletions

View File

@ -808,10 +808,6 @@ class ProjectAnalyzer
) {
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 @@ class ProjectAnalyzer
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);
}

View File

@ -1547,6 +1547,20 @@ class PropertyTypeTest extends TestCase
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 {}',
],
];
}