本文整理汇总了PHP中lang\ClassLoader::defineInterface方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassLoader::defineInterface方法的具体用法?PHP ClassLoader::defineInterface怎么用?PHP ClassLoader::defineInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lang\ClassLoader
的用法示例。
在下文中一共展示了ClassLoader::defineInterface方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defineInterface
/**
* Helper method
* @param string name
* @param lang.XPClass class
* @throws unittest.AssertionFailedError
*/
protected function defineInterface($name, $parents, $bytes)
{
if (interface_exists(\xp::reflect($name), false)) {
$this->fail('Interface "' . $name . '" may not exist!');
}
return \lang\ClassLoader::defineInterface($name, $parents, $bytes);
}
示例2: allowDoubledInterfaceMethod
public function allowDoubledInterfaceMethod()
{
$this->proxyInstanceFor([$this->iteratorClass, ClassLoader::defineInterface('util.NewIterator', XPIterator::class)]);
}
示例3: define
/**
* This `define()` implementation creates interfaces
*
* @param [:var] $decl
* @param var $def
* @return lang.XPClass
*/
protected function define(array $decl = [], $def = null)
{
return $this->defineType(array_key_exists('annotations', $decl) ? $decl['annotations'] : '', array_key_exists('name', $decl) ? $decl['name'] : '', function ($spec) use($decl, $def) {
return ClassLoader::defineInterface($spec, array_key_exists('parents', $decl) ? $decl['parents'] : [], $def);
});
}
示例4: defined_interface_exists
public function defined_interface_exists()
{
ClassLoader::defineInterface('net.xp_framework.unittest.core.NamespaceAliasInterfaceFixture', [], '{}');
$this->assertTrue(interface_exists('net\\xp_framework\\unittest\\core\\NamespaceAliasInterfaceFixture', false));
}
示例5: module_implementation
public function module_implementation()
{
$cl = ClassLoader::defineInterface('net.xp_framework.unittest.reflection.IModule', []);
$this->register(new LoaderProviding(['module.xp' => '<?php module xp-framework/impl implements net\\xp_framework\\unittest\\reflection\\IModule { }']));
$this->assertTrue(in_array($cl, Module::forName('xp-framework/impl')->getClass()->getInterfaces()));
}
示例6: namespaced_parameters_handled_correctly
public function namespaced_parameters_handled_correctly()
{
$class = $this->proxyClassFor([\lang\ClassLoader::defineInterface('net.xp_framework.unittest.test.mock.NSInterface', [], '{
public function fixture(\\lang\\types\\Long $param);
}')]);
$this->assertEquals(\lang\XPClass::forName('lang.types.Long'), $class->getMethod('fixture')->getParameters()[0]->getType());
}
示例7: allowDoubledInterfaceMethod
public function allowDoubledInterfaceMethod()
{
$newIteratorClass = ClassLoader::defineInterface('util.NewIterator', 'util.XPIterator');
$this->proxyInstanceFor(array(XPClass::forName('util.XPIterator'), XPClass::forName('util.NewIterator')));
}