Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

PHPStan autoloader mechanics invoked for case which does not use autoloading at runtime #14976

Copy link
Copy link

Description

@staabm
Issue body actions

Bug report

the PR at phpstan/phpstan-src#4003 adds a end-to-end test which fails atm.

runtime: run php real-world.php
you see the program runs, without the custom autoloader of e2e/bug-12972b/autoloader.php beeing invoked.
all involved classes are autoloaded by the composer class loader. the custom class loader is not invoked for \other12972\MyClass::class.


static analysis time: run ../../bin/phpstan analyze

you see PHPStan invokes the custom class loader for class \other12972\MyClass::class, which does not happen at regular runtime. the composer class loader is not invoked for \other12972\MyClass::class (like it is at runtime).

because of the difference in autoloading functions order in runtime vs. analysis time we see errors which cannot happen at runtime

Code snippet that reproduces the problem

No response

Expected output

phpstan should not analyze the code as if the autoloader was invoked (as we saw it isn't at runtime)

Did PHPStan help you today? Did it make you happy in any way?

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.