Skip to content

Instantly share code, notes, and snippets.

@shmaltorhbooks
Forked from ephrin/parent.php
Last active December 17, 2015 06:49
Show Gist options
  • Save shmaltorhbooks/5568657 to your computer and use it in GitHub Desktop.
Save shmaltorhbooks/5568657 to your computer and use it in GitHub Desktop.
Call method from parent class with unknown arguments length
<?php
class Demo extends ParentClass
{
function demoParent(...$arguments)
{
// some overrided logic
return (new \ReflectionClass(get_class($this)))
->getParentClass()
->getMethod(__METHOD__)
->invokeArgs($this, $arguments)
;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment