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

Nette web-project and autoloading error #37

Closed
hamtil opened this issue Feb 21, 2019 · 4 comments
Closed

Nette web-project and autoloading error #37

hamtil opened this issue Feb 21, 2019 · 4 comments

Comments

@hamtil
Copy link

hamtil commented Feb 21, 2019

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/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/" } },

@ondrejmirtes
Copy link
Member

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.

@hamtil
Copy link
Author

hamtil commented Feb 22, 2019

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...

@ondrejmirtes
Copy link
Member

PHPStan just uses whatever autoloader you provide to it, Composer out of the box. The error message told you where to look 😊

@github-actions
Copy link

github-actions bot commented May 1, 2021

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants