PHPStan started to fire warnings if no file was scanned, so tests need to contain some empty mock files

Created on 6 January 2023, almost 2 years ago
Updated 20 March 2024, 8 months ago

Problem/Motivation

Branch test started failing yesterday.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

๐Ÿ‡ญ๐Ÿ‡บHungary Gรกbor Hojtsy Hungary

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Sana.Neyazi

    I am also getting the similar issue while scanning one of my custom module,

    0 	
    PHPStan command failed:
    
    /usr/bin/php /var/www/html/voya-project/drupal-platform/vendor/bin/phpstan analyse --memory-limit=1500M --error-format=json --configuration=/tmp/upgrade_status/deprecation_testing.neon /var/www/html/voya-project/drupal-platform/docroot/modules/custom/purgatory/voya_van_migrate_content
    Command output:
    
    Empty.
    Command error:
    
    ! [NOTE] No files found to analyse. [WARNING] This will cause a non-zero exit code in PHPStan 2.0.

    Core : 9.5
    Php : 8.1

  • ๐Ÿ‡ญ๐Ÿ‡บHungary Gรกbor Hojtsy Hungary

    No .php/.module file in your module? That would be the only case this would happen.

  • ๐Ÿ‡ฒ๐Ÿ‡ฝMexico eliasdelatorre

    I do have a legacy module with no .php or .module on it.

    Is there a way of locally patch the PHPStan to disregard/ignore this error when no files are present to scan? I understand it's a stretch, but it's a special case I have to deal with. Thanks.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States alison

    I have the same issue on Features modules that don't have any custom module code, only features code/config.

    I'm wondering if ๐Ÿ› Error when module don't has a php code to review Needs work should be considered a duplicate of this -- or a follow-up to this, since this issue is closed...

    Kinda just thinking out loud. It would be nice for modules without any PHP to be skipped by PHPStan, idk what kind of a lift that is.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States alison

    Shoot, I just saw this issue is 3.x, the other one is 4.x ๐Ÿ› Error when module don't has a php code to review Needs work (and I have 4.0.0 installed) -- sorry for my confusion!

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium xaa Brussels

    hi there, same issue here when scanning the custom theme (using 8.x-3.19, php 7.4).

  • ๐Ÿ‡ช๐Ÿ‡ธSpain gmoraleb

    Hello guys,

    I have the same problem here, no .php/.module file and php 8.1:

    PHPStan command failed

    ! [NOTE] No files found to analyse. [WARNING] This will cause a non-zero exit code in PHPStan 2.0.

Production build 0.71.5 2024