mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Register magic property get/set propertyExists calls
This commit is contained in:
parent
1eabe6ed55
commit
d51475bc03
@ -1027,6 +1027,7 @@ class MethodCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
|
||||
if (!self::checkMagicGetterOrSetterProperty(
|
||||
$statements_analyzer,
|
||||
$stmt,
|
||||
$context,
|
||||
$fq_class_name
|
||||
)) {
|
||||
return false;
|
||||
@ -1396,6 +1397,7 @@ class MethodCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
|
||||
private static function checkMagicGetterOrSetterProperty(
|
||||
StatementsAnalyzer $statements_analyzer,
|
||||
PhpParser\Node\Expr\MethodCall $stmt,
|
||||
Context $context,
|
||||
$fq_class_name
|
||||
) {
|
||||
if (!$stmt->name instanceof PhpParser\Node\Identifier) {
|
||||
@ -1417,6 +1419,14 @@ class MethodCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
|
||||
$codebase = $statements_analyzer->getCodebase();
|
||||
$class_storage = $codebase->classlike_storage_provider->get($fq_class_name);
|
||||
|
||||
$codebase->properties->propertyExists(
|
||||
$property_id,
|
||||
$method_name === '__get',
|
||||
$statements_analyzer,
|
||||
$context,
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt)
|
||||
);
|
||||
|
||||
switch ($method_name) {
|
||||
case '__set':
|
||||
// If `@psalm-seal-properties` is set, the property must be defined with
|
||||
|
Loading…
x
Reference in New Issue
Block a user