| @@ 1004-1023 (lines=20) @@ | ||
| 1001 | } |
|
| 1002 | ||
| 1003 | if ($type_match_found) { |
|
| 1004 | if (!$assignment_value_type->ignore_nullable_issues |
|
| 1005 | && $assignment_value_type->isNullable() |
|
| 1006 | && !$class_property_type->isNullable() |
|
| 1007 | ) { |
|
| 1008 | if (IssueBuffer::accepts( |
|
| 1009 | new PossiblyNullPropertyAssignmentValue( |
|
| 1010 | $var_id . ' with non-nullable declared type \'' . $class_property_type . |
|
| 1011 | '\' cannot be assigned nullable type \'' . $assignment_value_type . '\'', |
|
| 1012 | new CodeLocation( |
|
| 1013 | $statements_analyzer->getSource(), |
|
| 1014 | $assignment_value ?: $stmt, |
|
| 1015 | $context->include_location |
|
| 1016 | ), |
|
| 1017 | $property_ids[0] |
|
| 1018 | ), |
|
| 1019 | $statements_analyzer->getSuppressedIssues() |
|
| 1020 | )) { |
|
| 1021 | return false; |
|
| 1022 | } |
|
| 1023 | } |
|
| 1024 | ||
| 1025 | if (!$assignment_value_type->ignore_falsable_issues |
|
| 1026 | && $assignment_value_type->isFalsable() |
|
| @@ 1025-1045 (lines=21) @@ | ||
| 1022 | } |
|
| 1023 | } |
|
| 1024 | ||
| 1025 | if (!$assignment_value_type->ignore_falsable_issues |
|
| 1026 | && $assignment_value_type->isFalsable() |
|
| 1027 | && !$class_property_type->hasBool() |
|
| 1028 | && !$class_property_type->hasScalar() |
|
| 1029 | ) { |
|
| 1030 | if (IssueBuffer::accepts( |
|
| 1031 | new PossiblyFalsePropertyAssignmentValue( |
|
| 1032 | $var_id . ' with non-falsable declared type \'' . $class_property_type . |
|
| 1033 | '\' cannot be assigned possibly false type \'' . $assignment_value_type . '\'', |
|
| 1034 | new CodeLocation( |
|
| 1035 | $statements_analyzer->getSource(), |
|
| 1036 | $assignment_value ?: $stmt, |
|
| 1037 | $context->include_location |
|
| 1038 | ), |
|
| 1039 | $property_ids[0] |
|
| 1040 | ), |
|
| 1041 | $statements_analyzer->getSuppressedIssues() |
|
| 1042 | )) { |
|
| 1043 | return false; |
|
| 1044 | } |
|
| 1045 | } |
|
| 1046 | } |
|
| 1047 | } |
|
| 1048 | ||