PHP PSR-8: Huggable Interface


PSR-8 is a spoof PSR (currently in Draft) proposed by Larry Garfield as an April Fools joke on 1 April 2014.

The draft outlines how to define an interface to make an object Huggable.

Excert from the code outline:


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);