8000 Replace empty() by more strict checks (#1125) · geocoder-php/plugin@f8e4bb7 · GitHub
[go: up one dir, main page]

Skip to content

Commit f8e4bb7

Browse files
authored
Replace empty() by more strict checks (#1125)
* Replace empty() by stricter checks * Apply StyleCI fixes * Compare with empty string instead of checking length * Compare with empty array instead of checking count * Compare with empty string instead of checking length
1 parent 406b75d commit f8e4bb7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Plugin/LimitPlugin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public function __construct(int $limit)
4040
*/
4141
public function handleQuery(Query $query, callable $next, callable $first)
4242
{
43-
if (empty($query->getLocale())) {
43+
$limit = $query->getLimit();
44+
if (null !== $limit && $limit > 0) {
4445
$query = $query->withLimit($this->limit);
4546
}
4647

Plugin/LocalePlugin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public function __construct(string $locale)
4040
*/
4141
public function handleQuery(Query $query, callable $next, callable $first)
4242
{
43-
if (empty($query->getLocale())) {
43+
$locale = $query->getLocale();
44+
if (null !== $locale && '' !== $locale) {
4445
$query = $query->withLocale($this->locale);
4546
}
4647

0 commit comments

Comments
 (0)
0