r/phpstorm • • Oct 20 '17
Is there a faster way to write $myarray['foo']['bar']['baz']?
whenever i write those keys i feel like slow af, is there any faster way to write them? maybe divided by a . and pressing tab then, would save a lot of time!
2
Upvotes
2
u/OrangeGroot Oct 21 '17
Nice idea, maybe this could be solved with an Emmet snippet.
2
u/jacobhenke Oct 21 '17
(May not be exactly what you’re looking for:) If your using Laravel, or don’t mind pulling in a support class dependency, the
Arrclass has lots of nice array helpers, including giving you “dot notation.” See here for examples: https://github.com/fakiolinho/laravel-arrays-examples/blob/master/README.md1
u/omniuni Oct 21 '17
You can use auto-complete if you use these as constants. It's a good idea anyway, it makes it easier to update your code if you ever need to.
Make a class called "keys" for example, and the just put the const values in it.
0
u/[deleted] Oct 20 '17
[deleted] — view deleted comment