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

Use polymorphism for highlighting #21

Merged
merged 6 commits into from
Mar 28, 2020

Conversation

greg0ire
Copy link
Member

No description provided.

@greg0ire greg0ire changed the title Use polymorphism Use polymorphism for highlighting Mar 27, 2020
@greg0ire
Copy link
Member Author

Don't review yet, I'm going to simplify it further.

@greg0ire greg0ire force-pushed the use-polymorphism branch 2 times, most recently from 825a12a to adb19f2 Compare March 27, 2020 20:21
@greg0ire
Copy link
Member Author

Okay now you can review :)

goetas
goetas previously approved these changes Mar 28, 2020
Copy link
Member

@goetas goetas left a comment

Choose a reason for hiding this comment

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

to me the pr looks good, i have suggested two "bigger changes", it is up to you decide if they are worth or not (imo yes :-), especially the one on the interface )

src/Highlighter.php Outdated Show resolved Hide resolved
@@ -1187,7 +1127,7 @@ public function format(string $string, bool $highlight = true) : string
foreach ($tokens as $i => $token) {
// Get highlighted token if doing syntax highlighting
if ($highlight) {
Copy link
Member

@goetas goetas Mar 28, 2020

Choose a reason for hiding this comment

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

i believe that all this if ($highlight) conditions can be replaced by having the highlighter passed as parameter here instead of the constructor and having a NoHighlightHighlighter implementation when no highlight is needed.

@greg0ire
Copy link
Member Author

to me the pr looks good, i have suggested two "bigger changes", it is up to you decide if they are worth or not (imo yes :-), especially the one on the interface )

Definitely worth it, will look into it!

@greg0ire
Copy link
Member Author

Please approve again @goetas

@greg0ire greg0ire merged commit 7dea318 into doctrine:master Mar 28, 2020
@greg0ire greg0ire deleted the use-polymorphism branch March 28, 2020 10:07
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.

None yet

2 participants