在PHP Framework Interop Group site(PSR的维护者)上,有一个PSR-8 Huggable Interface草案:
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);
}
该草案很简短,但没有提供任何实现示例。实现此接口(interface)的目的是什么?
最佳答案
正玩得开心!
查看合并日期:
这是个玩笑:)(愚人节。)
关于php - PHP和PSR-8中的HuggableInterface,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30762644/