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

Incorrectly reporting: Called 'env' outside of the config directory which returns null when the config is cached, use 'config'. #2043

Closed
SlyDave opened this issue Sep 16, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@SlyDave
Copy link

SlyDave commented Sep 16, 2024

  • Larastan Version: 2.9.8
  • Laravel Version: 11.23.4

Description

phpstan is reporting phpstan: Called 'env' outside of the config directory which returns null when the config is cached, use 'config'.

When the call is inside a file in the config directory

config_path(); = "C:\www\<project>\config"
file = C:\www\<project>\config\filesystems.php

image

image

@SlyDave SlyDave added the bug Something isn't working label Sep 16, 2024
@szepeviktor
Copy link
Collaborator

Could be a Windows-related issue.
Try dumping values here:

return str_starts_with($scope->getFile(), config_path()) === false;

@SlyDave
Copy link
Author

SlyDave commented Sep 16, 2024

Seems to be something to do with how PHPStorm is running phpstan :(

image
image

@canvural
Copy link
Collaborator

PHPStorm can indeed act weird. Maybe it doesn't pickup the correct PHPStan config. Please re-open the issue only if it also happens when running PHPStan from cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants