ComposerRequireChecker icon indicating copy to clipboard operation
ComposerRequireChecker copied to clipboard

There were no symbols found Error

Open landwire opened this issue 4 years ago • 3 comments

Just installed this and tried it, but I get the following Error:

composer-require-checker check
ComposerRequireChecker 2.1.0@0c66698d487fcb5c66cf07108e2180c818fb2e72

In CheckCommand.php line 99:

  There were no symbols found, please check your configuration.


check [--config-file CONFIG-FILE] [--ignore-parse-errors] [--] [<composer-json>]

I have also tried it with a config file. Same result. Any ideas?

landwire avatar Oct 19 '20 09:10 landwire

@landwire do you have a composer.json with an "autoload" section?

Ocramius avatar Oct 19 '20 09:10 Ocramius

No, I don't have an autoload section. How do I know what to put in there?

landwire avatar Oct 19 '20 12:10 landwire

How are classes loaded in your project?

As for "what to put in there", see https://getcomposer.org/doc/01-basic-usage.md#autoloading

Ocramius avatar Oct 19 '20 13:10 Ocramius

I also have this question. What if composer.json does not have autoload section? In the framework I'm using web requests are routed to index.php that require __DIR__ . '/../../vendor/autoload.php'; and console scripts are started with console app that also require __DIR__ . '/vendor/autoload.php';

valieand avatar Nov 22 '22 08:11 valieand

This library is about detecting issues within your sources: no autoload section means "no sources".

It's a relatively healthy assumption.

Closing here, since there was no further feedback.

Ocramius avatar Nov 22 '22 08:11 Ocramius

The easiest way would be to add a "classmap" autoloading definition with all the paths that contain your production code. But using "PSR-4" or maybe "PSR-0" would be the preferred way. See the details in https://getcomposer.org/doc/01-basic-usage.md#autoloading and https://getcomposer.org/doc/04-schema.md#autoload

SvenRtbg avatar Nov 22 '22 10:11 SvenRtbg