Use === null instead

This commit is contained in:
Kleis Auke Wolthuizen
2017-11-21 17:39:42 +01:00
parent dac1e15e2d
commit 90eaea7be2
2 changed files with 5 additions and 5 deletions

View File

@@ -70,19 +70,19 @@ class PageRules implements API
string $direction = null, string $direction = null,
string $match = null string $match = null
): array { ): array {
if (is_null($status) && !in_array($status, ['active', 'disabled'])) { if ($status === null && !in_array($status, ['active', 'disabled'])) {
throw new EndpointException('Page Rules can only be listed by status of active or disabled.'); throw new EndpointException('Page Rules can only be listed by status of active or disabled.');
} }
if (is_null($order) && !in_array($order, ['status', 'priority'])) { if ($order === null && !in_array($order, ['status', 'priority'])) {
throw new EndpointException('Page Rules can only be ordered by status or priority.'); throw new EndpointException('Page Rules can only be ordered by status or priority.');
} }
if (is_null($direction) && !in_array($direction, ['asc', 'desc'])) { if ($direction === null && !in_array($direction, ['asc', 'desc'])) {
throw new EndpointException('Direction of Page Rule ordering can only be asc or desc.'); throw new EndpointException('Direction of Page Rule ordering can only be asc or desc.');
} }
if (is_null($match) && !in_array($match, ['all', 'any'])) { if ($match === null && !in_array($match, ['all', 'any'])) {
throw new EndpointException('Match can only be any or all.'); throw new EndpointException('Match can only be any or all.');
} }

View File

@@ -160,7 +160,7 @@ class Zones implements API
public function cachePurge(string $zoneID, array $files = null, array $tags = null): bool public function cachePurge(string $zoneID, array $files = null, array $tags = null): bool
{ {
if (is_null($files) && is_null($tags)) { if ($files === null && $tags === null) {
throw new EndpointException('No files or tags to purge.'); throw new EndpointException('No files or tags to purge.');
} }