Skip to content

replaced count(x) == 0 to empty #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
- Removed unused logic for HTTP and requests dependency.
- Removed all producer logic for Storages.
- Added SafeRedisWrapper for handling exception in Redis.
- Fixed typos in bucket and CONTRIBUTORS-GUIDE.
- Added `.gitattributes` for excluding tests/.
- Added `.gitattributes` for excluding `tests/.` and other files for composer package.
- Fixed typos in `Splitter.php` and CONTRIBUTORS-GUIDE.

7.1.0 (Dec 3, 2021)
- Added a new option to use when running Redis in cluster mode called `keyHashTags` which receives a list of hashtags from which the SDK will randomly pick one to use on the generated instance.
Expand Down
3 changes: 1 addition & 2 deletions src/SplitIO/Component/Cache/SplitCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public function getChangeNumber()
public function getSplit($splitName)
{
$cache = Di::getCache();
$cacheItem = $cache->get(self::getCacheKeyForSplit($splitName));
return $cacheItem;
return $cache->get(self::getCacheKeyForSplit($splitName));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

interface CacheStorageAdapterInterface
{

// public function __construct(array $options);

/**
* @param null|string $pattern
* @return mixed
Expand Down
6 changes: 3 additions & 3 deletions src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private function isValidConfigArray($nodes, $type)
if (!is_array($nodes)) {
return $type . "s must be an array.";
}
if (count($nodes) == 0) {
if (empty($nodes)) {
return "At least one " . $type . " is required.";
}
if (SplitIOUtils\isAssociativeArray($nodes)) {
Expand Down Expand Up @@ -119,7 +119,7 @@ function ($value) {
return $this->validateKeyHashTag($value)['valid'];
}
);
if (count($filteredArray) == 0) {
if (empty($filteredArray)) {
throw new AdapterException('keyHashTags size is zero after filtering valid elements.');
}
return $selected = $filteredArray[array_rand($filteredArray, 1)];
Expand Down Expand Up @@ -228,7 +228,7 @@ public function get($key)
public function fetchMany(array $keys = array())
{
$toReturn = array();
if (count($keys) == 0) {
if (empty($keys)) {
return $toReturn;
}
$values = $this->client->mget($keys);
Expand Down
2 changes: 1 addition & 1 deletion src/SplitIO/Grammar/Condition/Matcher/PartOfSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct($data, $negate = false, $attribute = null)

protected function evalKey($key)
{
if (!is_array($key) || count($key) == 0) {
if (!is_array($key) || empty($key)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/SplitIO/Sdk/Validator/InputValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function ($featureName) use ($operation) {
)
)
);
if (count($filteredArray) == 0) {
if (empty($filteredArray)) {
SplitApp::logger()->critical($operation . ': featureNames must be a non-empty array.');
return null;
}
Expand Down