Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace schema traits with interface constants #485

Merged
merged 53 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
5274232
Create PageSchema.php
caendesilva Sep 9, 2022
d94d73b
Update AbstractPage.php
caendesilva Sep 9, 2022
af8defe
Update PageSchema.php
caendesilva Sep 9, 2022
80cdeb2
Update PageSchema.php
caendesilva Sep 9, 2022
7336fbe
Update PageSchema.php
caendesilva Sep 9, 2022
1dcbd06
Inline schema trait
caendesilva Sep 9, 2022
85b7f88
Delete PageSchema.php
caendesilva Sep 9, 2022
c85aed9
Apply fixes from StyleCI
StyleCIBot Sep 9, 2022
f3843cc
Update PageSchema.php
caendesilva Sep 9, 2022
5e093dc
Update ConstructsPageSchemas.php
caendesilva Sep 9, 2022
6bd6b61
Update PageSchema.php
caendesilva Sep 9, 2022
2f50ef5
Create BlogPostSchema.php
caendesilva Sep 9, 2022
6926729
Implement BlogPostSchema
caendesilva Sep 9, 2022
f2d9034
Inline schema trait
caendesilva Sep 9, 2022
179714a
Delete BlogPostSchema.php
caendesilva Sep 9, 2022
3b4bb9d
Update BlogPostSchema.php
caendesilva Sep 9, 2022
bbeff7c
Remove examples and descriptions
caendesilva Sep 9, 2022
b1b366c
Add image array values
caendesilva Sep 9, 2022
fe16936
Format array
caendesilva Sep 9, 2022
f850eee
Update PageSchema.php
caendesilva Sep 9, 2022
2876bef
Delete BlogPostSchema.json
caendesilva Sep 9, 2022
9bba55d
Delete BlogPostSchema.yml
caendesilva Sep 9, 2022
4ffaa73
Delete README.md
caendesilva Sep 9, 2022
363e18d
Apply fixes from StyleCI
StyleCIBot Sep 9, 2022
a646a57
Update ConstructsPageSchemas.php
caendesilva Sep 9, 2022
0e473bd
Inline schema trait
caendesilva Sep 9, 2022
526d102
Make PHPDocs compact
caendesilva Sep 9, 2022
eefffb9
Remove schema trait usage
caendesilva Sep 9, 2022
611dc52
Delete DocumentationPageSchema.php
caendesilva Sep 9, 2022
4364d6e
Create DocumentationPageSchema.php
caendesilva Sep 9, 2022
d8186b2
Implement DocumentationPageSchema
caendesilva Sep 9, 2022
4b0260d
Use the schema interfaces
caendesilva Sep 9, 2022
3167668
Fix syntax error
caendesilva Sep 9, 2022
d8a2c7c
Unwrap if where result of 'instanceof' is always 'true''
caendesilva Sep 9, 2022
34e7eca
Delete Schemas.php
caendesilva Sep 9, 2022
52c9826
Delete SchemasClassTest.php
caendesilva Sep 9, 2022
5e6321e
Update AbstractPageTest.php
caendesilva Sep 9, 2022
df1516d
Apply fixes from StyleCI
StyleCIBot Sep 9, 2022
316c153
Update MarkdownPostTest.php
caendesilva Sep 9, 2022
85aefb2
Extract featured image subschema
caendesilva Sep 9, 2022
dd3f845
Extract author subschema
caendesilva Sep 9, 2022
cc6cc1b
Extract navigation subschema
caendesilva Sep 9, 2022
087d993
Format array
caendesilva Sep 9, 2022
ab85866
Format array
caendesilva Sep 9, 2022
8c6b644
Format array
caendesilva Sep 9, 2022
b189562
Format array
caendesilva Sep 9, 2022
2a4a542
Add interface documentation
caendesilva Sep 9, 2022
038f6bd
Create SchemaContractsTest.php
caendesilva Sep 9, 2022
6b8582b
Apply fixes from StyleCI
StyleCIBot Sep 9, 2022
952b7e2
Replace interface covers with see
caendesilva Sep 9, 2022
4bc5fe5
Merge branch 'rewrite-schemas' of github.com:hydephp/develop into rew…
caendesilva Sep 9, 2022
f0d354f
Reorder array
caendesilva Sep 9, 2022
f00be08
Update RELEASE_NOTES.md
caendesilva Sep 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ In general, these changes should only affect those who have written custom code
- Renamed HydeBuildStaticSiteCommand to HydeBuildSiteCommand
- Renamed legacy FileCacheService to ViewDiffService
- Renamed method `Hyde::getSiteOutputPath()` to `Hyde::sitePath()`
- Replaced schema traits with interfaces, see https://github.com/hydephp/develop/pull/485
- Extracted all constructor methods in page schema traits to a new single trait ConstructPageSchemas
- The `StaticPageBuilder::$outputPath` property is now a relative path instead of absolute

### Deprecated
- for soon-to-be removed features.

### Removed
- Removed all experimental schema traits
- Removed interface IncludeFacadeContract
- Removed deprecated interface AssetServiceContract
- Removed deprecated interface HydeKernelContract
Expand Down
9 changes: 6 additions & 3 deletions packages/framework/src/Concerns/AbstractPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Hyde\Framework\Concerns;

use Hyde\Framework\Actions\SourceFileParser;
use Hyde\Framework\Concerns\FrontMatter\Schemas\PageSchema;
use Hyde\Framework\Contracts\CompilableContract;
use Hyde\Framework\Contracts\FrontMatter\PageSchema;
use Hyde\Framework\Contracts\PageContract;
use Hyde\Framework\Foundation\PageCollection;
use Hyde\Framework\Hyde;
Expand All @@ -29,9 +29,8 @@
* @see \Hyde\Framework\Concerns\AbstractMarkdownPage
* @see \Hyde\Framework\Testing\Feature\AbstractPageTest
*/
abstract class AbstractPage implements PageContract, CompilableContract
abstract class AbstractPage implements PageContract, CompilableContract, PageSchema
{
use PageSchema;
use ConstructsPageSchemas;

public static string $sourceDirectory;
Expand All @@ -45,6 +44,10 @@ abstract class AbstractPage implements PageContract, CompilableContract
public FrontMatter $matter;
public Metadata $metadata;

public string $title;
public ?array $navigation = null;
public ?string $canonicalUrl = null;

public function __construct(string $identifier = '', FrontMatter|array $matter = [])
{
$this->identifier = $identifier;
Expand Down
18 changes: 5 additions & 13 deletions packages/framework/src/Concerns/ConstructsPageSchemas.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

use Hyde\Framework\Actions\Constructors\FindsNavigationDataForPage;
use Hyde\Framework\Actions\Constructors\FindsTitleForPage;
use Hyde\Framework\Concerns\FrontMatter\Schemas\BlogPostSchema;
use Hyde\Framework\Concerns\FrontMatter\Schemas\DocumentationPageSchema;
use Hyde\Framework\Concerns\FrontMatter\Schemas\PageSchema;
use Hyde\Framework\Contracts\FrontMatter\BlogPostSchema;
use Hyde\Framework\Contracts\FrontMatter\DocumentationPageSchema;
use Hyde\Framework\Hyde;
use Hyde\Framework\Models\Author;
use Hyde\Framework\Models\DateString;
Expand All @@ -17,15 +16,13 @@ trait ConstructsPageSchemas
{
protected function constructPageSchemas(): void
{
if ($this->usesSchema(PageSchema::class)) {
$this->constructPageSchema();
}
$this->constructPageSchema();

if ($this->usesSchema(BlogPostSchema::class)) {
if ($this instanceof BlogPostSchema) {
$this->constructBlogPostSchema();
}

if ($this->usesSchema(DocumentationPageSchema::class)) {
if ($this instanceof DocumentationPageSchema) {
$this->constructDocumentationPageSchema();
}
}
Expand Down Expand Up @@ -120,9 +117,4 @@ protected function findPriorityInConfig(): int
// can be shown first. It's lower than the fallback of 500 so that they
// still come first. This is all to make it easier to mix priorities.
}

protected function usesSchema(string $schema): bool
{
return in_array($schema, class_uses_recursive($this));
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading