Skip to content

Commit

Permalink
Merge pull request #331 from hydephp/strongly-type-static-parser-helpers
Browse files Browse the repository at this point in the history
Improve types for helpers added in #330
  • Loading branch information
caendesilva authored Aug 4, 2022
2 parents 9fe9ea1 + 1aca556 commit 1d5a75b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/framework/src/Actions/SourceFileParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ protected function constructDynamicData(): void
$this->page->title = static::findTitleForPage($this->page, $this->slug);

if ($this->page instanceof DocumentationPage) {
$this->page->category = static::getDocumentationPageCategory($this->slug, $this->page);
$this->page->category = static::getDocumentationPageCategory($this->page, $this->slug);
}
}

public static function findTitleForPage($page, $slug): string
public static function findTitleForPage(BladePage|AbstractMarkdownPage $page, string $slug): string
{
if ($page instanceof BladePage) {
return Hyde::makeTitle($slug);
Expand All @@ -88,7 +88,7 @@ public static function findTitleForPage($page, $slug): string
return static::findTitleFromMarkdownHeadings($page) ?? Hyde::makeTitle($slug);
}

public static function findTitleFromMarkdownHeadings($page): ?string
public static function findTitleFromMarkdownHeadings(AbstractMarkdownPage $page): ?string
{
foreach ($page->markdown()->toArray() as $line) {
if (str_starts_with($line, '# ')) {
Expand All @@ -99,7 +99,7 @@ public static function findTitleFromMarkdownHeadings($page): ?string
return null;
}

public static function getDocumentationPageCategory($slug, $page): ?string
public static function getDocumentationPageCategory(DocumentationPage $page, string $slug): ?string
{
// If the documentation page is in a subdirectory,
// then we can use that as the category name.
Expand Down

0 comments on commit 1d5a75b

Please sign in to comment.