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

[BUGFIX] Fix PhpStorm code inspection warnings #770

Merged
merged 2 commits into from
Oct 1, 2019
Merged

Conversation

oliverklee
Copy link
Contributor

Fixes #729

@oliverklee oliverklee added this to the 3.0.0 milestone Oct 1, 2019
@oliverklee oliverklee self-assigned this Oct 1, 2019
Copy link
Contributor

@JakeQZ JakeQZ left a comment

Choose a reason for hiding this comment

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

Looks generally fine, but there are a couple of issues - in particular with regard maintaining support for the Emogrifier class without an autoloader.

@@ -843,7 +843,7 @@ private function normalizeStyleAttributesOfAllNodes()
private function normalizeStyleAttributes(\DOMElement $node)
{
$normalizedOriginalStyle = \preg_replace_callback(
'/[A-z\\-]+(?=\\:)/S',
'/[a-zA-Z\\-]+(?=:)/S',
Copy link
Contributor

@JakeQZ JakeQZ Oct 1, 2019

Choose a reason for hiding this comment

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

Good catch - it happened to work more by luck because : is before A in ASCII.

However, I don't think the correction is quite right - AKAIK property names may also contain underscores or numbers (though I'm not aware of any), if they are classed as CSS identifiers - the regex used in HtmlPruner::removeRedundantClassesAfterCssInlined matches a CSS identifier (after a period).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rebased, changed accordingly and repushed.

src/Emogrifier.php Show resolved Hide resolved
@@ -380,7 +380,7 @@ private function getAllNodesWithStyleAttribute()
private function normalizeStyleAttributes(\DOMElement $node)
{
$normalizedOriginalStyle = \preg_replace_callback(
'/[A-z\\-]+(?=\\:)/S',
'/[a-zA-Z\\-]+(?=:)/S',
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible issue as with the same regex in Emogrifier.

@JakeQZ
Copy link
Contributor

JakeQZ commented Oct 1, 2019

Looks generally fine, but there are a couple of issues - in particular with regard maintaining support for the Emogrifier class without an autoloader.

The autloader issue is a non-issue, but do you think the regex for property names should be updated to better match the spec?

Copy link
Contributor

@JakeQZ JakeQZ left a comment

Choose a reason for hiding this comment

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

Looks good.

@JakeQZ JakeQZ merged commit e4a15f3 into master Oct 1, 2019
@JakeQZ JakeQZ deleted the bugfix/warnings branch October 1, 2019 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix PhpStorm code inspection warnings
2 participants