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 regex for gutterInjection line splitting #115

Merged

Conversation

bogdancondorachi
Copy link
Contributor

Hi there @brendt, as mentioned on #104 I have a specific scenario where gutterInjection shows only on the first line (all other cases work as expected). It seems like the issue is the way you line splitting the content using explode(PHP_EOL, $content) as it has limited flexibility when handling all line break conventions correctly.

Given this I've switched to preg_split('/\R/', trim($content)) which offers more versatility and flexibility, solving my specific scenario. From my testing, it should work in most environments and be a more reliable solution.

@brendt
Copy link
Member

brendt commented May 9, 2024

Makes sense, thanks for sending the PR 👍

@brendt brendt merged commit 8103590 into tempestphp:main May 9, 2024
4 checks passed
@brendt
Copy link
Member

brendt commented May 9, 2024

@coveralls
Copy link

Pull Request Test Coverage Report for Build 8999646164

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.285%

Totals Coverage Status
Change from base Build 8920957065: 0.0%
Covered Lines: 1455
Relevant Lines: 1527

💛 - Coveralls

@bogdancondorachi bogdancondorachi deleted the gutterInjection-line-splitting branch May 13, 2024 16:03
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.

3 participants