Skip to content

Commit

Permalink
refactor: clean condition check
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Dec 27, 2024
1 parent 10637ab commit 83f69ca
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion system/Config/DotEnv.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function parse(): ?array
*/
protected function setVariable(string $name, string $value = '')
{
if (in_array(getenv($name, true), ['', '0'], true) || getenv($name, true) === [] || getenv($name, true) === false) {
if (in_array(getenv($name, true), ['', '0', [], false], true)) {
putenv("{$name}={$value}");
}

Expand Down
2 changes: 1 addition & 1 deletion system/Database/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function parseDSN(array $params): array
{
$dsn = parse_url($params['DSN']);

if ($dsn === 0 || ($dsn === '' || $dsn === '0') || $dsn === [] || $dsn === false || $dsn === null) {
if ($dsn === 0 || $dsn === '' || $dsn === '0' || $dsn === [] || $dsn === false || $dsn === null) {
throw new InvalidArgumentException('Your DSN connection string is invalid.');
}

Expand Down
2 changes: 1 addition & 1 deletion system/Database/MigrationRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ public function getBatchStart(int $batch): string
->get()
->getResultObject();

return count($migration) !== 0 ? $migration[0]->version : '0';
return count($migration) > 0 ? $migration[0]->version : '0';
}

/**
Expand Down
3 changes: 2 additions & 1 deletion system/Images/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ public function copy(string $targetPath, ?string $targetName = null, int $perms
public function getProperties(bool $return = false)
{
$path = $this->getPathname();
$vals = getimagesize($path);

if ($vals = getimagesize($path) === [] || $vals = getimagesize($path) === false) {
if ($vals === [] || $vals === false) {
throw ImageException::forFileNotSupported();
}

Expand Down

0 comments on commit 83f69ca

Please sign in to comment.