diff --git a/helpers/helpers.php b/helpers/helpers.php index 488f87c..bae1414 100644 --- a/helpers/helpers.php +++ b/helpers/helpers.php @@ -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); diff --git a/src/Exceptions/ThemeLoaderException.php b/src/Exceptions/ThemeLoaderException.php index b9f0e5c..75f2bef 100644 --- a/src/Exceptions/ThemeLoaderException.php +++ b/src/Exceptions/ThemeLoaderException.php @@ -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( diff --git a/src/Helpers/Json.php b/src/Helpers/Json.php index 2871836..4c23be6 100644 --- a/src/Helpers/Json.php +++ b/src/Helpers/Json.php @@ -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(); @@ -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); } @@ -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); } diff --git a/src/Http/Middleware/ThemeLoader.php b/src/Http/Middleware/ThemeLoader.php index edbaf1b..f2057f7 100644 --- a/src/Http/Middleware/ThemeLoader.php +++ b/src/Http/Middleware/ThemeLoader.php @@ -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()) { diff --git a/src/Theme.php b/src/Theme.php index f6a655f..a1075fc 100644 --- a/src/Theme.php +++ b/src/Theme.php @@ -88,7 +88,7 @@ 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; } @@ -96,7 +96,7 @@ public function getPath(?string $path = null): string /** * 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 : ''); } @@ -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); @@ -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); diff --git a/src/ThemesManager.php b/src/ThemesManager.php index c0bf487..0e12482 100644 --- a/src/ThemesManager.php +++ b/src/ThemesManager.php @@ -42,7 +42,7 @@ 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)); } @@ -50,7 +50,7 @@ public function has(?string $name = null): bool /** * 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); } @@ -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);