Skip to content

Instantly share code, notes, and snippets.

@0m3r
Last active July 7, 2020 17:39
Show Gist options
  • Save 0m3r/06a2fe4df78a149dd40fa3ba28ff945c to your computer and use it in GitHub Desktop.
Save 0m3r/06a2fe4df78a149dd40fa3ba28ff945c to your computer and use it in GitHub Desktop.
find class method location
$classInstance = $this;
$methodName = 'getSome';
$r = new \ReflectionMethod($classInstance, $methodName);
var_dump($r->getFileName() . ':' . $r->getStartLine() . ' - ' . $r->getEndLine());
@0m3r
Copy link
Author

0m3r commented Jul 7, 2020

$classInstance = get_parent_class($this); 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment