note 123830 added to reflectionclass.hasmethod
| From: | dn dot permyakov at gmail dot com | Date: | Wed, 08 May 2019 11:32:23 +0000 |
| Subject: | note 123830 added to reflectionclass.hasmethod | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210991@lists.php.net to get a copy of this message | ||
Trait methods can be seen by both actual and alias names
<?php
trait Sauce
{
public function getSpicy()
{
return 'Cayenne';
}
}
class Sandwich
{
use Sauce {
Sauce::getSpicy as getSweet;
}
}
$class = new \ReflectionClass('Sandwich');
var_dump($class->hasMethod('getSweet'));
var_dump($class->hasMethod('getSpicy'));
?>
bool(true)
bool(true)
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.142 (proxied: 2a02:a312:c545:900:9010:e074:d27b:a03e)
----
Manual Page -- http://php.net/manual/en/reflectionclass.hasmethod.php
Edit -- https://master.php.net/note/edit/123830
Del: integrated -- https://master.php.net/note/delete/123830/integrated
Del: useless -- https://master.php.net/note/delete/123830/useless
Del: bad code -- https://master.php.net/note/delete/123830/bad+code
Del: spam -- https://master.php.net/note/delete/123830/spam
Del: non-english -- https://master.php.net/note/delete/123830/non-english
Del: in docs -- https://master.php.net/note/delete/123830/in+docs
Del: other reasons-- https://master.php.net/note/delete/123830
Reject -- https://master.php.net/note/reject/123830
Search -- https://master.php.net/manage/user-notes.php