mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #1337 - don’t crash when examining __call methods in initialisation checks
This commit is contained in:
parent
81a5a24e15
commit
6b419452af
@ -139,7 +139,8 @@ class CallAnalyzer
|
||||
}
|
||||
|
||||
if (!$declaring_method_id) {
|
||||
throw new \UnexpectedValueException('Could not find declaring method for ' . $method_id);
|
||||
// can happen for __call
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2157,6 +2157,20 @@ class PropertyTypeTest extends TestCase
|
||||
}',
|
||||
'error_message' => 'PossiblyNullArgument'
|
||||
],
|
||||
'noCrashOnMagicCall' => [
|
||||
'<?php
|
||||
class A {
|
||||
/** @var string */
|
||||
private $a;
|
||||
|
||||
public function __construct() {
|
||||
$this->setA();
|
||||
}
|
||||
|
||||
public function __call(string $var, array $args) {}
|
||||
}',
|
||||
'error_message' => 'PropertyNotSetInConstructor'
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user