Skip to content

Commit

Permalink
Merge pull request #851 from hydephp/housekeeping
Browse files Browse the repository at this point in the history
Improve type coverage
  • Loading branch information
caendesilva authored Jan 21, 2023
2 parents b346c13 + 592c3fd commit 4a48814
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ protected function registerSourceDirectories(array $directoryMapping): void
}
}

/*
/**
* Register the optional output directories.
* Some HTML pages, like Blade and Markdown pages are stored right in the _site/ directory.
* However, some pages, like docs and posts are in subdirectories of the _site/ directory.
* Location string should be relative to the root of the application.
*
* @example registerOutputDirectories([HydePage::class => 'docs'])
*
* @param array $directoryMapping{class: string<HydePage>, location: string}
* @return void
* @param array $directoryMapping{class: string<HydePage>, location: string}
*/
protected function registerOutputDirectories(array $directoryMapping): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function formatOptionalAttributes(): string
return '';
}

return sprintf(' %s', collect($this->attr)->map(function ($value, $key): string {
return sprintf(' %s', collect($this->attr)->map(function (string $value, string $key): string {
return e($key).'="'.e($value).'"';
})->implode(' '));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public static function getDocumentationPageFiles(): array
* Supply a model::class constant and get a list of all the existing source file base names.
*
* @param class-string<\Hyde\Pages\Concerns\HydePage> $model
* @return array<string>
*
* @throws \Hyde\Framework\Exceptions\UnsupportedPageTypeException
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public static function render(string $html, ?array $pageData = []): string

public static function preprocess(string $markdown): string
{
return implode("\n", array_map(function ($line): string {
return implode("\n", array_map(function (string $line): string {
return str_starts_with(strtolower($line), strtolower('[Blade]:'))
? '<!-- HYDE'.trim(htmlentities($line)).' -->'
? '<!-- HYDE'.trim(e($line)).' -->'
: $line;
}, explode("\n", $markdown)));
}
Expand All @@ -54,7 +54,7 @@ public function __construct(string $html, ?array $pageData = [])

public function run(): static
{
$this->output = implode("\n", array_map(function ($line): string {
$this->output = implode("\n", array_map(function (string $line): string {
return $this->lineStartsWithDirective($line)
? $this->processLine($line)
: $line;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(string $input)

public function processInput(): static
{
$this->output = implode("\n", array_map(function ($line): string {
$this->output = implode("\n", array_map(function (string $line): string {
return $this->expandShortcode($line);
}, explode("\n", $this->input)));

Expand Down
4 changes: 2 additions & 2 deletions packages/framework/src/Pages/Concerns/HydePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public static function parse(string $identifier): HydePage
*
* Essentially an alias of DiscoveryService::getAbstractPageList().
*
* @return array<string>|false
* @return array<string>
*/
public static function files(): array|false
public static function files(): array
{
return DiscoveryService::getSourceFileListForModel(static::class);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/src/Support/Concerns/Serializable.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function jsonSerialize(): array
return $this->toArray();
}

/** @inheritDoc */
/** @param int $options */
public function toJson($options = 0): string
{
return json_encode($this->jsonSerialize(), $options);
Expand Down

0 comments on commit 4a48814

Please sign in to comment.