Skip to content

Commit

Permalink
Merge pull request #17530 from cakephp/non-cloaking-checks
Browse files Browse the repository at this point in the history
Refactor cloaking checks
  • Loading branch information
othercorey committed Jan 7, 2024
2 parents b6212db + 32e0f83 commit 8f577b8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Locator/AbstractLocator.php
Expand Up @@ -53,7 +53,7 @@ public function get(string $alias, array $options = []): RepositoryInterface
unset($storeOptions['allowFallbackClass']);

if (isset($this->instances[$alias])) {
if (!empty($storeOptions) && isset($this->options[$alias]) && $this->options[$alias] !== $storeOptions) {
if ($storeOptions && isset($this->options[$alias]) && $this->options[$alias] !== $storeOptions) {
throw new CakeException(sprintf(
'You cannot configure `%s`, it already exists in the registry.',
$alias
Expand Down
2 changes: 1 addition & 1 deletion ModelAwareTrait.php
Expand Up @@ -94,7 +94,7 @@ protected function _setModelClass(string $name): void
public function fetchModel(?string $modelClass = null, ?string $modelType = null): RepositoryInterface
{
$modelClass ??= $this->modelClass;
if (empty($modelClass)) {
if (!$modelClass) {
throw new UnexpectedValueException('Default modelClass is empty');
}
$modelType ??= $this->getModelType();
Expand Down
2 changes: 1 addition & 1 deletion QueryCacher.php
Expand Up @@ -70,7 +70,7 @@ public function fetch(object $query): mixed
$key = $this->_resolveKey($query);
$storage = $this->_resolveCacher();
$result = $storage->get($key);
if (empty($result)) {
if (!$result) {
return null;
}

Expand Down

0 comments on commit 8f577b8

Please sign in to comment.