Skip to content
Permalink
Browse files

Register magic property get/set propertyExists calls

  • Loading branch information...
muglug committed Apr 18, 2019
1 parent 1eabe6e commit d51475bc03a65a5f9418c5b6c7c905c31d7dd959
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php
@@ -1027,6 +1027,7 @@ function (PhpParser\Node\Arg $arg) {
if (!self::checkMagicGetterOrSetterProperty(
$statements_analyzer,
$stmt,
$context,
$fq_class_name
)) {
return false;
@@ -1396,6 +1397,7 @@ public static function getClassTemplateParams(
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 @@ private static function checkMagicGetterOrSetterProperty(
$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

0 comments on commit d51475b

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