Skip to content

[DX] Report files with start with <?= short php tag#6075

Merged
TomasVotruba merged 9 commits intomainfrom
dx-report-start-with-short-open-tag
Jun 29, 2024
Merged

[DX] Report files with start with <?= short php tag#6075
TomasVotruba merged 9 commits intomainfrom
dx-report-start-with-short-open-tag

Conversation

@samsonasik
Copy link
Copy Markdown
Member

@samsonasik samsonasik commented Jun 29, 2024

@TomasVotruba @staabm here on progress to report files with start with <?= short php tag

Ref #6068 (comment)
Ref https://3v4l.org/tHtB2

For direct files

Screenshot 2024-06-29 at 10 21 57

For inside directory

Screenshot 2024-06-29 at 10 52 49

@samsonasik samsonasik marked this pull request as draft June 29, 2024 03:05
@samsonasik
Copy link
Copy Markdown
Member Author

implemented 🎉

@samsonasik samsonasik marked this pull request as ready for review June 29, 2024 03:22
@samsonasik
Copy link
Copy Markdown
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@staabm
Copy link
Copy Markdown
Contributor

staabm commented Jun 29, 2024

Does the problem also happen when a short open tag is used somewhere within the file?

@samsonasik
Copy link
Copy Markdown
Member Author

It only verify content file start with for safest, as in the middle can be a string

$filteredFilePaths,
fn (string $file): bool => ! $this->isStartWithShortPHPTag(FileSystem::read($file))
function (string $file): bool {
if ($this->isStartWithShortPHPTag(FileSystem::read($file))) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should have a test whether this works for files using a byte order mark (BOM)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That could be done in separate go. Care for PR? :)

@TomasVotruba TomasVotruba merged commit acfde1a into main Jun 29, 2024
@TomasVotruba TomasVotruba deleted the dx-report-start-with-short-open-tag branch June 29, 2024 06:28
@TomasVotruba
Copy link
Copy Markdown
Member

Thanks 👍

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.

4 participants