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