本文整理汇总了PHP中C::bar方法的典型用法代码示例。如果您正苦于以下问题:PHP C::bar方法的具体用法?PHP C::bar怎么用?PHP C::bar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C
的用法示例。
在下文中一共展示了C::bar方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: expectreplacedBehavior
public function expectreplacedBehavior()
{
$mock = new ClassMethodReplacementGuard();
$mock->replace('StaticMock\\MethodReplacer\\A', 'a', function () {
return 3;
});
$mock->replace('StaticMock\\MethodReplacer\\B', 'b', function () {
return 4;
});
$this->assertEquals(3, A::a());
$this->assertEquals(4, B::b());
$this->assertEquals(3, C::bar());
}
示例2: main
function main()
{
$c = new C();
$d = new D();
$c->foo();
$d->foo();
echo "**************\n";
$c->bar();
$d->bar();
echo "**************\n";
C::foo();
D::bar();
echo "**************\n";
$d->yar();
D::yar();
}
示例3: __construct
}
}
class D extends C
{
static $cls = 'D';
public function __construct()
{
var_dump(isset($this));
var_dump(static::$cls);
}
public function yar()
{
var_dump(isset($this));
var_dump(static::$cls);
C::yar();
}
}
$c = new C();
$d = new D();
echo "**************\n";
$c->foo();
$d->foo();
echo "**************\n";
$c->bar();
$d->bar();
echo "**************\n";
C::foo();
D::bar();
echo "**************\n";
$d->yar();
D::yar();
示例4: foo
<?php
interface I
{
public function foo();
}
class C implements I
{
protected function foo()
{
echo "foo\n";
}
public function bar()
{
$this->foo();
}
}
$obj = new C();
$obj->bar();
示例5: foo
<?php
trait T1
{
function foo()
{
(yield 1);
}
}
trait T2
{
use T1 {
foo as bar;
}
function foo()
{
return bar();
}
}
class C
{
use T2;
}
foreach (C::bar() as $x) {
var_dump($x);
}
示例6: doBar
public function doBar()
{
$this->bar();
// G G
B::bar();
// B B
C::bar();
// C C
D::bar();
// D D
F::bar();
// F F
G::bar();
// G G
H::bar();
// H H
parent::bar();
// F G
self::bar();
// G G
static::bar();
// G G
echo "****************\n";
}