Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
/**
6
 * This file is part of the Carbon package.
7
 *
8
 * (c) Brian Nesbitt <brian@nesbot.com>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
 
14
namespace Carbon\PHPStan;
15
 
16
use PHPStan\BetterReflection\Reflection;
17
use ReflectionMethod;
18
 
19
if (!class_exists(AbstractReflectionMacro::class, false)) {
20
    abstract class AbstractReflectionMacro extends AbstractMacro
21
    {
22
        /**
23
         * {@inheritdoc}
24
         */
25
        public function getReflection(): ?Reflection\Adapter\ReflectionMethod
26
        {
27
            if ($this->reflectionFunction instanceof Reflection\Adapter\ReflectionMethod) {
28
                return $this->reflectionFunction;
29
            }
30
 
31
            if ($this->reflectionFunction instanceof Reflection\ReflectionMethod) {
32
                return new Reflection\Adapter\ReflectionMethod($this->reflectionFunction);
33
            }
34
 
35
            return $this->reflectionFunction instanceof ReflectionMethod
36
                ? new Reflection\Adapter\ReflectionMethod(
37
                    Reflection\ReflectionMethod::createFromName(
38
                        $this->reflectionFunction->getDeclaringClass()->getName(),
39
                        $this->reflectionFunction->getName()
40
                    )
41
                )
42
                : null;
43
        }
44
    }
45
}