Using proprietary classes in code? 关注
In a relatively recent update to Inttellij (or I hadn't noticed before), I've noticed certain code hints suggest things like tagging a function "pure" or using "ArrayShape" , and if I accept these suggestions I get the code additions with these added libraries:
While seemingly helpful, I'm hesitant on adding proprietary Intellij libraries to my code. What is the consensus of using these?
Those are not libraries. Those are just PHP attributes used by the IDE for more advanced code completion and analysis.
Hmmm, well the definition of those attributes aren't supplied by a library?
So what should happen if my code is loaded in a different ide with these included attributes?
It should be possible to install them via Composer as a dev dependency:
I assume this was done when I accepted the hint to use these. I just wasn't aware that they came from jetbrains until after the fact. Nbd, just curious.
Since these are attributes made by JetBrains, they come bundled in PhpStorm together with other stub files. PhpStorm knows what they are and how to handle them.
For other environments (other static analysis tools/IDEs) you would need to use that command to get them into your composer.json (as stated in https://github.com/JetBrains/phpstorm-attributes#installation, Installation section).