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:
parent
8454c0db39
commit
ffec25da20
@ -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);
|
||||
}
|
||||
|
@ -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 {}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user