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

API Strong typing for the view layer #1244

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

GuySartorelli
Copy link
Member

I want a good base of known types for things that will be going into the template layer before I start abstracting it, and this gets me part of the way there.

Issue

Comment on lines +604 to +612
public function forTemplate($holder = true): string
{
$templates = $this->getRenderTemplates();

if ($templates) {
return $this->renderWith($templates);
}

return null;
return '';
Copy link
Member Author

Choose a reason for hiding this comment

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

There's no parent class enforcing non-nullable values yet - but part of the next piece of work will include adding forTemplate() directly on ViewableData where its return type will be string.
There's just no reason for this method to ever return null, in comparison with an empty string.

@GuySartorelli GuySartorelli force-pushed the pulls/6/strong-typing branch from b954e7d to 7e0b590 Compare August 25, 2024 22:59
@GuySartorelli GuySartorelli marked this pull request as ready for review August 26, 2024 02:26
@emteknetnz emteknetnz merged commit d63e213 into silverstripe:6 Aug 27, 2024
24 checks passed
@emteknetnz emteknetnz deleted the pulls/6/strong-typing branch August 27, 2024 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants