Nette web-project and autoloading error
hamtil opened this issue · 4 comments
I try it but I have big trable. It is some bug?
Step by step:
- composer create-project nette/web-project
- change PHP to 7.2 in composer
- composer require --dev phpstan/phpstan-nette
- create file phpstan.neon with:
`
includes:- vendor/phpstan/phpstan-nette/extension.neon
`
- vendor/phpstan/phpstan-nette/extension.neon
- vendor/bin/phpstan analyse -l 3 -c phpstan.neon app
And get return as:
Line presenters/HomepagePresenter.php
Class App\Presenters\HomepagePresenter was not found while trying to analyse it - autoloading is probably not configured properly.
I try add to composer without effect:
"autoload": { "psr-4": { "App\\": "app/" } },
I'm not sure - my guess is the case mismatch between app/presenters and App\Presenters - the folder should be named Presenters.
Try to disable RobotLoader (and just use Composer) - you should have the same results/problems when working with your application.
Ouch, oh my god, you right. Problem is with Nette web-project or sandbox FS structure by default. :-/
Killer for beginer... I did not expect this. :-(
This should be primary solved by this project, right? Secondary change default structure FS Nette sandbox etc...
PHPStan just uses whatever autoloader you provide to it, Composer out of the box. The error message told you where to look 😊
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.