Skip to content

Conversation

JakubWegner
Copy link
Contributor

Added support for Twigcs with custom BitBag rules

Copy link
Member

@senghe senghe left a comment

Choose a reason for hiding this comment

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

I can't verify the business compatibility of this code, but I think a set of good PHPUnit integration tests would make me reaching the point.

$violations = [];

$content = str_replace("\r", '', $tokens->getSourceContext()->getCode());
$this->htmlUtil->stripUnnecessaryTagsAndSavePositions($content);
Copy link
Member

Choose a reason for hiding this comment

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

the "and" in method tells us, it's not SRP friendly ;)

$violations = [];

$content = str_replace("\r", '', $tokens->getSourceContext()->getCode());
$this->htmlUtil->stripUnnecessaryTagsAndSavePositions($content);
Copy link
Member

Choose a reason for hiding this comment

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

Potential SRP break

$this->htmlUtil->stripUnnecessaryTagsAndSavePositions($content);

foreach ($this->getMultiLines($content) as $multiline) {
if ($this->htmlUtil->isInsideUnnecessaryTag($multiline['offset'][1])) {
Copy link
Member

Choose a reason for hiding this comment

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

the HtmlUtil class is too generic for "UnnecessaryTag". What does mean the "UnnecessaryTag"?

$this->htmlUtil = $htmlUtil;
}

public function check(TokenStream $tokens)
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason of not having return types in the check method?

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