Skip to content

Commit

Permalink
Really fix undefined index issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Dec 6, 2017
1 parent bb4238c commit cb56aa8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/JsonApi/Request/JsonApiRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,6 @@ private function setListQueryParam(string $name, $queryParam): void

private function isBlankKey(array $array, string $key): bool
{
return empty($array[$key]) && !is_numeric($array[$key]);
return array_key_exists($key, $array) === false || (empty($array[$key]) && is_numeric($array[$key]) === false);
}
}
4 changes: 2 additions & 2 deletions src/JsonApi/Request/ResourceObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public function toArray(): array
return $resource;
}

private function isBlank($value): bool
private function isBlank(string $value): bool
{
return empty($value) && !is_numeric($value);
return empty($value) && is_numeric($value) === false;
}
}
2 changes: 1 addition & 1 deletion src/JsonApi/Schema/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@ public function error(int $number): ?Error

private static function isAssociativeArray(array $array): bool
{
return (bool)count(array_filter(array_keys($array), 'is_string'));
return (bool) count(array_filter(array_keys($array), "is_string"));
}
}
4 changes: 2 additions & 2 deletions src/JsonApi/Schema/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public function resourceLinkMeta(string $type, string $id): ?array

private static function isAssociativeArray(array $array): bool
{
return (bool) count(array_filter(array_keys($array), 'is_string'));
return (bool) count(array_filter(array_keys($array), "is_string"));
}

private static function isArrayKey(array $array, string $key): bool
Expand All @@ -295,6 +295,6 @@ private static function isArrayKey(array $array, string $key): bool

private static function isBlankKey(array $array, string $key): bool
{
return empty($array[$key]) && !is_numeric($array[$key]);
return array_key_exists($key, $array) === false || (empty($array[$key]) && is_numeric($array[$key]) === false);
}
}

0 comments on commit cb56aa8

Please sign in to comment.