Skip to content

Commit 9d88e75

Browse files
Add phpdoc
1 parent 2980730 commit 9d88e75

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Type/Constant/ConstantArrayType.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,14 @@ public function setExistingOffsetValueType(Type $offsetType, Type $valueType): T
715715
return $builder->getArray();
716716
}
717717

718+
/**
719+
* Removes or marks as optional the key(s) matching the given offset type from this constant array.
720+
*
721+
* By default, the method assumes an actual `unset()` call was made, which actively modifies the
722+
* array and weakens its list certainty to "maybe". However, in some contexts, such as the else
723+
* branch of an array_key_exists() check, the key is statically known to be absent without any
724+
* modification, so list certainty should be preserved as-is.
725+
*/
718726
public function unsetOffset(Type $offsetType, bool $preserveListCertainty = false): Type
719727
{
720728
$offsetType = $offsetType->toArrayKey();

0 commit comments

Comments
 (0)