Skip to content

CLI with file_cache enabled: cannot run PHPStan on phpstan-src (PHP 8.4 and 8.5) #20329

@ondrejmirtes

Description

@ondrejmirtes

Description

Steps to reproduce (at least on my machine):

OPCache configured like this:

[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.file_cache=/var/folders/7l/gnx_hkv509qbq30w2xvpsq240000gn/T/opcache-85
opcache.jit=tracing
opcache.optimization_level=0x7FFEBFFF
opcache.jit_buffer_size=128M

(the last three lines can be commented and the effect is the same). If I remove the opcache.file_cache line PHPStan finishes without any errors.

Run on the command line:

git clone https://github.com/phpstan/phpstan-src.git
cd phpstan-src
composer install
php bin/phpstan

This is the error I get most often:

 -- --------------------------------------------------------------------------
     Error
 -- --------------------------------------------------------------------------
     Internal error: Trait "Hoa\Event\Listens" not found while analysing file
     /Users/ondrej/Development/phpstan/src/Type/Regex/RegexGroupParser.php

The Hoa package is a bit outdated and weird and uses class_alias heavily so that might be what's breaking this.

Other times I get another weird error:

PHP Fatal error:  Uncaught TypeError: OndraM\CiDetector\Ci\BitbucketPipelines::isDetected(): Argument #1 ($env) must be of type OndraM\CiDetector\Env, OndraM\CiDetector\Env given, called in /Users/ondrej/Development/phpstan/vendor/ondram/ci-detector/src/CiDetector.php on line 103 and defined in /Users/ondrej/Development/phpstan/vendor/ondram/ci-detector/src/Ci/BitbucketPipelines.php:11

(when I re-run PHPStan, it fails on a different class from OndraM\CiDetector but otherwise the error message is the same)

Hopefully this is reproducible on other machines.

PHP Version

PHP 8.4.13 (cli) (built: Sep 23 2025 14:14:32) (NTS)
Copyright (c) The PHP Group
Built by Shivam Mathur
Zend Engine v4.4.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.13, Copyright (c), by Zend Technologies

PHP 8.5.0-dev (cli) (built: Oct 18 2025 21:59:48) (NTS)
Copyright (c) The PHP Group
Built by Shivam Mathur
Zend Engine v4.5.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.0-dev, Copyright (c), by Zend Technologies

Operating System

macOS 15.7.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions