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

DEPTRAC_INTERNAL\___PHPSTORM_HELPERS\object #1436

Open
vudaltsov opened this issue Sep 19, 2024 · 4 comments
Open

DEPTRAC_INTERNAL\___PHPSTORM_HELPERS\object #1436

vudaltsov opened this issue Sep 19, 2024 · 4 comments

Comments

@vudaltsov
Copy link

I have "qossmic/deptrac": "^2.0.1" in my dev requirements. Every time I use the object type, PhpStorm imports DEPTRAC_INTERNAL\___PHPSTORM_HELPERS\object first. This is extremely annoying.

I understand that autocomplete is a PhpStorm issue. However I want to ask, why are you including PhpStorm stubs into the package instead of requiring jetbrains/phpstorm-stubs via composer (PhpStorm automatically removes this package from autocompletion)? And why do you prepend a custom namespace for object?

@patrickkusebauch
Copy link
Collaborator

The reason is an attempt to make deptrac non-conflicting with other dev dependencies and project transitive dependencies. You can see now that deptrac installed via composer does not have any dependencies of its own. As part of the build process, deptrac pulls all dependencies it needs and then prepends them with the custom namespace to prevent conflicts.

Personally, I am not sure how necessary this is today with https://github.com/bamarni/composer-bin-plugin, which solves this issue on Composer level by creating custom namespaces/environments for dev dependencies.

But this approach is useful for other installation methods like Phar and Phive. @dbrumann thoughts?

@jon-ht
Copy link

jon-ht commented Sep 29, 2024

If you don't want PHPStorm to suggest DEPTRAC_INTERNAL\___PHPSTORM_HELPERS\object, you can mark vendor/qossmic/deptrac/vendor as excluded

https://www.jetbrains.com/help/phpstorm/excluding-files-from-project.html

Maybe vendor/qossmic/deptrac/deptrac.phar should also be excluded, not sure about this one

@vudaltsov
Copy link
Author

@jon-ht , I know this technique and I use use it for var directory in Symfony projects. However, you cannot exclude vendor/qossmic/deptrac/vendor, because PhpStorm already automatically excludes vendor packages (see, the whole deptrac directory is yellow):

image

Even if I manually exclude the qossmic directory (so that it's red now), the autocomplete remains. Probably because PhpStorm treats vendor directory differently. I also don't want to exclude the qossmic directory, because I need autocomplete for writing custom Deptrac collectors.

@jon-ht
Copy link

jon-ht commented Sep 29, 2024

@vudaltsov Indeed, I didn't had your issue because I'm working on a mono-repo, so my path to deptrac was actually my-app/vendor/qossmic/deptrac/vendor. PHPStorm seems to only exclude root vendors by default

And what about https://www.jetbrains.com/help/phpstorm/excluding-files-from-project.html#exclude-libraries-from-indexing ? Is it what you mention with red color ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants