Created
May 23, 2011 22:13
-
-
Save rande/987737 to your computer and use it in GitHub Desktop.
Validation issue
This file contains hidden or 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
<?php | |
class Model | |
{ | |
protected $name = 'toto'; | |
public function getName() | |
{ | |
return $this->name; | |
} | |
} | |
class ModelProxy extends Model | |
{ | |
public function getName() | |
{ | |
var_dump('Catch'); | |
return parent::getName(); | |
} | |
} | |
$proxy = new ModelProxy; | |
var_dump($proxy->getName()); | |
$reflectionMethod = new \ReflectionMethod('Model', 'getName'); | |
var_dump($reflectionMethod->invoke($proxy)); | |
$reflectionMethod = new \ReflectionMethod('ModelProxy', 'getName'); | |
var_dump($reflectionMethod->invoke($proxy)); | |
/* | |
output : | |
string(5) "Catch" | |
string(4) "toto" | |
string(4) "toto" | |
string(5) "Catch" | |
string(4) "toto" | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment