| @@ 245-265 (lines=21) @@ | ||
| 242 | ); |
|
| 243 | } |
|
| 244 | ||
| 245 | if ($class_constant_type) { |
|
| 246 | if (IssueBuffer::accepts( |
|
| 247 | new InaccessibleClassConstant( |
|
| 248 | 'Constant ' . $const_id . ' is not visible in this context', |
|
| 249 | new CodeLocation($statements_analyzer->getSource(), $stmt) |
|
| 250 | ), |
|
| 251 | $statements_analyzer->getSuppressedIssues() |
|
| 252 | )) { |
|
| 253 | // fall through |
|
| 254 | } |
|
| 255 | } elseif ($context->check_consts) { |
|
| 256 | if (IssueBuffer::accepts( |
|
| 257 | new UndefinedConstant( |
|
| 258 | 'Constant ' . $const_id . ' is not defined', |
|
| 259 | new CodeLocation($statements_analyzer->getSource(), $stmt) |
|
| 260 | ), |
|
| 261 | $statements_analyzer->getSuppressedIssues() |
|
| 262 | )) { |
|
| 263 | // fall through |
|
| 264 | } |
|
| 265 | } |
|
| 266 | ||
| 267 | return true; |
|
| 268 | } |
|
| @@ 722-746 (lines=25) @@ | ||
| 719 | )) { |
|
| 720 | // fall through |
|
| 721 | } |
|
| 722 | } else { |
|
| 723 | if ($has_magic_getter) { |
|
| 724 | if (IssueBuffer::accepts( |
|
| 725 | new UndefinedMagicPropertyFetch( |
|
| 726 | 'Magic instance property ' . $property_id . ' is not defined', |
|
| 727 | new CodeLocation($statements_analyzer->getSource(), $stmt), |
|
| 728 | $property_id |
|
| 729 | ), |
|
| 730 | $statements_analyzer->getSuppressedIssues() |
|
| 731 | )) { |
|
| 732 | // fall through |
|
| 733 | } |
|
| 734 | } else { |
|
| 735 | if (IssueBuffer::accepts( |
|
| 736 | new UndefinedPropertyFetch( |
|
| 737 | 'Instance property ' . $property_id . ' is not defined', |
|
| 738 | new CodeLocation($statements_analyzer->getSource(), $stmt), |
|
| 739 | $property_id |
|
| 740 | ), |
|
| 741 | $statements_analyzer->getSuppressedIssues() |
|
| 742 | )) { |
|
| 743 | // fall through |
|
| 744 | } |
|
| 745 | } |
|
| 746 | } |
|
| 747 | ||
| 748 | $stmt_type = Type::getMixed(); |
|
| 749 | ||
| @@ 964-984 (lines=21) @@ | ||
| 961 | if ($invalid_fetch_types) { |
|
| 962 | $lhs_type_part = $invalid_fetch_types[0]; |
|
| 963 | ||
| 964 | if ($has_valid_fetch_type) { |
|
| 965 | if (IssueBuffer::accepts( |
|
| 966 | new PossiblyInvalidPropertyFetch( |
|
| 967 | 'Cannot fetch property on possible non-object ' . $stmt_var_id . ' of type ' . $lhs_type_part, |
|
| 968 | new CodeLocation($statements_analyzer->getSource(), $stmt) |
|
| 969 | ), |
|
| 970 | $statements_analyzer->getSuppressedIssues() |
|
| 971 | )) { |
|
| 972 | // fall through |
|
| 973 | } |
|
| 974 | } else { |
|
| 975 | if (IssueBuffer::accepts( |
|
| 976 | new InvalidPropertyFetch( |
|
| 977 | 'Cannot fetch property on non-object ' . $stmt_var_id . ' of type ' . $lhs_type_part, |
|
| 978 | new CodeLocation($statements_analyzer->getSource(), $stmt) |
|
| 979 | ), |
|
| 980 | $statements_analyzer->getSuppressedIssues() |
|
| 981 | )) { |
|
| 982 | // fall through |
|
| 983 | } |
|
| 984 | } |
|
| 985 | } |
|
| 986 | ||
| 987 | if ($var_id) { |
|
| @@ 569-593 (lines=25) @@ | ||
| 566 | )) { |
|
| 567 | // fall through |
|
| 568 | } |
|
| 569 | } else { |
|
| 570 | if ($has_magic_setter) { |
|
| 571 | if (IssueBuffer::accepts( |
|
| 572 | new UndefinedMagicPropertyAssignment( |
|
| 573 | 'Magic instance property ' . $property_id . ' is not defined', |
|
| 574 | new CodeLocation($statements_analyzer->getSource(), $stmt), |
|
| 575 | $property_id |
|
| 576 | ), |
|
| 577 | $statements_analyzer->getSuppressedIssues() |
|
| 578 | )) { |
|
| 579 | // fall through |
|
| 580 | } |
|
| 581 | } else { |
|
| 582 | if (IssueBuffer::accepts( |
|
| 583 | new UndefinedPropertyAssignment( |
|
| 584 | 'Instance property ' . $property_id . ' is not defined', |
|
| 585 | new CodeLocation($statements_analyzer->getSource(), $stmt), |
|
| 586 | $property_id |
|
| 587 | ), |
|
| 588 | $statements_analyzer->getSuppressedIssues() |
|
| 589 | )) { |
|
| 590 | // fall through |
|
| 591 | } |
|
| 592 | } |
|
| 593 | } |
|
| 594 | ||
| 595 | continue; |
|
| 596 | } |
|
| @@ 302-323 (lines=22) @@ | ||
| 299 | $statements_analyzer->node_data->setType($stmt, $stmt_type); |
|
| 300 | ||
| 301 | if ($stmt_type->possibly_undefined_from_try && !$context->inside_isset) { |
|
| 302 | if ($context->is_global) { |
|
| 303 | if (IssueBuffer::accepts( |
|
| 304 | new PossiblyUndefinedGlobalVariable( |
|
| 305 | 'Possibly undefined global variable ' . $var_name . ' defined in try block', |
|
| 306 | new CodeLocation($statements_analyzer->getSource(), $stmt), |
|
| 307 | $var_name |
|
| 308 | ), |
|
| 309 | $statements_analyzer->getSuppressedIssues() |
|
| 310 | )) { |
|
| 311 | // fall through |
|
| 312 | } |
|
| 313 | } else { |
|
| 314 | if (IssueBuffer::accepts( |
|
| 315 | new PossiblyUndefinedVariable( |
|
| 316 | 'Possibly undefined variable ' . $var_name . ' defined in try block', |
|
| 317 | new CodeLocation($statements_analyzer->getSource(), $stmt) |
|
| 318 | ), |
|
| 319 | $statements_analyzer->getSuppressedIssues() |
|
| 320 | )) { |
|
| 321 | // fall through |
|
| 322 | } |
|
| 323 | } |
|
| 324 | } |
|
| 325 | ||
| 326 | if ($codebase->store_node_types |
|