- Issue created by @nitesh624
- Status changed to Postponed: needs info
10 months ago 12:46pm 21 February 2024 - 🇭🇺Hungary Gábor Hojtsy Hungary
Interesting, the module's default
.neon
file (see https://git.drupalcode.org/project/upgrade_status/-/blob/4.x/deprecation...) does not have Drupal in the parameters list and neither should the processed version have that. What is the content of the.neon
file from the error message?This one:
/tmp/upgrade_status/deprecation_testing.neon
- 🇪🇸Spain manuel garcia
I'm also facing the same issue, running drupal-check 1.4.0 and Upgrade Status 4.3.1.
Here are the contents of the neon file:
cat /tmp/upgrade_status/deprecation_testing.neon # FROM mglaman/drupal-check/phpstan/deprecation_testing.neon parameters: tmpDir: '/tmp/upgrade_status/phpstan' drupal: drupal_root: '/var/www/html/web' parallel: maximumNumberOfProcesses: 0 customRulesetUsed: true ignoreErrors: - '#\Drupal calls should be avoided in classes, use dependency injection instead#' - '#Plugin definitions cannot be altered.#' - '#Missing cache backend declaration for performance.#' - '#Plugin manager has cache backend specified but does not declare cache tags.#' # FROM mglaman/drupal-check/phpstan/base_config.neon reportUnmatchedIgnoredErrors: false excludePaths: - */tests/Drupal/Tests/Listeners/Legacy/* - */tests/fixtures/*.php - */settings*.php - */bower_components/* - */node_modules/*
- 🇪🇸Spain rodrigoaguilera Barcelona
@Manuel Garcia
Can you verify the contents of vendor/phpstan/extension-installer/src/GeneratedConfig.php
to ensure you have the drupal extension properly installed?Might be that some permissions didn't allow writing to it and it stays outdated without installing the Drupal extension for phpstan.
- 🇭🇺Hungary Gábor Hojtsy Hungary
Note that I was incorrect in February above. The generated config does indeed contain the Drupal key, we are putting it there :)
- 🇭🇺Hungary Gábor Hojtsy Hungary
In ✨ Disable ClassExtendsInternalClassRule Fixed we added the Drupal key by default to the template neon, but that template is further processed by the module to add the location of the included libraries. If the template is used without that, then the drupal key will be invalid. See DeprecationAnalyzer::createModifiedNeonFile(). Maybe something like that is happening here? If the includes cannot be added, an exception is thrown.
I noticed that the exception is only resulting in a user facing error on the UI (see top of UpgradeStatusForm::buildForm()). Unfortunately we are not surfacing environment exceptions to the Drush command which sounds like a problem :D See DeprecationAnalyzer::analyze() silently catching exceptions and UpgradeStatusCommands.php not calling initEnvironment but relying on the analyze, which silences problems.
- Merge request !96Surface PHPStan environment related exceptions from drush → (Merged) created by Gábor Hojtsy
- Status changed to Needs review
6 months ago 10:03am 8 July 2024 - 🇭🇺Hungary Gábor Hojtsy Hungary
I made an entirely untested proposal for how this could look like. I think this would (if it works) report you the real problem that results in the neon file not being correctly generated.
- 🇧🇪Belgium Robin.Houtevelts
I was having the same problem.
As #5 mentioned, I had a badvendor/phpstan/extension-installer/src/GeneratedConfig.php
.In my
composer.json
I had to enable thephpstan/extension-installer
plugin in theallow-plugins
section.My
GeneratedConfig.php
file was empty.namespace PHPStan\ExtensionInstaller; /** * This is a stub class: it is in place only for scenarios where Composer * is run with a `--no-scripts` flag, in which scenarios this stub class * is not being replaced. * * If you are reading this docBlock inside your `vendor/` dir, then this means * that phpstan/extension-installer didn't correctly install. * * @internal */ final class GeneratedConfig { public const EXTENSIONS = []; public const NOT_INSTALLED = []; public const PHPSTAN_VERSION_CONSTRAINT = null; private function __construct() { } }
After enabling the composer plugin everything works as expected.
-
gábor hojtsy →
committed 4eb126ef on 4.x
Issue #3416244: Getting unexpected item 'parameters > drupal'
-
gábor hojtsy →
committed 4eb126ef on 4.x
- 🇭🇺Hungary Gábor Hojtsy Hungary
Merged the MR to report the fail from drush so errors are surfaced earlier and in a more useful way.
- Status changed to Fixed
about 2 months ago 1:49pm 31 October 2024 Automatically closed - issue fixed for 2 weeks with no activity.