When you think of the “PHP community”, what comes to mind first?
The same 50 developers on Twitter who keep arguing?
The people you meet and interact with at conferences and meetups?
Reddit’s r/php?
Forums and discussion sites like StackOverflow or SitePoint’s forum?
Maybe even the folks who send you PRs to your projects, but whom you’ve never met in real life?
All those are part of the community, and all are beneficial. Dismissing even one of those sources and underestimating the power of the community is a mistake, because you never know when one of these silos will yield useful information.
One such instance happened fairly recently, when I saw this tweet in my stream:
TIL @var docblocks also work on grouped declarations for completion pic.twitter.com/jv7gb0eBN2
— Sebastian【ツ】 (@sebdedeyne) September 20, 2016
TIL indeed!
Whenever we’ve been typing out type hinted properties one line by one line like so, in order to get our IDE to autocomplete things for us:
/* @var int */
private $something;
/* @var int */
private $somethingElse;
… we could have instead been using a single-line method like this:
/* @var int */
private $something, $somethingElse;
Talk about reducing amounts of code! Think about all those long classes with huge lists of properties that could easily shave off 50 or so lines of code with this approach!
Granted, this is a bit IDE-specific since there’s no actual standard for docblocks. After all, what one IDE does, another might be ignoring completely, but it’s still good to know. What’s more, after discussing this with some people, several of them realized they never knew you could actually declare multiple properties on the same line at all!
So this was my recent #TIL tidbit that I happened upon by accident. What was yours? Did you have a small but significant revelation in a similar way?