Show error when a function is called inside / outside of certain folders

Is there a way to, for example, make PhpStorm show an error (on the function call and for the file) when function xyx() is called in any file in any folder other than in folder abc?

Specific use case if it helps:

I want to show an error where ever I use the env() function outside of the config folder in a Laravel app - because, after running php artisan config:cache, which one does when deploying a Laravel app, all calls to env() return null, and I'm worried it's easy to accidentally use env() in my codebase rather than config()


Please sign in to leave a comment.