phptools-docs
phptools-docs copied to clipboard
Ignore jetbrains/phpstorm-stubs in vendor
Hey,
some tools require jetbrains/phpstorm-stubs like roave-backward-compatiblity-check or phpstan.
These libraries in the vendor produce errors for the projects like this one:
/**
* Divide two arbitrary precision numbers
* @link https://php.net/manual/en/function.bcdiv.php
* @param string $num1 <p>
* The dividend, as a string.
* </p>
* @param string $num2 <p>
* The divisor, as a string.
* </p>
* @param int|null $scale [optional] <p>
* This optional parameter is used to set the number of digits after the
* decimal place in the result. If omitted, it will default to the scale
* set globally with the {@link bcscale()} function, or fallback to 0 if
* this has not been set.
* </p>
* @return string the result of the division as a string.
* @throws \DivisionByZeroError if <i>divisor</i> is 0. Available since PHP 8.0.
*/
#[Pure]
#[PhpStormStubsElementAvailable('8.0')]
function bcdiv(string $num1, string $num2, ?int $scale = null): string {}
/**
* Get modulus of an arbitrary precision number
* @link https://php.net/manual/en/function.bcmod.php
* @param string $num1 <p>
* The dividend, as a string. Since PHP 7.2, the divided is no longer truncated to an integer.
* </p>
* @param string $num2 <p>
* The divisor, as a string. Since PHP 7.2, the divisor is no longer truncated to an integer.
* </p>
* @param int|null $scale [optional] <p>
* This optional parameter is used to set the number of digits after the
* decimal place in the result. If omitted, it will default to the scale
* set globally with the {@link bcscale()} function, or fallback to 0 if
* this has not been set. Available since PHP 7.2.
* </p>
* @return string|null the modulus as a string, or <b>NULL</b> if
* <i>divisor</i> is 0.
*/
#[Pure]
#[PhpStormStubsElementAvailable(to: '7.4')]
function bcmod(string $num1, string $num2, ?int $scale = 0): ?string {}
it can be solved with:
"php.problems.exclude": {
"vendor/": true,
"vendor-bin/": true
}
I am fine when you want to close this, an another way could be still that globally jetbrains stubs files are ignored :thinking:
Thank you for reporting the issue.
We should be already ignoring problems in "vendor" folder (and also caching the packages in there). So php.problems.exclude should not be necessary.
~~But we're not treating custom "bin" configuration properly - is that how you create the vendor-bin folder?~~
~~EDIT: it's "config": { "bin-dir": ... } which we ignored.~~
Will be fixed!
It's not a composer thingy, it's https://github.com/bamarni/composer-bin-plugin
We have some tools installed in a separate vendor-bin, to not conflict with our general packages.
Here our example :) https://github.com/shopware/shopware/tree/trunk/vendor-bin
@shyim I see! nice :) So:
"php.problems.exclude"setting is a correct quick workaround- I think we can respect
"extra": { "bamarni-bin": { "target-directory": "vendor-bin", } }configuration
I would check that this composer package is installed, and then use vendor-bin or it's overridden by
{"extra": { "bamarni-bin": { "target-directory": "vendor-bin", } }
to really catch anything :)
btw: thanks for building this!
Thank you for the suggestions, I'm glad I can help.