Here’s a question for you. Unless one is working with the PHP-FIG, how many PSRs can they list off the top of their head? Try it.
And? Three? Four? Everyone knows about PSR-0 for autoloading (now deprecated), PSR-1 and PSR-2 for coding styles, PSR-3 for logging and PSR-4 for autoloading on steroids, right?
But how many people know what PSR-5 is? Spoiler alert: it’s about caching! How many can tell if PSR-8, the Huggable Interface, is a joke or a serious attempt?
namespace Psr\Hug;
/**
* Defines a huggable object.
*
* A huggable object expresses mutual affection with another huggable object.
*/
interface Huggable
{
/**
* Hugs this object.
*
* All hugs are mutual. An object that is hugged MUST in turn hug the other
* object back by calling hug() on the first parameter. All objects MUST
* implement a mechanism to prevent an infinite loop of hugging.
*
* @param Huggable $h
* The object that is hugging this object.
*/
public function hug(Huggable $h);
}
Note: The above is an actual example from the repo. Yep. There is no facepalm strong enough.
How many can explain what PSR-10 does, and how many of you know that the PSR list is currently at 14 (!!) submissions? Granted, most of those are heavy draft phases right now - like the Hypermedia Links one, or an interesting one about the security reporting process, but still - fourteen? Even I was taken aback by the number, especially considering the political overkill that’s been plaguing PHP-FIG lately (discussion on Reddit).
Anyway, if you’d like to study the current PSRs, check this handy list out and discuss some of the most awesome or absurd ones!