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
Placeholders in config file doesn't seem to be supported out of parameters #2020
Comments
According to nette/di#170 (comment), it seems it should be up to the application to support it ? |
I think it must be supported by Nette itself. Anyway, I never needed this, the paths of other included configs is predictable and always the same, so relative paths from the current config file can be used. |
Agree to disagree ? I have some inclusions (I am ignore the This is what I currently have : includes:
- /home/talus/.config/composer/vendor/phpstan/phpstan-symfony/extension.neon
- /home/talus/.config/composer/vendor/phpstan/phpstan-doctrine/extension.neon
- /home/talus/.config/composer/vendor/jangregor/phpstan-prophecy/src/extension.neon So yes I can include those with the full qualified path name, but honestly, this is a pain if you ever need to share the file on a github repository (even with vendor and all, as it can vary on the setup it is used). |
@Taluu you can use a relative path from current directory, something like:
|
The thing is, as I said, it is not in the current work dir's package vendor, but in the global one (for now). So I really need to use the full qualified path. |
I can add something like |
That would be nice, but I worry that users expect to be able to expand the same parameters in |
There is chicken and egg problem. One option is to allow to use only parameters from outside (via addParameters), others will throw exception, second option is to mix parameters from outside with |
Yeah I know. Second option might lead to unexpected results - |
Yes, so it would be better to allow only the first option. |
Restricting in the |
Yeah, agreed. |
I'll add the path expanding. |
Done: 4edbe7c |
Summary of a problem or a feature request
In the config file, we should have at least these two placeholders :
%rootDir%
(directory where phpstan is installed) and%currentWorkingDirectory%
(directory from where phpstan is launched).But it seems they are only supported in
parameters
section, not theincludes
section... This could be nice to have at least%rootDir%
supported, if you install global dependency / plugins (such as the symfony one), but don't want to clutter the config file (and commit it...) with a personnal valuein my case,
/home/talus/.composer/vendor/...`).Code snippet that reproduces the problem
Neither
%currentworkingDirectory
nor%rootDir%
are resolved, as phpstan tries to load (let's say I'm triggering phpstan from/home/talus/dev/project
) :File '/home/talus/dev/project/%currentWorkingDirectory%/foo' is missing or is not readable
. Same thing for the ones with%rootDir%
.Expected output
The files are correctly loaded / included. :}
The text was updated successfully, but these errors were encountered: