lightningspirit/magic-interfaces
最新稳定版本:1.1.0
Composer 安装命令:
composer require lightningspirit/magic-interfaces
包简介
Provides PHP Interfaces to test some magic methods using instanceof instead of method_exists
README 文档
README

PHP Interfaces for magic methods
This package provides interfaces that define PHP magic methods.
Using interfaces to test for existing implementations is often recognized as a best practice.
When testing objects for magic methods implementation, those interfaces can be useful.
Motivation
Instead of:
if (method_exists('__invoke', $object)) {
$object();
}
one can now write:
if ($object instanceof Invokable) {
$object();
}
Usage example
Create a class that implements some magic interfaces.
/**
* Implement some magic methods by using interfaces
*/
class Example implements Invokable, Stringifiable {
}
统计信息
- 总下载量: 28
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-14