Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoloader fails on '0' class #171

Open
JanMikes opened this issue Feb 3, 2020 · 1 comment
Open

Autoloader fails on '0' class #171

JanMikes opened this issue Feb 3, 2020 · 1 comment

Comments

@JanMikes
Copy link

JanMikes commented Feb 3, 2020

Hi, we are using PHPStan and we have lot of tests analysed by phpstan, with data providers, that looks like this:

yield [
    [
        'a' => '1',
        'b' => '0',
    ],
];

Since phpstan checks if class exists, it calls class_exists on strings and it throws exception Exception (Class name is empty) thrown while autoloading class 0.

While debugging i found out it is caused by the custom autoloader, here is minimal code to break things up:

<?php

require __DIR__ . '/vendor/duccio/apns-php/ApnsPHP/Autoload.php';

var_dump(class_exists('0'));

It would be nice to make this package use composer autoloader (classmaps) or PSR-4 as suggested in #135 ?

I can send PR migrating this repository to PSR-4 as i can do it automatically with rector - https://github.com/rectorphp/rector

@ondrejmirtes
Copy link

Basically this library breaks this assumption and throws an exception instead: https://3v4l.org/RIFmv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants