Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
See aborted tests in #3261486: Remove core updates added prior to 9.3.0 and adjust test coverage.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#2 | 3261539.patch | 557 bytes | catch |
|
Comments
Comment #2
catchComment #3
SpokjeLooking at what happened in here which got the tests rolling, I say RTBC (if TestBot agrees)
Comment #4
andypost++ to get in, maybe that's a cause of why d-org infra is slow today
Comment #5
mondrakewell maybe we could skip *any* gz file, but yeah, step by step
Comment #6
mglamanWoah, phpstan is still scanning it even though the extension is .gz? That seems like a bug we should report upstream. As far as I understood it only scanned
.php
unless explicitly registered.EDIT: linking to PHPStan code
https://github.com/phpstan/phpstan-src/blob/7667265bba564eb61711ad52376a...
This is what phpstan-drupal registers
Comment #7
mondrake#6 actually I think .module and .inc files are scanned, so not sure there's a filter
Comment #9
alexpottCommitted 3b2a947 and pushed to 10.0.x. Thanks!
I think this is only occurring on partial scans where we pass the file name in. Not sure why the fileExtension configuration is not kicking in. FWIW if I add
to our config file and then remove .theme the number of files being scanned is exactly the same - 9747/9747 - odd.
Comment #10
longwave@alexpott I *think* that is because phpstan-drupal registers the extensions already, adding our own config and removing theme doesn't block phpstan-drupal from adding it. Not sure about the gz issue though!
Comment #11
catchThis is very confusing.
Comment #12
longwaveI think I can explain:
If you pass no file listing, or a directory, then PHPStan will scan that directory for files with the registered file extensions (and as far as I can see, these are combined between fileExtensions in phpstan.neon and any extensions registered by plugins such as phpstan-drupal).
If you pass an explicit filename, PHPStan will try to scan it anyway, even if it doesn't match a registered file extension.
You can confirm this with the --debug switch:
So maybe for full safety we need to ensure that the list of files passed via the script only contains the file extensions we actually want to scan?
Comment #13
mondrakeAh yes, I saw that already in the past...
excludePaths
does NOT work if you pass explicitly files on the command line. What you pass as argument takes precedence and is processed no matter what. Try passingmodules/link/tests/src/Kernel/LinkItemTest.php
, which is explicitly in excludePaths.Another argument to do full scan analysis always.
Comment #14
longwave> Another argument to do full scan analysis always.
Actually yes, because if we modify LinkItemTest in a patch, I think this will cause PHPStan to always crash, unless we add an explicit case to exclude this in the script as well.
Comment #15
alexpott@longwave
This is not right - otherwise the fix here would not work.
The issue is that in the PHPStan code...
The
$this->fileExtensions
is only used when globing... and not for theif (is_file($path)) {
- to me this is actually a bug because it is inconsistent - however I can understand the opposite argument.FWIW this works and the LinkItemTest is excluded due to
!$this->fileExcluder->isExcludedFromAnalysing($file)));
- imo that code should also check extensions to be consistent - or it should process extensions in the if.Comment #16
alexpottAlso atm
core/modules/system/tests/fixtures/HtaccessTest/access_test.module
is being scanned in the full scan because we only exclude*/tests/fixtures/*.php
Comment #17
catchOne reason it crashed very slowly rather than skipping over the gzip, is because I thought the database dumping script did the gzipping for you, and it doesn't, so the .php.gz had uncompressed PHP in it...