diff --git a/packages/framework/src/Actions/BladeMatterParser.php b/packages/framework/src/Actions/BladeMatterParser.php index dd7674da7f5..cd3e2043044 100644 --- a/packages/framework/src/Actions/BladeMatterParser.php +++ b/packages/framework/src/Actions/BladeMatterParser.php @@ -111,7 +111,7 @@ public static function extractValue(string $line): string } /** @internal Return the proper type for the string */ - public static function normalizeValue($value): mixed + public static function normalizeValue(string $value): mixed { $value = trim($value); diff --git a/packages/framework/src/Actions/SourceFileParser.php b/packages/framework/src/Actions/SourceFileParser.php index c0ff6716e10..10b1e1ee9f5 100644 --- a/packages/framework/src/Actions/SourceFileParser.php +++ b/packages/framework/src/Actions/SourceFileParser.php @@ -37,7 +37,8 @@ public function __construct(string $pageClass, string $identifier) protected function parseBladePage(): BladePage { - return new BladePage($this->identifier, + return new BladePage( + $this->identifier, (BladeMatterParser::parseFile(BladePage::qualifyBasename($this->identifier))) ); } diff --git a/packages/framework/src/Commands/HydeMakePostCommand.php b/packages/framework/src/Commands/HydeMakePostCommand.php index 427d6db9d0b..82b1f397ceb 100644 --- a/packages/framework/src/Commands/HydeMakePostCommand.php +++ b/packages/framework/src/Commands/HydeMakePostCommand.php @@ -84,7 +84,7 @@ public function handle(): int $this->comment('If you want to overwrite the file supply the --force flag.'); } - return $exception->getCode(); + return (int) $exception->getCode(); } } } diff --git a/packages/framework/src/Commands/HydePackageDiscoverCommand.php b/packages/framework/src/Commands/HydePackageDiscoverCommand.php index 99ae67ce224..492e350dddc 100644 --- a/packages/framework/src/Commands/HydePackageDiscoverCommand.php +++ b/packages/framework/src/Commands/HydePackageDiscoverCommand.php @@ -11,6 +11,7 @@ */ class HydePackageDiscoverCommand extends BaseCommand { + /** @var true */ protected $hidden = true; public function handle(PackageManifest $manifest) diff --git a/packages/framework/src/Commands/HydePublishViewsCommand.php b/packages/framework/src/Commands/HydePublishViewsCommand.php index bc6b379a766..48851963abb 100644 --- a/packages/framework/src/Commands/HydePublishViewsCommand.php +++ b/packages/framework/src/Commands/HydePublishViewsCommand.php @@ -32,7 +32,7 @@ public function handle(): int return 0; } - protected function publishOption($selected): void + protected function publishOption(string $selected): void { (new PublishesHydeViews($selected))->execute(); diff --git a/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php b/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php index 3915ea85ac8..af904d0cbf5 100644 --- a/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php +++ b/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php @@ -122,7 +122,7 @@ public function handleException(Exception $exception): int $this->error('Something went wrong!'); $this->warn($exception->getMessage()); - return $exception->getCode(); + return (int) $exception->getCode(); } /** diff --git a/packages/framework/src/Concerns/FrontMatter/Schemas/BlogPostSchema.php b/packages/framework/src/Concerns/FrontMatter/Schemas/BlogPostSchema.php index 392a7b2f442..c8264a485ad 100644 --- a/packages/framework/src/Concerns/FrontMatter/Schemas/BlogPostSchema.php +++ b/packages/framework/src/Concerns/FrontMatter/Schemas/BlogPostSchema.php @@ -66,7 +66,7 @@ protected function makeDescription(): string return substr($this->markdown, 0, 125).'...'; } - return $this->markdown; + return (string) $this->markdown; } protected function getAuthor(): ?Author diff --git a/packages/framework/src/Contracts/RouteFacadeContract.php b/packages/framework/src/Contracts/RouteFacadeContract.php index ad5797a4e52..1899ef00eda 100644 --- a/packages/framework/src/Contracts/RouteFacadeContract.php +++ b/packages/framework/src/Contracts/RouteFacadeContract.php @@ -56,7 +56,7 @@ public static function getFromModel(PageContract $page): RouteContract; /** * Get all routes from the Router index. * - * @return \Illuminate\Support\Collection<\Hyde\Framework\Contracts\RouteContract> + * @return \Hyde\Framework\RouteCollection<\Hyde\Framework\Contracts\RouteContract> */ public static function all(): Collection; diff --git a/packages/framework/src/HydeKernel.php b/packages/framework/src/HydeKernel.php index b57c74a41b2..b4efa638c4d 100644 --- a/packages/framework/src/HydeKernel.php +++ b/packages/framework/src/HydeKernel.php @@ -74,7 +74,7 @@ public function getBasePath(): string return $this->basePath; } - public function setBasePath(string $basePath) + public function setBasePath(string $basePath): void { $this->basePath = rtrim($basePath, '/\\'); } diff --git a/packages/framework/src/Models/Pages/MarkdownPost.php b/packages/framework/src/Models/Pages/MarkdownPost.php index 546befdeccf..a36f6fb4ff7 100644 --- a/packages/framework/src/Models/Pages/MarkdownPost.php +++ b/packages/framework/src/Models/Pages/MarkdownPost.php @@ -38,11 +38,14 @@ public function getCanonicalLink(): string } /** @deprecated v0.58.x-beta (pull description instead) */ - public function getPostDescription(): string + public function getPostDescription(): string|null { return $this->description; } + /** + * @return \Illuminate\Support\Collection<\Hyde\Framework\Models\Pages\MarkdownPost> + */ public static function getLatestPosts(): Collection { return static::all()->sortByDesc('matter.date'); diff --git a/packages/framework/src/Models/Route.php b/packages/framework/src/Models/Route.php index b116efc128f..43aaa128345 100644 --- a/packages/framework/src/Models/Route.php +++ b/packages/framework/src/Models/Route.php @@ -10,7 +10,6 @@ use Hyde\Framework\Hyde; use Hyde\Framework\Services\RoutingService; use Illuminate\Contracts\Support\Arrayable; -use Illuminate\Support\Collection; /** * @see \Hyde\Framework\Testing\Feature\RouteTest @@ -131,7 +130,7 @@ public static function getFromModel(PageContract $page): RouteContract } /** @inheritDoc */ - public static function all(): Collection + public static function all(): \Hyde\Framework\RouteCollection { return RoutingService::getInstance()->getRoutes(); } diff --git a/packages/framework/src/Models/ValidationResult.php b/packages/framework/src/Models/ValidationResult.php index dc1f00006cb..d7553295b05 100644 --- a/packages/framework/src/Models/ValidationResult.php +++ b/packages/framework/src/Models/ValidationResult.php @@ -19,7 +19,7 @@ public function __construct(string $defaultMessage = 'Generic check') $this->message = $defaultMessage; } - public function pass(?string $withMessage = null): self + public function pass(?string $withMessage = null): static { $this->passed = true; if ($withMessage) { @@ -29,7 +29,7 @@ public function pass(?string $withMessage = null): self return $this; } - public function fail(?string $withMessage = null): self + public function fail(?string $withMessage = null): static { $this->passed = false; if ($withMessage) { @@ -39,7 +39,7 @@ public function fail(?string $withMessage = null): self return $this; } - public function skip(?string $withMessage = null): self + public function skip(?string $withMessage = null): static { $this->skipped = true; if ($withMessage) { @@ -49,7 +49,7 @@ public function skip(?string $withMessage = null): self return $this; } - public function withTip(string $withTip): self + public function withTip(string $withTip): static { $this->tip = $withTip; diff --git a/packages/framework/src/Modules/DataCollections/DataCollection.php b/packages/framework/src/Modules/DataCollections/DataCollection.php index dfe3816d69e..cc8a25d36b0 100644 --- a/packages/framework/src/Modules/DataCollections/DataCollection.php +++ b/packages/framework/src/Modules/DataCollections/DataCollection.php @@ -51,7 +51,7 @@ public function getMarkdownFiles(): array * @param string $key for a subdirectory of the _data directory * @return DataCollection<\Hyde\Framework\Models\MarkdownDocument> */ - public static function markdown(string $key): DataCollection + public static function markdown(string $key): static { $collection = new DataCollection($key); foreach ($collection->getMarkdownFiles() as $file) { diff --git a/packages/framework/src/Modules/Markdown/CodeblockFilepathProcessor.php b/packages/framework/src/Modules/Markdown/CodeblockFilepathProcessor.php index 5ba4079c32c..89b0838f7e1 100644 --- a/packages/framework/src/Modules/Markdown/CodeblockFilepathProcessor.php +++ b/packages/framework/src/Modules/Markdown/CodeblockFilepathProcessor.php @@ -36,6 +36,7 @@ public static function process(string $html): string { $lines = explode("\n", $html); + /** @var int $index */ foreach ($lines as $index => $line) { if (str_starts_with($line, '