diff --git a/src/Console/Commands/PublishHomepageCommand.php b/src/Console/Commands/PublishHomepageCommand.php index 6a2a19dd..50b7ddb9 100644 --- a/src/Console/Commands/PublishHomepageCommand.php +++ b/src/Console/Commands/PublishHomepageCommand.php @@ -33,17 +33,17 @@ class PublishHomepageCommand extends Command /** @var array */ protected array $options = [ - 'welcome'=> [ + 'welcome' => [ 'name' => 'Welcome', 'description' => 'The default welcome page.', 'group' => 'hyde-welcome-page', ], - 'posts'=> [ + 'posts' => [ 'name' => 'Posts Feed', 'description' => 'A feed of your latest posts. Perfect for a blog site!', 'group' => 'hyde-posts-page', ], - 'blank'=> [ + 'blank' => [ 'name' => 'Blank Starter', 'description' => 'A blank Blade template with just the base layout.', 'group' => 'hyde-blank-page', diff --git a/src/Markdown/Contracts/FrontMatter/BlogPostSchema.php b/src/Markdown/Contracts/FrontMatter/BlogPostSchema.php index ad1b445e..cee053f8 100644 --- a/src/Markdown/Contracts/FrontMatter/BlogPostSchema.php +++ b/src/Markdown/Contracts/FrontMatter/BlogPostSchema.php @@ -13,11 +13,11 @@ interface BlogPostSchema extends PageSchema { public const BLOG_POST_SCHEMA = [ - 'title' => 'string', - 'description' => 'string', - 'category' => 'string', - 'date' => 'string', - 'author' => ['string', AuthorSchema::AUTHOR_SCHEMA], - 'image' => ['string', FeaturedImageSchema::FEATURED_IMAGE_SCHEMA], + 'title' => 'string', + 'description' => 'string', + 'category' => 'string', + 'date' => 'string', + 'author' => ['string', AuthorSchema::AUTHOR_SCHEMA], + 'image' => ['string', FeaturedImageSchema::FEATURED_IMAGE_SCHEMA], ]; } diff --git a/src/Markdown/Contracts/FrontMatter/PageSchema.php b/src/Markdown/Contracts/FrontMatter/PageSchema.php index a7e93c31..ac8eed79 100644 --- a/src/Markdown/Contracts/FrontMatter/PageSchema.php +++ b/src/Markdown/Contracts/FrontMatter/PageSchema.php @@ -12,8 +12,8 @@ interface PageSchema extends FrontMatterSchema { public const PAGE_SCHEMA = [ - 'title' => 'string', - 'canonicalUrl' => 'string', // While not present in the page data, it is supported as a front matter key for the accessor data source. - 'navigation' => NavigationSchema::NAVIGATION_SCHEMA, + 'title' => 'string', + 'canonicalUrl' => 'string', // While not present in the page data, it is supported as a front matter key for the accessor data source. + 'navigation' => NavigationSchema::NAVIGATION_SCHEMA, ]; } diff --git a/src/Markdown/Contracts/FrontMatter/SubSchemas/AuthorSchema.php b/src/Markdown/Contracts/FrontMatter/SubSchemas/AuthorSchema.php index a33f7649..7028cef6 100644 --- a/src/Markdown/Contracts/FrontMatter/SubSchemas/AuthorSchema.php +++ b/src/Markdown/Contracts/FrontMatter/SubSchemas/AuthorSchema.php @@ -12,8 +12,8 @@ interface AuthorSchema extends BlogPostSchema { public const AUTHOR_SCHEMA = [ - 'name' => 'string', - 'username' => 'string', - 'website' => 'string', + 'name' => 'string', + 'username' => 'string', + 'website' => 'string', ]; } diff --git a/src/Markdown/Contracts/FrontMatter/SubSchemas/FeaturedImageSchema.php b/src/Markdown/Contracts/FrontMatter/SubSchemas/FeaturedImageSchema.php index b7c41e99..ad356ee5 100644 --- a/src/Markdown/Contracts/FrontMatter/SubSchemas/FeaturedImageSchema.php +++ b/src/Markdown/Contracts/FrontMatter/SubSchemas/FeaturedImageSchema.php @@ -13,13 +13,13 @@ interface FeaturedImageSchema extends BlogPostSchema { public const FEATURED_IMAGE_SCHEMA = [ - 'source' => 'string', // Name of a file in _media/ or a remote URL (required) - 'altText' => 'string', // The alt text (important for accessibility) // todo: Support alt, description - 'titleText' => 'string', // The title text (hover tooltip & metadata) // todo: Support title, caption - 'licenseName' => 'string', // The name of the license (e.g. "CC BY 4.0") - 'licenseUrl' => 'string', // The URL of the license (e.g. "https://creativecommons.org/licenses/by/4.0/") - 'authorName' => 'string', // The name of the author/photographer of the image (e.g. "John Doe", Wikimedia Commons) - 'authorUrl' => 'string', // The URL of the author/photographer of the image (e.g. "https://commons.wikimedia.org/wiki/User:John_Doe", Wikimedia Commons) - 'copyright' => 'string', // The copyright text (e.g. "© 2023 John Doe") + 'source' => 'string', // Name of a file in _media/ or a remote URL (required) + 'altText' => 'string', // The alt text (important for accessibility) // todo: Support alt, description + 'titleText' => 'string', // The title text (hover tooltip & metadata) // todo: Support title, caption + 'licenseName' => 'string', // The name of the license (e.g. "CC BY 4.0") + 'licenseUrl' => 'string', // The URL of the license (e.g. "https://creativecommons.org/licenses/by/4.0/") + 'authorName' => 'string', // The name of the author/photographer of the image (e.g. "John Doe", Wikimedia Commons) + 'authorUrl' => 'string', // The URL of the author/photographer of the image (e.g. "https://commons.wikimedia.org/wiki/User:John_Doe", Wikimedia Commons) + 'copyright' => 'string', // The copyright text (e.g. "© 2023 John Doe") ]; } diff --git a/src/Markdown/Contracts/FrontMatter/SubSchemas/NavigationSchema.php b/src/Markdown/Contracts/FrontMatter/SubSchemas/NavigationSchema.php index ba655e2d..707c6001 100644 --- a/src/Markdown/Contracts/FrontMatter/SubSchemas/NavigationSchema.php +++ b/src/Markdown/Contracts/FrontMatter/SubSchemas/NavigationSchema.php @@ -13,9 +13,9 @@ interface NavigationSchema extends PageSchema { public const NAVIGATION_SCHEMA = [ - 'label' => 'string', // The text to display - 'priority' => 'int', // Order is also supported - 'hidden' => 'bool', // Visible is also supported (but obviously invert the value) - 'group' => 'string', // Category is also supported + 'label' => 'string', // The text to display + 'priority' => 'int', // Order is also supported + 'hidden' => 'bool', // Visible is also supported (but obviously invert the value) + 'group' => 'string', // Category is also supported ]; } diff --git a/src/Support/Filesystem/MediaFile.php b/src/Support/Filesystem/MediaFile.php index 75305b91..45298a50 100644 --- a/src/Support/Filesystem/MediaFile.php +++ b/src/Support/Filesystem/MediaFile.php @@ -70,18 +70,18 @@ public function getMimeType(): string // See if we can find a mime type for the extension instead of // having to rely on a PHP extension and filesystem lookups. $lookup = [ - 'txt' => 'text/plain', - 'md' => 'text/markdown', + 'txt' => 'text/plain', + 'md' => 'text/markdown', 'html' => 'text/html', - 'css' => 'text/css', - 'svg' => 'image/svg+xml', - 'png' => 'image/png', - 'jpg' => 'image/jpeg', + 'css' => 'text/css', + 'svg' => 'image/svg+xml', + 'png' => 'image/png', + 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', - 'gif' => 'image/gif', + 'gif' => 'image/gif', 'json' => 'application/json', - 'js' => 'application/javascript', - 'xml' => 'application/xml', + 'js' => 'application/javascript', + 'xml' => 'application/xml', ]; if (isset($lookup[$extension])) { diff --git a/src/Support/Models/RouteListItem.php b/src/Support/Models/RouteListItem.php index 2b59f50f..58afdc3f 100644 --- a/src/Support/Models/RouteListItem.php +++ b/src/Support/Models/RouteListItem.php @@ -28,10 +28,10 @@ public function __construct(Route $route) public function toArray(): array { return [ - 'page_type' => $this->stylePageType($this->route->getPageClass()), + 'page_type' => $this->stylePageType($this->route->getPageClass()), 'source_file' => $this->styleSourcePath($this->route->getSourcePath()), 'output_file' => $this->styleOutputPath($this->route->getOutputPath()), - 'route_key' => $this->styleRouteKey($this->route->getRouteKey()), + 'route_key' => $this->styleRouteKey($this->route->getRouteKey()), ]; } diff --git a/tests/Feature/MarkdownServiceTest.php b/tests/Feature/MarkdownServiceTest.php index 828d1c6b..2cb4cd42 100644 --- a/tests/Feature/MarkdownServiceTest.php +++ b/tests/Feature/MarkdownServiceTest.php @@ -93,7 +93,7 @@ public function test_raw_html_tags_are_stripped_by_default() public function test_raw_html_tags_are_not_stripped_when_explicitly_enabled() { - config(['markdown.allow_html' =>true]); + config(['markdown.allow_html' => true]); $markdown = '

foo

'; $service = new MarkdownService($markdown); $html = $service->parse(); diff --git a/tests/Feature/Support/MediaFileTest.php b/tests/Feature/Support/MediaFileTest.php index 9694028d..9b514b1c 100644 --- a/tests/Feature/Support/MediaFileTest.php +++ b/tests/Feature/Support/MediaFileTest.php @@ -75,8 +75,8 @@ public function test_to_array_returns_array_of_file_properties() $this->file('foo.txt', 'foo bar'); $this->assertSame([ - 'name' => 'foo.txt', - 'path' => 'foo.txt', + 'name' => 'foo.txt', + 'path' => 'foo.txt', 'length' => 7, 'mimeType' => 'text/plain', ], MediaFile::make('foo.txt')->toArray()); diff --git a/tests/Feature/Support/ProjectFileTest.php b/tests/Feature/Support/ProjectFileTest.php index 038883b4..e1ebb9d8 100644 --- a/tests/Feature/Support/ProjectFileTest.php +++ b/tests/Feature/Support/ProjectFileTest.php @@ -74,8 +74,8 @@ public function test_to_array_returns_array_of_file_properties() $this->file('foo.txt', 'foo bar'); $this->assertSame([ - 'name' => 'foo.txt', - 'path' => 'foo.txt', + 'name' => 'foo.txt', + 'path' => 'foo.txt', ], ProjectFileTestClass::make('foo.txt')->toArray()); } diff --git a/tests/Feature/Support/SourceFileTest.php b/tests/Feature/Support/SourceFileTest.php index 13a76c45..2b85f6e6 100644 --- a/tests/Feature/Support/SourceFileTest.php +++ b/tests/Feature/Support/SourceFileTest.php @@ -93,8 +93,8 @@ public function test_to_array_returns_array_of_file_properties() $this->file('foo.txt', 'foo bar'); $this->assertSame([ - 'name' => 'foo.txt', - 'path' => 'foo.txt', + 'name' => 'foo.txt', + 'path' => 'foo.txt', 'pageClass' => HydePage::class, ], SourceFile::make('foo.txt')->toArray()); } diff --git a/tests/Unit/BreadcrumbsComponentTest.php b/tests/Unit/BreadcrumbsComponentTest.php index 3656c1e6..c161d55b 100644 --- a/tests/Unit/BreadcrumbsComponentTest.php +++ b/tests/Unit/BreadcrumbsComponentTest.php @@ -47,7 +47,7 @@ public function testCanRender() $view = Mockery::mock(\Illuminate\View\View::class); $mock = Mockery::mock(Factory::class); $mock->shouldReceive('make')->once()->with('hyde::components.breadcrumbs')->andReturn($view); - app()->singleton('view', fn () =>$mock); + app()->singleton('view', fn () => $mock); View::swap($mock); $this->assertSame($view, (new BreadcrumbsComponent())->render()); diff --git a/tests/Unit/Pages/BaseHydePageUnitTest.php b/tests/Unit/Pages/BaseHydePageUnitTest.php index c900c38d..3d063cc9 100644 --- a/tests/Unit/Pages/BaseHydePageUnitTest.php +++ b/tests/Unit/Pages/BaseHydePageUnitTest.php @@ -37,8 +37,8 @@ protected function setUp(): void ]), 'share' => null, ])); - app()->bind(\Illuminate\Contracts\View\Factory::class, fn () =>$mock); - app()->bind('view', fn () =>$mock); + app()->bind(\Illuminate\Contracts\View\Factory::class, fn () => $mock); + app()->bind('view', fn () => $mock); Render::swap(new RenderData()); } diff --git a/tests/Unit/SchemaContractsTest.php b/tests/Unit/SchemaContractsTest.php index 3ac8a06a..9f9f6d12 100644 --- a/tests/Unit/SchemaContractsTest.php +++ b/tests/Unit/SchemaContractsTest.php @@ -45,42 +45,42 @@ class SchemaContractsTest extends UnitTestCase public function testSchemasAreNotAccidentallyChanged() { $this->assertSame([ - 'title' => 'string', - 'canonicalUrl' => 'string', - 'navigation' => NavigationSchema::NAVIGATION_SCHEMA, + 'title' => 'string', + 'canonicalUrl' => 'string', + 'navigation' => NavigationSchema::NAVIGATION_SCHEMA, ], PageSchema::PAGE_SCHEMA); $this->assertSame([ - 'label' => 'string', - 'priority' => 'int', - 'hidden' => 'bool', - 'group' => 'string', + 'label' => 'string', + 'priority' => 'int', + 'hidden' => 'bool', + 'group' => 'string', ], NavigationSchema::NAVIGATION_SCHEMA); $this->assertSame([ - 'title' => 'string', - 'description' => 'string', - 'category' => 'string', - 'date' => 'string', - 'author' => ['string', AuthorSchema::AUTHOR_SCHEMA], - 'image' => ['string', FeaturedImageSchema::FEATURED_IMAGE_SCHEMA], + 'title' => 'string', + 'description' => 'string', + 'category' => 'string', + 'date' => 'string', + 'author' => ['string', AuthorSchema::AUTHOR_SCHEMA], + 'image' => ['string', FeaturedImageSchema::FEATURED_IMAGE_SCHEMA], ], BlogPostSchema::BLOG_POST_SCHEMA); $this->assertSame([ - 'name' => 'string', - 'username' => 'string', - 'website' => 'string', + 'name' => 'string', + 'username' => 'string', + 'website' => 'string', ], AuthorSchema::AUTHOR_SCHEMA); $this->assertSame([ - 'source' => 'string', - 'altText' => 'string', - 'titleText' => 'string', - 'licenseName' => 'string', - 'licenseUrl' => 'string', - 'authorName' => 'string', - 'authorUrl' => 'string', - 'copyright' => 'string', + 'source' => 'string', + 'altText' => 'string', + 'titleText' => 'string', + 'licenseName' => 'string', + 'licenseUrl' => 'string', + 'authorName' => 'string', + 'authorUrl' => 'string', + 'copyright' => 'string', ], FeaturedImageSchema::FEATURED_IMAGE_SCHEMA); } diff --git a/tests/Unit/Views/FeaturedImageViewTest.php b/tests/Unit/Views/FeaturedImageViewTest.php index a420f626..9b3c11db 100644 --- a/tests/Unit/Views/FeaturedImageViewTest.php +++ b/tests/Unit/Views/FeaturedImageViewTest.php @@ -266,7 +266,7 @@ protected function stripWhitespace(string $string): string return str_replace([' ', "\r", "\n"], '', $string); } - protected function renderComponent(FeaturedImage|array $data = ['image.source'=>'foo']): string + protected function renderComponent(FeaturedImage|array $data = ['image.source' => 'foo']): string { $image = $data instanceof FeaturedImage ? $data : $this->make($data);