Skip to content

Commit

Permalink
Update Settings.php
Browse files Browse the repository at this point in the history
  • Loading branch information
pixobit committed May 23, 2024
1 parent 5a73f46 commit 9fa0107
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions src/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Settings
/**
* An array of handlers for getting/setting the values.
*
* @var list<BaseHandler>
* @var BaseHandler[]
*/
private array $handlers = [];

Expand Down Expand Up @@ -61,20 +61,7 @@ public function get(string $key, ?string $context = null)
}
}

// If no contextual value was found then fall back to general
if ($context !== null) {
return $this->get($key);
}

$config = config($class);

// Use a fully qualified class name if the
// config file was found.
if ($config !== null) {
$class = get_class($config);
}

return $config->{$property} ?? null;
return config($class)?->{$property} ?? null;

Check failure on line 64 in src/Settings.php

View workflow job for this annotation

GitHub Actions / phpstan / PHP 7.4 Static Analysis

Syntax error, unexpected T_OBJECT_OPERATOR on line 64
}

/**
Expand Down Expand Up @@ -125,7 +112,7 @@ public function flush()
/**
* Returns the handler that is set to store values.
*
* @return list<BaseHandler>
* @return BaseHandler[]
*
* @throws RuntimeException
*/
Expand All @@ -149,7 +136,7 @@ private function getWriteHandlers()
/**
* Analyzes the given key and breaks it into the class.field parts.
*
* @return list<string>
* @return string[]
*
* @throws InvalidArgumentException
*/
Expand All @@ -171,8 +158,6 @@ private function parseDotSyntax(string $key): array
*/
private function prepareClassAndProperty(string $key): array
{
[$class, $property] = $this->parseDotSyntax($key);

return [$class, $property];
return $this->parseDotSyntax($key);
}
}

0 comments on commit 9fa0107

Please sign in to comment.