Browse Source

Update param type on offsetGet (#8033)

The param was typed as `object` which is invalid as when items are set in the container the key passes through `checkKey` where it enforces the key must be various classes of integer, bool or string. Thus I have replaced it with a union type (in future this can be a proper PHP level typehint, but for now only doctype)
Mike Lehan 4 years ago
parent
commit
9ee163a5d7
1 changed files with 1 additions and 1 deletions
  1. 1 1
      php/src/Google/Protobuf/Internal/MapField.php

+ 1 - 1
php/src/Google/Protobuf/Internal/MapField.php

@@ -129,7 +129,7 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable
      *
      *
      * This will also be called for: $ele = $arr[$key]
      * This will also be called for: $ele = $arr[$key]
      *
      *
-     * @param object $key The key of the element to be fetched.
+     * @param int|bool|string $key The key of the element to be fetched.
      * @return object The stored element at given key.
      * @return object The stored element at given key.
      * @throws \ErrorException Invalid type for index.
      * @throws \ErrorException Invalid type for index.
      * @throws \ErrorException Non-existing index.
      * @throws \ErrorException Non-existing index.