0
多分、それはバグです、わかりません。私はこのコードを実行するのはなぜphpl ReflectionClass :: getMethodsは正しい数のメソッドを返しません
:
<?php
class testReflection implements Serializable {
public function serialize() {
}
public function unserialize($data) {
}
public function getData() {
}
}
class testReflection2 implements arrayaccess {
public function offsetSet($offset, $value) {
}
public function offsetExists($offset) {
}
public function offsetUnset($offset) {
}
public function offsetGet($offset) {
}
public function getData() {
}
}
$c = new ReflectionClass('testReflection');
foreach ($c->getMethods() as $method) {
var_dump($method->name);
}
echo '========================';
$c = new ReflectionClass('testReflection2');
foreach ($c->getMethods() as $method) {
var_dump($method->name);
}
を私はこの結果を得る:インタフェースで定義されている
string(9) "serialize"
string(11) "unserialize"
string(7) "getData"
string(11) "unserialize"
string(9) "serialize"
========================
string(9) "offsetSet"
string(12) "offsetExists"
string(11) "offsetUnset"
string(9) "offsetGet"
string(7) "getData"
string(11) "offsetUnset"
string(9) "offsetSet"
string(9) "offsetGet"
string(12) "offsetExists"
メソッドが2回表示されます。バグですか?