-
Notifications
You must be signed in to change notification settings - Fork 9
OPSRC-505 Support for Twigcs #13
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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])) { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
Added support for Twigcs with custom BitBag rules