diff --git a/packages/framework/src/Console/Commands/RebuildStaticSiteCommand.php b/packages/framework/src/Console/Commands/RebuildStaticSiteCommand.php index e8423410ac5..c6a71973813 100644 --- a/packages/framework/src/Console/Commands/RebuildStaticSiteCommand.php +++ b/packages/framework/src/Console/Commands/RebuildStaticSiteCommand.php @@ -70,9 +70,6 @@ public function handle(): int /** * Perform a basic sanitation to strip trailing characters. - * - * @param string $path - * @return string */ public function sanitizePathString(string $path): string { @@ -103,7 +100,6 @@ public function validate(): void /** * Output the contents of an exception. * - * @param Exception $exception * @return int Error code */ public function handleException(Exception $exception): int diff --git a/packages/framework/src/Facades/Author.php b/packages/framework/src/Facades/Author.php index ffd8cd73518..de15bcbe253 100644 --- a/packages/framework/src/Facades/Author.php +++ b/packages/framework/src/Facades/Author.php @@ -23,7 +23,6 @@ class Author * @param string $username The username of the author. This is the key used to find authors in the config. * @param string|null $name The optional display name of the author, leave blank to use the username. * @param string|null $website The author's optional website URL. Website, Twitter, etc. - * @return \Hyde\Framework\Features\Blogging\Models\PostAuthor */ public static function create(string $username, ?string $name = null, ?string $website = null): PostAuthor { @@ -33,9 +32,6 @@ public static function create(string $username, ?string $name = null, ?string $w /** * Get a Post Author instance from the config. If no author matching the username is found, * a new Post Author instance will be created with just username supplied to the method. - * - * @param string $username - * @return \Hyde\Framework\Features\Blogging\Models\PostAuthor */ public static function get(string $username): PostAuthor { diff --git a/packages/framework/src/Facades/Features.php b/packages/framework/src/Facades/Features.php index ca097efd8cc..b3f59ebc804 100644 --- a/packages/framework/src/Facades/Features.php +++ b/packages/framework/src/Facades/Features.php @@ -31,9 +31,6 @@ class Features implements Arrayable, JsonSerializable /** * Determine if the given specified is enabled. - * - * @param string $feature - * @return bool */ public static function enabled(string $feature): bool { @@ -188,8 +185,8 @@ public function toArray(): array { $array = []; foreach (get_class_methods(static::class) as $method) { - if (str_starts_with($method, 'has')) { - $array[Str::kebab(substr($method, 3))] = static::{$method}(); + if (str_starts_with((string) $method, 'has')) { + $array[Str::kebab(substr((string) $method, 3))] = static::{$method}(); } } diff --git a/packages/framework/src/Facades/Meta.php b/packages/framework/src/Facades/Meta.php index a7abe070386..2304ddcd0bb 100644 --- a/packages/framework/src/Facades/Meta.php +++ b/packages/framework/src/Facades/Meta.php @@ -21,7 +21,6 @@ class Meta * * @param string $name The meta tag's name attribute. * @param string $content The content of the meta tag. - * @return \Hyde\Framework\Features\Metadata\Elements\MetadataElement * * @link https://www.w3schools.com/tags/tag_meta.asp */ @@ -35,7 +34,6 @@ public static function name(string $name, string $content): MetadataElement * * @param string $property The meta tag's property attribute. The "og:" prefix is optional. * @param string $content The content of the meta tag. - * @return \Hyde\Framework\Features\Metadata\Elements\OpenGraphElement * * @link https://ogp.me/ */ @@ -50,7 +48,6 @@ public static function property(string $property, string $content): OpenGraphEle * @param string $rel The link tag's rel attribute. * @param string $href The link tag's href attribute. * @param array $attr An optional key-value array of additional attributes. - * @return \Hyde\Framework\Features\Metadata\Elements\LinkElement * * @link https://www.w3schools.com/tags/tag_link.asp */ @@ -69,8 +66,6 @@ public static function get(): GlobalMetadataBag /** * Render the global metadata bag. - * - * @return string */ public static function render(): string { diff --git a/packages/framework/src/Facades/Route.php b/packages/framework/src/Facades/Route.php index cf50fbe8bd4..397086e264d 100644 --- a/packages/framework/src/Facades/Route.php +++ b/packages/framework/src/Facades/Route.php @@ -15,7 +15,6 @@ class Route * Get a route from the route index for the specified route key. * * @param string $routeKey Example: posts/foo.md - * @return \Hyde\Support\Models\Route|null */ public static function get(string $routeKey): ?\Hyde\Support\Models\Route { @@ -25,8 +24,6 @@ public static function get(string $routeKey): ?\Hyde\Support\Models\Route /** * Get a route from the route index for the specified route key or throw an exception. * - * @param string $routeKey - * @return \Hyde\Support\Models\Route * * @throws \Hyde\Framework\Exceptions\RouteNotFoundException */ @@ -55,9 +52,6 @@ public static function current(): ?\Hyde\Support\Models\Route /** * Determine if the supplied route key exists in the route index. - * - * @param string $routeKey - * @return bool */ public static function exists(string $routeKey): bool { diff --git a/packages/framework/src/Foundation/Concerns/ManagesViewData.php b/packages/framework/src/Foundation/Concerns/ManagesViewData.php index f0cfab0af22..ce4e585d173 100644 --- a/packages/framework/src/Foundation/Concerns/ManagesViewData.php +++ b/packages/framework/src/Foundation/Concerns/ManagesViewData.php @@ -17,8 +17,6 @@ trait ManagesViewData { /** * Share data for the page being rendered. - * - * @param \Hyde\Pages\Concerns\HydePage $page */ public function shareViewData(HydePage $page): void { @@ -29,8 +27,6 @@ public function shareViewData(HydePage $page): void /** * Get the route key for the page being rendered. - * - * @return string|null */ public function currentPage(): ?string { @@ -39,8 +35,6 @@ public function currentPage(): ?string /** * Get the route for the page being rendered. - * - * @return \Hyde\Support\Models\Route|null */ public function currentRoute(): ?Route { diff --git a/packages/framework/src/Foundation/FileCollection.php b/packages/framework/src/Foundation/FileCollection.php index 6d709156bf6..264c75b97cd 100644 --- a/packages/framework/src/Foundation/FileCollection.php +++ b/packages/framework/src/Foundation/FileCollection.php @@ -80,7 +80,7 @@ protected function discoverFilesFor(string $pageClass): void { // Scan the source directory, and directories therein, for files that match the model's file extension. foreach (glob($this->kernel->path($pageClass::sourcePath('{*,**/*}')), GLOB_BRACE) as $filepath) { - if (! str_starts_with(basename($filepath), '_')) { + if (! str_starts_with(basename((string) $filepath), '_')) { $this->put($this->kernel->pathToRelative($filepath), File::make($filepath)->belongsTo($pageClass)); } } diff --git a/packages/framework/src/Framework/Actions/ConvertsArrayToFrontMatter.php b/packages/framework/src/Framework/Actions/ConvertsArrayToFrontMatter.php index 95ce54d4550..3cee4407a1c 100644 --- a/packages/framework/src/Framework/Actions/ConvertsArrayToFrontMatter.php +++ b/packages/framework/src/Framework/Actions/ConvertsArrayToFrontMatter.php @@ -16,7 +16,6 @@ class ConvertsArrayToFrontMatter /** * Execute the action. * - * @param array $array * @return string $yaml front matter */ public function execute(array $array): string diff --git a/packages/framework/src/Framework/Actions/CreatesNewMarkdownPostFile.php b/packages/framework/src/Framework/Actions/CreatesNewMarkdownPostFile.php index c4b4640d6d4..1db34fe626e 100644 --- a/packages/framework/src/Framework/Actions/CreatesNewMarkdownPostFile.php +++ b/packages/framework/src/Framework/Actions/CreatesNewMarkdownPostFile.php @@ -83,8 +83,6 @@ public function save(bool $force = false): string|false * Get the class data as an array. * * The identifier property is removed from the array as it can't be set in the front matter. - * - * @return array */ public function toArray(): array { @@ -97,9 +95,6 @@ public function toArray(): array ]; } - /** - * @return string - */ public function getIdentifier(): string { return $this->identifier; diff --git a/packages/framework/src/Framework/Concerns/InteractsWithDirectories.php b/packages/framework/src/Framework/Concerns/InteractsWithDirectories.php index 351a1989ac8..cab2fbfa046 100644 --- a/packages/framework/src/Framework/Concerns/InteractsWithDirectories.php +++ b/packages/framework/src/Framework/Concerns/InteractsWithDirectories.php @@ -35,10 +35,6 @@ public static function needsDirectories(array $directories): void /** * Ensure the supplied file's parent directory exists by creating it if it does not. - * - * @param string $file - * @param int $levels - * @return void */ public static function needsParentDirectory(string $file, int $levels = 1): void { diff --git a/packages/framework/src/Framework/Concerns/RegistersFileLocations.php b/packages/framework/src/Framework/Concerns/RegistersFileLocations.php index 59f9e25debc..5bdb86f3928 100644 --- a/packages/framework/src/Framework/Concerns/RegistersFileLocations.php +++ b/packages/framework/src/Framework/Concerns/RegistersFileLocations.php @@ -25,7 +25,6 @@ trait RegistersFileLocations * @example registerSourceDirectories([HydePage::class => '_pages']) * * @param array $directoryMapping{class: string, location: string} - * @return void */ protected function registerSourceDirectories(array $directoryMapping): void { diff --git a/packages/framework/src/Framework/HydeServiceProvider.php b/packages/framework/src/Framework/HydeServiceProvider.php index a793558d5b7..ece67caff53 100644 --- a/packages/framework/src/Framework/HydeServiceProvider.php +++ b/packages/framework/src/Framework/HydeServiceProvider.php @@ -30,8 +30,6 @@ class HydeServiceProvider extends ServiceProvider /** * Register any application services. - * - * @return void */ public function register(): void { @@ -66,8 +64,6 @@ public function register(): void /** * Bootstrap any application services. - * - * @return void */ public function boot(): void { diff --git a/packages/framework/src/Framework/Services/DiscoveryService.php b/packages/framework/src/Framework/Services/DiscoveryService.php index 0dfe2bbb4c7..3d54fe7a136 100644 --- a/packages/framework/src/Framework/Services/DiscoveryService.php +++ b/packages/framework/src/Framework/Services/DiscoveryService.php @@ -30,7 +30,6 @@ class DiscoveryService * Supply a model::class constant and get a list of all the existing source file base names. * * @param string<\Hyde\Pages\Concerns\HydePage> $model - * @return array * * @throws \Hyde\Framework\Exceptions\UnsupportedPageTypeException * @@ -95,7 +94,6 @@ public static function getMediaAssetFiles(): array * Create a filepath that can be opened in the browser from a terminal. * * @param string<\Hyde\Pages\Concerns\HydePage> $filepath - * @return string */ public static function createClickableFilepath(string $filepath): string { @@ -125,7 +123,7 @@ public static function formatSlugForModel(string $model, string $filepath): stri protected static function getMediaGlobPattern(): string { return sprintf('_media/*.{%s}', str_replace(' ', '', - config('hyde.media_extensions', 'png,svg,jpg,jpeg,gif,ico,css,js') + (string) config('hyde.media_extensions', 'png,svg,jpg,jpeg,gif,ico,css,js') )); } } diff --git a/packages/framework/src/helpers.php b/packages/framework/src/helpers.php index f8b6becb848..cc4d666182d 100644 --- a/packages/framework/src/helpers.php +++ b/packages/framework/src/helpers.php @@ -7,8 +7,6 @@ if (! function_exists('hyde')) { /** * Get the available HydeKernel instance. - * - * @return \Hyde\Foundation\HydeKernel */ function hyde(): HydeKernel { @@ -19,9 +17,6 @@ function hyde(): HydeKernel if (! function_exists('unslash')) { /** * Remove trailing slashes from the start and end of a string. - * - * @param string $string - * @return string */ function unslash(string $string): string { diff --git a/rector.php b/rector.php new file mode 100644 index 00000000000..96e58900fce --- /dev/null +++ b/rector.php @@ -0,0 +1,15 @@ +paths([__DIR__.'/packages/framework/src']); + $rectorConfig->sets([ + LaravelSetList::LARAVEL_90, + \Rector\Set\ValueObject\SetList::PHP_80, + \Rector\Set\ValueObject\SetList::PHP_81, + ]); +};