friendship ended with social-app. php is my new best friend
at main 860 B view raw
1<?php 2 3/** 4 * This file is part of the Nette Framework (https://nette.org) 5 * Copyright (c) 2004 David Grudl (https://davidgrudl.com) 6 */ 7 8declare(strict_types=1); 9 10namespace Nette\Utils; 11 12use function explode, is_string, str_contains; 13 14 15/** 16 * ReflectionMethod preserving the original class name. 17 * @internal 18 */ 19final class ReflectionMethod extends \ReflectionMethod 20{ 21 private \ReflectionClass $originalClass; 22 23 24 public function __construct(object|string $objectOrMethod, ?string $method = null) 25 { 26 if (is_string($objectOrMethod) && str_contains($objectOrMethod, '::')) { 27 [$objectOrMethod, $method] = explode('::', $objectOrMethod, 2); 28 } 29 parent::__construct($objectOrMethod, $method); 30 $this->originalClass = new \ReflectionClass($objectOrMethod); 31 } 32 33 34 public function getOriginalClass(): \ReflectionClass 35 { 36 return $this->originalClass; 37 } 38}