Added testing of embedded PHP snippets#3166
Draft
mnocon wants to merge 3 commits into
Draft
Conversation
|
Preview of modified files: Too many files modified in a single PR, preview link list is skipped. (310 files > 100) |
code_samples/ change report
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This PR makes it possible to run code quality checks (PHPStan, CS-Fixer, Rector, Deptrac) on embedded PHP code samples.
Thanks to this, we no longer need to extract the code samples to separate files - they can stay within the Markdown files, making it easier to work with them, with keeping the advantage of the code quality tools.
How it works
Before a code quality tool is run, the code samples are extracted from Markdown files.
They are not extracted if:
skip-validationThe rest of the are extracted to
code_samples/_inline_phpfor the tools to pick up.When the tool can automatically fix the issue (CS-Fixer, Rector), the changes are synced back to the Markdown files.
All the existing inline code samples are marked with
skip-validation, to keep this PR small and allow us using this for new usages - the fixing of code samples will be done in a follow-up.