Skip to content

Commit

Permalink
Improved the Zend compatibility for ReflectionClass
Browse files Browse the repository at this point in the history
Summary: `inNamespace()`, `getNamespaceName()`, and `getShortName()` should not be `final`. This was causing issues in phpspec which mocks these methods.

This was done for ReflectionFunctionAbstract in #3070 but ReflectionClass was missed

Closes #3233

Reviewed By: @ptarjan

Differential Revision: D1445618
  • Loading branch information
svcscm authored and facebook-github-bot committed Jul 20, 2014
1 parent 4788837 commit 8c10077
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hphp/runtime/ext/reflection/ext_reflection_hni.php
Expand Up @@ -1323,7 +1323,7 @@ private function getParentName(): string;
*
* @return bool Returns TRUE on success or FALSE on failure.
*/
final public function inNamespace(): bool {
public function inNamespace(): bool {
return strrpos($this->getName(), '\\') !== false;
}

Expand All @@ -1335,7 +1335,7 @@ final public function inNamespace(): bool {
*
* @return string The namespace name.
*/
final public function getNamespaceName(): string {
public function getNamespaceName(): string {
$name = $this->getName();
$pos = strrpos($name, '\\');
return ($pos === false) ? '' : substr($name, 0, $pos);
Expand All @@ -1349,7 +1349,7 @@ final public function getNamespaceName(): string {
*
* @return string The short name of the function.
*/
final public function getShortName(): string {
public function getShortName(): string {
$name = $this->getName();
$pos = strrpos($name, '\\');
return ($pos === false) ? $name : substr($name, $pos + 1);
Expand Down

2 comments on commit 8c10077

@staabm
Copy link
Contributor

@staabm staabm commented on 8c10077 Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptarjan seems like the origin author was los

@SiebelsTim
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@staabm This currently happens to all github PRs

Please sign in to comment.