Problem/Motivation
The logic makes assumptions about the Drupal 8 to 9 process. Let's make it work fine on Drupal 9 so we can run it at least through Drush for meaningful results.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 3201156-13.patch | 894 bytes | andypost |
Comments
Comment #2
gábor hojtsyStarting with the detection code since this would make the code useful in CI environments at least to start find Drupal 9 to 10 deprecated API use.
Comment #3
gábor hojtsyThere are still lots of UI elements, the environment check, the table formatting, etc. that are Drupal 8 to 9 specific.
Comment #5
gábor hojtsyRealized we can make an interim step and fix the logic first with tests and have useful Drush results. Fixing one problem in the logic I used and decided to move the major version logic to the project collector where the condition checking is also housed.
Comment #6
andypostI think it could use 10.x compatible preg (I mean
\d+.\d)Comment #7
gábor hojtsyGood find @andypost. Resolving #6 here and adding tests for things deprecated in 8 for 9 (existing), 8 for 10 (new), 9 for 10 (new) and 9 for 11 (new). Fixing logic for detection of category for future removals and adding tests coverage for these.
I think the combination of these should allow to run the module through drush on Drupal 9 and get the right results. At least in checkstyle output :D
Comment #8
gábor hojtsyChanging the 9 to 10 deprecation to 9.2.0 source so the 'later' category will kick in as intended (given 9.0 is still supported).
Comment #9
andypostI think here should be default because otherwise condition will use NULL and could lead to false positives
Comment #10
gábor hojtsyWhen would the major version of Drupal not be known? That would lead to various other fails in the tests :D
Comment #12
andypostThen at least it should declare that for 10 core it will return NULL instead of string which expected as second argument for version_compare and will bring issues for php 8
Comment #13
andypostHere's a small fix for UI using new method and fix to return empty string instead of null
Comment #14
andypostUsed to run on custom project and one of modules showed warning but probably it's unrelated because it used to fail before
Internal error: Interface PHPUnit\Framework\Test does not exist Run PHPStan with --debug option and post the stack trace to: https://github.com/phpstan/phpstan/issues/new?template=Bug_report.mdDebug option brings
PHP Warning: file_get_contents(): Filename cannot be empty in /var/www/html/web/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit8/ClassWriter.php on line 43 Warning: file_get_contents(): Filename cannot be empty in /var/www/html/web/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit8/ClassWriter.php on line 43 PHP Fatal error: Uncaught ReflectionException: Interface PHPUnit\Framework\Test does not exist in /var/www/html/vendor/mglaman/phpstan-drupal/src/Rules/Drupal/GlobalDrupalDependencyInjectionRule.php:50 Stack trace: #0 /var/www/html/vendor/mglaman/phpstan-drupal/src/Rules/Drupal/GlobalDrupalDependencyInjectionRule.php(50): ReflectionClass->implementsInterface() #1 phar:///var/www/html/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(69): PHPStan\Rules\Drupal\GlobalDrupalDependencyInjectionRule->processNode() #2 phar:///var/www/html/vendor/phpstan/phpstan/phpstan.phar/src/Node/ClassStatementsGatherer.php(91): PHPStan\Analyser\FileAnalyser->PHPStan\Analyser\{closure}() #3 phar:///var/www/html/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(388): PHPStan\Node\ClassStatementsGatherer->__invoke() #4 phar:///var/www/html/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1762): PHPStan\Analyser\NodeScopeResolver::PHPStan\Analyser\{closure}() #5 phar:///var/www/html/vendor/p in /var/www/html/vendor/mglaman/phpstan-drupal/src/Rules/Drupal/GlobalDrupalDependencyInjectionRule.php on line 50 Fatal error: Uncaught ReflectionException: Interface PHPUnit\Framework\Test does not exist in /var/www/html/vendor/mglaman/phpstan-drupal/src/Rules/Drupal/GlobalDrupalDependencyInjectionRule.php:50 Stack trace: #0 /var/www/html/vendor/mglaman/phpstan-drupal/src/Rules/Drupal/GlobalDrupalDependencyInjectionRule.php(50): ReflectionClass->implementsInterface() #1 phar:///var/www/html/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(69): PHPStan\Rules\Drupal\GlobalDrupalDependencyInjectionRule->processNode() #2 phar:///var/www/html/vendor/phpstan/phpstan/phpstan.phar/src/Node/ClassStatementsGatherer.php(91): PHPStan\Analyser\FileAnalyser->PHPStan\Analyser\{closure}() #3 phar:///var/www/html/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(388): PHPStan\Node\ClassStatementsGatherer->__invoke() #4 phar:///var/www/html/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1762): PHPStan\Analyser\NodeScopeResolver::PHPStan\Analyser\{closure}() #5 phar:///var/www/html/vendor/p in /var/www/html/vendor/mglaman/phpstan-drupal/src/Rules/Drupal/GlobalDrupalDependencyInjectionRule.php on line 50After installing
phpunit/phpunitI'm gettingComment #15
gábor hojtsy@andypost: you did not post the error output in the last example, only the command output. What was in /tmp/upgrade_status/phpstan_error_output? That is also logged into dblog unless you have dblog disabled.
Re the UI updates, I opened #3201336: Update Upgrade Status UI for Drupal 9 to 10 support and going to continue there.