mirror of
https://github.com/flarum/framework.git
synced 2025-04-01 05:05:14 +08:00
![dependabot[bot]](/assets/img/avatar_default.png)
* chore(deps): bump glob-parent in /extensions/emoji/js Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 3.1.0 to 5.1.2. - [Release notes](https://github.com/gulpjs/glob-parent/releases) - [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md) - [Commits](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v5.1.2) --- updated-dependencies: - dependency-name: glob-parent dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Apply fixes from StyleCI [ci skip] [skip ci] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: StyleCI Bot <bot@styleci.io>
65 lines
1.8 KiB
PHP
65 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* This file is part of Flarum.
|
|
*
|
|
* For detailed copyright and license information, please view the
|
|
* LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Flarum\PHPStan\Methods;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use PHPStan\Reflection\ClassReflection;
|
|
use PHPStan\Reflection\MethodReflection;
|
|
use PHPStan\Reflection\MethodsClassReflectionExtension;
|
|
use PHPStan\Reflection\Php\PhpMethodReflectionFactory;
|
|
use PHPStan\Reflection\ReflectionProvider;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class Extension implements MethodsClassReflectionExtension
|
|
{
|
|
/**
|
|
* @var Kernel
|
|
*/
|
|
private $kernel;
|
|
|
|
/** @var MethodReflection[] */
|
|
private $methodReflections = [];
|
|
|
|
public function __construct(PhpMethodReflectionFactory $methodReflectionFactory, ReflectionProvider $reflectionProvider, Kernel $kernel = null)
|
|
{
|
|
$this->kernel = $kernel ?? new Kernel($methodReflectionFactory, $reflectionProvider);
|
|
}
|
|
|
|
public function hasMethod(ClassReflection $classReflection, string $methodName): bool
|
|
{
|
|
if ($classReflection->getName() === Model::class) {
|
|
return false;
|
|
}
|
|
|
|
if (array_key_exists($methodName.'-'.$classReflection->getName(), $this->methodReflections)) {
|
|
return true;
|
|
}
|
|
|
|
$passable = $this->kernel->handle($classReflection, $methodName);
|
|
|
|
$found = $passable->hasFound();
|
|
|
|
if ($found) {
|
|
$this->methodReflections[$methodName.'-'.$classReflection->getName()] = $passable->getMethodReflection();
|
|
}
|
|
|
|
return $found;
|
|
}
|
|
|
|
public function getMethod(ClassReflection $classReflection, string $methodName): MethodReflection
|
|
{
|
|
return $this->methodReflections[$methodName.'-'.$classReflection->getName()];
|
|
}
|
|
}
|