-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ReflectionClass::getMethods filter with abstract methods and inte…
…rfaces Summary: This is a fix for #5170. I've introduced a second Set because we don't want to return abstract methods in parent classes which are implemented in the child class. Closes #5236 Reviewed By: @fredemmott Differential Revision: D2035770
- Loading branch information
1 parent
c933907
commit b786320
Showing
3 changed files
with
79 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
abstract class A { | ||
private function f() {} | ||
abstract protected function g(); | ||
abstract public function h(); | ||
} | ||
|
||
interface I { | ||
public function i(); | ||
public function j(); | ||
static function s(); | ||
} | ||
|
||
abstract class B extends A implements I { | ||
protected function g(){} | ||
public function h(){} | ||
public function j() {} | ||
} | ||
|
||
$ref = new ReflectionClass("B"); | ||
var_dump($ref->getMethods(ReflectionMethod::IS_ABSTRACT)); | ||
var_dump($ref->getMethods(ReflectionMethod::IS_STATIC)); |
25 changes: 25 additions & 0 deletions
25
hphp/test/slow/reflection/class_methods_filtered.php.expectf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
array(2) { | ||
[0]=> | ||
object(ReflectionMethod)#%d (2) { | ||
["name"]=> | ||
string(1) "i" | ||
["class"]=> | ||
string(1) "I" | ||
} | ||
[1]=> | ||
object(ReflectionMethod)#%d (2) { | ||
["name"]=> | ||
string(1) "s" | ||
["class"]=> | ||
string(1) "I" | ||
} | ||
} | ||
array(1) { | ||
[0]=> | ||
object(ReflectionMethod)#%d (2) { | ||
["name"]=> | ||
string(1) "s" | ||
["class"]=> | ||
string(1) "I" | ||
} | ||
} |