Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Conversation

@azjezz
Copy link

@azjezz azjezz commented Apr 5, 2019

No description provided.

@azjezz
Copy link
Author

azjezz commented Apr 5, 2019

nightly build is broken, latest ( HipHop VM 4.0.4 (rel) ) passes.

@azjezz
Copy link
Author

azjezz commented Oct 30, 2019

cc @jjergus, anything needed here ?

Copy link
Contributor

@fredemmott fredemmott left a comment

Choose a reason for hiding this comment

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

Sorry I missed this before; just one inline thing.

Other than that, it feels unnecessary, but I'm not strongly against it.

private Renderer<T> $renderer,
) {}

public static function html(bool $unsafe = false): Environment<string> {
Copy link
Contributor

Choose a reason for hiding this comment

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

In general, we consider bool parameters to be an antipattern

For this particular one, we definitely want the obvious explicit naming at the ca llers

Copy link
Contributor

Choose a reason for hiding this comment

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

This would probably also be better as a function than a static method - then new ones can be added by third-party libraries and created in a separate library

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, I think this coud be split into 2 functions, html and unsafeHtml or something like that, instead of the bool flag.

private Renderer<T> $renderer,
) {}

public static function html(bool $unsafe = false): Environment<string> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, I think this coud be split into 2 functions, html and unsafeHtml or something like that, instead of the bool flag.

return new self($parser, $context, $renderer);
}

public function setParser(ParserContext $parser): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need these getters and setters? I would definitely remove the setters at least (we don't want someone to change the context in the middle of rendering, or really at any point after it's assigned in the constructor).

@fredemmott
Copy link
Contributor

Closing due to unresolved feedback.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants