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
excludePaths config doesn't merge when using different styles #4561
Comments
This bug report is missing a link to reproduction on phpstan.org. It will most likely be closed after manual review. |
Until this bug is fixed, here is a dirty workaround. Here is a PHP file that loads the neon file from <?php
/**
* This file loads the PHPStan neon file from LaraStan, and rename the entry with the excluded paths.
*
* See:
* phpstan/phpstan: "excludePaths config doesn't merge when using different styles #4561"
* https://github.com/phpstan/phpstan/issues/4561
*/
use PHPStan\DependencyInjection\NeonAdapter;
# Load the neon file from LaraStan:
$neonAdapter = new NeonAdapter();
$data = $neonAdapter->load('./vendor/nunomaduro/larastan/extension.neon');
# Replace parameters.excludePaths with parameters.excludePaths.analyseAndScan:
$laraStanExcludedPaths = $data['parameters']['excludePaths'];
unset($data['parameters']['excludePaths']);
$data['parameters']['excludePaths'] = [
'analyseAndScan' => $laraStanExcludedPaths,
];
# Return the file:
return $data; The file can be included the same way neon files are included as usual: includes:
- ./phpstan_larastan_neon_loader.php |
@ZeWaren If it'll make other people's life easier and if there is no BC break, I can accept a PR to Larastan that changes this 👍 |
@canvural There's no combination Larastan can have in its extension.neon, it'd always break someone's config. I haven't thought of this scenario when I allowed multiple different notations for |
@ondrejmirtes Ah, ok. I understand now. |
Fixed: phpstan/phpstan-src@e7ac788 Feel free to test dev-master: |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
If you have one config file with
excludePaths
in one format (single level), and another config file withexcludePaths
in another format (two levels, withanalyse
andanalyseAndScan
options), you get an error that the configuration is invalid when they are used together.Code snippet that reproduces the problem
We use the Larastan extension (https://github.com/nunomaduro/larastan).
Their parameters includes the following:
Our config file looks like the following. We have some directories that we want to scan but not analyse.
This gives the following error:
Expected output
It merges the config correctly and uses
analyseAndScan
as the option for the config that is single level.The text was updated successfully, but these errors were encountered: