Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Fix return type in SectionListener#70

Merged
thewilkybarkid merged 1 commit intolibero:masterfrom
thewilkybarkid:section-list-return-type
Apr 10, 2019
Merged

Fix return type in SectionListener#70
thewilkybarkid merged 1 commit intolibero:masterfrom
thewilkybarkid:section-list-return-type

Conversation

@thewilkybarkid
Copy link
Copy Markdown
Contributor

Not currently visible in tests as

final protected function createDumpingConverter() : ViewConverter
{
return new CallbackViewConverter(
function (NonDocumentTypeChildNode $node, ?string $template = null, array $context = []) : View {
return new TemplateView(
null,
['node' => $node->getNodePath(), 'template' => $template, 'context' => $context]
);
}
);
}
returns a TemplateView. Makes me think we need a specialist type there.

@thewilkybarkid thewilkybarkid requested a review from a team as a code owner April 10, 2019 08:27
@giorgiosironi
Copy link
Copy Markdown
Contributor

createDumpingConverter could specify a stricter type in the anonymous function it uses, but currently it specifies an interface (View) rather than a concrete class instead which is a good thing. Little difference.

@thewilkybarkid
Copy link
Copy Markdown
Contributor Author

thewilkybarkid commented Apr 10, 2019

Similar to #68 and #64 (comment); might better to allow the tests to compare a normalized (JSON-like) form. So ViewConvertingTestCase::createDumpingConverter() would return a special (anonymous?) View implementation and requires using dump() to check it. (JSON-like so is similar to how Twig will read it.)

(Or reintroduce JsonSerializable.)

'content',
array_map(
function (NonDocumentTypeChildNode $child) use ($childContext) : TemplateView {
function (NonDocumentTypeChildNode $child) use ($childContext) : View {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thewilkybarkid thewilkybarkid merged commit bd93c09 into libero:master Apr 10, 2019
@thewilkybarkid thewilkybarkid deleted the section-list-return-type branch April 10, 2019 12:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants