PSR-8 Huggable 介面

PSR-8拉里加菲爾德於 2014 年 4 月 1 日提出的愚人節笑話中提出的惡搞 PSR( 目前正在草案中 )。

草案概述瞭如何定義一個介面來建立一個物件 Huggable

程式碼大綱中的異常:

<?php

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