You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now the templates use to generates property use a phpdoc block to declare the type.
I would like to add a new templates that will add the type in the property declaration instead.
In order to handle multiple versions I was wondering if we could handle different templates by version.
Like adding a folder templates/7.4 for PHP 7.4 and templates/default if there is directory for the currently configured version.
We would also need to depreciate the templates/ folder without a subdirectory. So it is still used for know if templates/default does not exists.
For the PHP version itself, I think we should resolved it automatically but still provide a way to override it.
For example, I'm working with PHP 7.4 on my computer but at work the project run with PHP 7.2.
So we need to be able to override it.
It's a lot of changes so I would like to know where you stand on that matter.
I think it will be a plus to be able to add functionality in the future but I would understand if you prefer to wait for know and just let the user override the templates itself.
As for automatic -- we could dynamically include the php/$php_version set based on a php_version parameter (but default to the running version). But possibly the above could be a good start.
Ok so there is already a way to tell to twig where to look for, great!
That should do the trick, I just have to look how we handle the override of the templates directory.
I just need to make sure that <user_dir>/templates/ATemplate.twig has the priority over <phpactor>/templates/default/ATemplate.twig.
I agree for the version, we should be able to add a parameter in the configuration that we can then inject to our services.
And make the current PHP version the default if the parameter is not provided.
I'm currently working on the ClassLikeUpdater because it was coupled with the logic that we can't have a type without a phpdoc block.
And I also fix some bugs like adding a property for the first time when you already have a trait or constant declared.
There will be plenty of commits with explanation in the commit message for you to choose which one to keep in the PR.
Ok so there is already a way to tell to twig where to look for, great!
This was a suggested feature :) You can override templates but you can only put the templates globally or per project, which isn't great. Having and being able to distribute (as extensions) template sets would be good.
But on second thoughts this isn't necessarily related to what we want to do here, so just ignore that suggestion for now 👀 we can decide which default template to load, I would guess this could even be done in the extension rather in than in the library.
Activity
dantleech commentedon Dec 7, 2019
Maybe this can be facilitated by introducing template sets:
e.g.
As for automatic -- we could dynamically include the
php/$php_versionset based on aphp_versionparameter (but default to the running version). But possibly the above could be a good start.camilledejoye commentedon Dec 7, 2019
Ok so there is already a way to tell to twig where to look for, great!
That should do the trick, I just have to look how we handle the override of the templates directory.
I just need to make sure that
<user_dir>/templates/ATemplate.twighas the priority over<phpactor>/templates/default/ATemplate.twig.I agree for the version, we should be able to add a parameter in the configuration that we can then inject to our services.
And make the current PHP version the default if the parameter is not provided.
I'm currently working on the
ClassLikeUpdaterbecause it was coupled with the logic that we can't have a type without a phpdoc block.And I also fix some bugs like adding a property for the first time when you already have a trait or constant declared.
There will be plenty of commits with explanation in the commit message for you to choose which one to keep in the PR.
dantleech commentedon Dec 7, 2019
This was a suggested feature :) You can override templates but you can only put the templates globally or per project, which isn't great. Having and being able to distribute (as extensions) template sets would be good.
But on second thoughts this isn't necessarily related to what we want to do here, so just ignore that suggestion for now 👀 we can decide which default template to load, I would guess this could even be done in the extension rather in than in the library.
Cool :)