Skip to content

Commit

Permalink
PHP Linting (Pint)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetan-hexadog authored and github-actions[bot] committed Sep 13, 2023
1 parent 25e7b5e commit 9958214
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion helpers/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function page_title(string $title, bool $withAppName = true, string $separator =
/**
* Set theme.
*/
function theme(?string $themeName = null): Hexadog\ThemesManager\Theme
function theme(string $themeName = null): Hexadog\ThemesManager\Theme
{
if ($themeName) {
\Theme::set($themeName);
Expand Down
3 changes: 0 additions & 3 deletions src/Exceptions/ThemeLoaderException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

final class ThemeLoaderException extends \RuntimeException
{
/**
* @return \Hexadog\ThemesManager\Exceptions\ThemeLoaderException
*/
public static function duplicate(string $name): self
{
return new self(sprintf(
Expand Down
6 changes: 3 additions & 3 deletions src/Helpers/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class Json
/**
* The constructor.
*/
public function __construct(string $path, ?Filesystem $filesystem = null)
public function __construct(string $path, Filesystem $filesystem = null)
{
$this->path = $path;
$this->filesystem = $filesystem ? $filesystem : new Filesystem();
Expand Down Expand Up @@ -103,7 +103,7 @@ public function setPath(string $path): Json
/**
* Make new instance.
*/
public static function make(string $path, ?Filesystem $filesystem = null): Json
public static function make(string $path, Filesystem $filesystem = null): Json
{
return new self($path, $filesystem);
}
Expand Down Expand Up @@ -136,7 +136,7 @@ public function getAttributes(): array
/**
* Convert the given array data to pretty json.
*/
public function toJsonPretty(?array $data = null): false|string
public function toJsonPretty(array $data = null): false|string
{
return json_encode($data ? $data : $this->attributes, JSON_PRETTY_PRINT);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/ThemeLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ThemeLoader
/**
* Handle an incoming request.
*/
public function handle(Request $request, \Closure $next, ?string $theme = null)
public function handle(Request $request, \Closure $next, string $theme = null)
{
// Do not load theme if API request or App is running in console
if ($request->expectsJson() || app()->runningInConsole()) {
Expand Down
8 changes: 4 additions & 4 deletions src/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ public static function make(...$arguments): self
/**
* Get path.
*/
public function getPath(?string $path = null): string
public function getPath(string $path = null): string
{
return $this->path . $path;
}

/**
* Get assets path.
*/
public function getAssetsPath(?string $path = null): string
public function getAssetsPath(string $path = null): string
{
return Config::get('themes-manager.symlink_path', 'themes') . '/' . mb_strtolower($this->vendor) . '/' . mb_strtolower($this->name) . ($path ? '/' . $path : '');
}
Expand Down Expand Up @@ -173,7 +173,7 @@ public function setPath(string $path): self
/**
* Set theme vendor.
*/
public function setVendor(?string $vendor = null): self
public function setVendor(string $vendor = null): self
{
if (Str::contains($vendor, '/')) {
$this->vendor = dirname($vendor);
Expand Down Expand Up @@ -210,7 +210,7 @@ public function setParent(string|Theme|null $theme): self
/**
* Get parent Theme.
*/
public function getParent(): Theme|null
public function getParent(): ?Theme
{
if (is_string($this->parent)) {
$this->parent = ThemesManager::findByName($this->parent);
Expand Down
6 changes: 3 additions & 3 deletions src/ThemesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public function all(): Collection
/**
* Check if theme with given name exists.
*/
public function has(?string $name = null): bool
public function has(string $name = null): bool
{
return ! is_null($this->findByName($name, null));
}

/**
* Get theme by name (or return all themes if no name given).
*/
public function get(?string $name = null): ?Theme
public function get(string $name = null): ?Theme
{
return $this->findByName($name, null);
}
Expand Down Expand Up @@ -187,7 +187,7 @@ public function url(string $asset, bool $absolute = true): ?string
* If no vendor provided and name not prefixed by vendor
* the first theme with given name is returned.
*/
public function findByName(string $name, ?string $vendor = null): ?Theme
public function findByName(string $name, string $vendor = null): ?Theme
{
// normalize theme name
$name = str_replace(['-theme', 'theme-'], '', $name);
Expand Down

0 comments on commit 9958214

Please sign in to comment.