News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Mike Purcell's Blog:
PHP - Reflection Class - Determine Parent Method Signature
July 05, 2012 @ 10:12:04

In this recent post to his blog Mike Purcell shares a method he found to discover the parameters required by a method in a class' parent via reflection.

According to PHP docs regarding the Memcached::get() method, there are three arguments which which must be added to my extended signature, which I added, but kept getting "...should be compatible with that of Memcached::get()" errors. I tried looking for the method signature via source code but didn't glean anything useful from the PECL documentation, so I turned to PHP's RelectionClass.

He includes a quick snippet of code showing how the check works and the handy output it produces - a set containing the parameter name, if it's require or optional and it's definition.

0 comments voice your opinion now!
reflection parent method signature tutorial


blog comments powered by Disqus

Similar Posts

NETTUTS.com: Building a 5 Star Rating System with jQuery, AJAX and PHP

Iwan Luijks' Blog: Using Enchant with PHP on Windows - Part 1

PHPEveryDay.com: Zend Framework Basic Tutorial

Elliot Haughin's Blog: Building UTF8 Compatible CodeIgniter Applications

Developer Tutorials Blog: PHP array_walk(): Run an array through a function


Community Events





Don't see your event here?
Let us know!


tool list library release introduction voicesoftheelephpant conference laravel language community symfony series artisanfiles framework interview podcast composer security version opinion

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework