WhichBrowser/Parser-PHP

Incompatability with automattic/jetpack-autoloader

vladlu opened this issue · 2 comments

I have installed automattic/jetpack-autoloader (v2.11.16) for my wordpress plugin (de-facto a standard and used by many WP plugins (WooCommerce with millions of users)).

And I have also installed your package (jeremykendall/php-domain-parser) of the latest version v2.1.7.

Your plugin has specified

"autoload": {
    "psr-4": {
        "WhichBrowser\\": [ "src/", "tests/src/" ]
    }
},

In composer.json

Which leads to error like this when I try to install the package:

Generating optimized autoload files

In ClassMapGenerator.php line 73:

Could not scan for classes inside "/home/zxc/PhpstormProjects/woosearchandfilter/web/app/plugins/first-party-analytics/vendor/whichbrowser/parser/tests/src" which does not appear to be a file nor a folder

Maybe you could suggest how can I solve this smartly?

Related discussion: #130 (comment)

Would it be an option to not autoload the tests there, since they're not shipped with the production version of the package?

Maybe something like this could work? #680

Note that I'm not familiar with this package, so this may be a bad idea. :)

@jeherve is right, that's exactly how it should be if that code is only needed during development.