Skip to content

Commit

Permalink
Merge pull request #32 from ngmy/fix-bug
Browse files Browse the repository at this point in the history
Fix bugs
  • Loading branch information
ngmy committed Apr 3, 2021
2 parents 107a930 + 0e8f3a0 commit 8dc4407
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
12 changes: 6 additions & 6 deletions docs/api/classes/Ngmy-TypedArray-TypedArray.html
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ <h4 class="phpdocumentor-element__name" id="method_count">
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="src/TypedArray.php"><a href="files/src-typedarray.html"><abbr title="src/TypedArray.php">TypedArray.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">792</span>
<span class="phpdocumentor-element-found-in__line">789</span>
</aside>


Expand Down Expand Up @@ -1048,7 +1048,7 @@ <h4 class="phpdocumentor-element__name" id="method_getIterator">
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="src/TypedArray.php"><a href="files/src-typedarray.html"><abbr title="src/TypedArray.php">TypedArray.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">809</span>
<span class="phpdocumentor-element-found-in__line">806</span>
</aside>


Expand Down Expand Up @@ -1461,7 +1461,7 @@ <h4 class="phpdocumentor-element__name" id="method_offsetUnset">
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="src/TypedArray.php"><a href="files/src-typedarray.html"><abbr title="src/TypedArray.php">TypedArray.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">769</span>
<span class="phpdocumentor-element-found-in__line">766</span>
</aside>


Expand Down Expand Up @@ -3106,7 +3106,7 @@ <h4 class="phpdocumentor-element__name" id="method___construct">
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="src/TypedArray.php"><a href="files/src-typedarray.html"><abbr title="src/TypedArray.php">TypedArray.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">814</span>
<span class="phpdocumentor-element-found-in__line">811</span>
</aside>


Expand Down Expand Up @@ -3169,7 +3169,7 @@ <h4 class="phpdocumentor-element__name" id="method_getKeyHashCode">
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="src/TypedArray.php"><a href="files/src-typedarray.html"><abbr title="src/TypedArray.php">TypedArray.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">836</span>
<span class="phpdocumentor-element-found-in__line">833</span>
</aside>


Expand Down Expand Up @@ -3255,7 +3255,7 @@ <h4 class="phpdocumentor-element__name" id="method_keyExists">
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="src/TypedArray.php"><a href="files/src-typedarray.html"><abbr title="src/TypedArray.php">TypedArray.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">896</span>
<span class="phpdocumentor-element-found-in__line">890</span>
</aside>


Expand Down
18 changes: 6 additions & 12 deletions src/TypedArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,18 +728,15 @@ public function offsetSet($key, $value): void
|| ($this->valueType == self::VALUE_TYPES['string'] && !is_string($value))
|| (
$this->valueClassKind == self::VALUE_CLASS_KINDS['class']
&& (is_object($value) || is_string($value))
&& !is_a($value, $this->valueType)
&& (!is_object($value) || !is_a($value, $this->valueType))
)
|| (
$this->valueClassKind == self::VALUE_CLASS_KINDS['interface']
&& (is_object($value) || is_string($value))
&& !is_subclass_of($value, $this->valueType)
&& (!is_object($value) || !is_subclass_of($value, $this->valueType))
)
|| (
$this->valueClassKind == self::VALUE_CLASS_KINDS['trait']
&& (is_object($value) || (is_string($value) && class_exists($value)))
&& !array_key_exists($this->valueType, class_uses_recursive($value))
&& (!is_object($value) || !array_key_exists($this->valueType, class_uses_recursive($value)))
)
) {
$givenValueType = is_object($value) ? get_class($value) : gettype($value);
Expand Down Expand Up @@ -844,18 +841,15 @@ private function getKeyHashCode($key)
|| ($this->keyType == self::KEY_TYPES['string'] && !is_string($key))
|| (
$this->keyClassKind == self::KEY_CLASS_KINDS['class']
&& (is_object($key) || is_string($key))
&& !is_a($key, $this->keyType)
&& (!is_object($key) || !is_a($key, $this->keyType))
)
|| (
$this->keyClassKind == self::KEY_CLASS_KINDS['interface']
&& (is_object($key) || is_string($key))
&& !is_subclass_of($key, $this->keyType)
&& (!is_object($key) || !is_subclass_of($key, $this->keyType))
)
|| (
$this->keyClassKind == self::KEY_CLASS_KINDS['trait']
&& (is_object($key) || (is_string($key) && class_exists($key)))
&& !array_key_exists($this->keyType, class_uses_recursive($key))
&& (!is_object($key) || !array_key_exists($this->keyType, class_uses_recursive($key)))
)
) {
$givenKeyType = is_object($key) ? get_class($key) : gettype($key);
Expand Down

0 comments on commit 8dc4407

Please sign in to comment.