Handle templates by php version#857
Closed
camilledejoye wants to merge 8 commits intophpactor:developfrom
Closed
Conversation
Reorder the templates path by priority so we can override phpactor's templates. For information it didn't seem to be the case before, we could add new templates but not override an existing one.
For each defined template path we will look for directories which name is a number of 5 digit and consider this name as a PHP version ID. For each of these directory which corresponds to a version under or equal to the current PHP version ID we will add them as a loader to Twig, ordered by ascendant version. This way we will have something like: <project_root>/.phpactor/templates <xdg_config>/phpactor/templates <app>/templates/70400 <app>/templates/70200 <app>/templates Which represent the priority in which the templates will be looked for. Easy to tests, I added `70400/Property.php.twig` in the `code-builder` packages. Override the `php.version_id` to 70200 and try to complete a constructor parameters: the properies added will have a phpdoc block if they had a type Do the same thing with `php.verion_id` to 70400: the propery will have a type and no phpdoc block
Collaborator
|
Taken over as #869 |
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.
It goes along with phpactor/code-builder#16 and need it to be merged first.
The code transform extension is still in the monolith so there is a bit of that here :)