refactor: move relation method handler to handlers namespace

This commit is contained in:
fiachra mcdermott 2021-06-23 06:56:13 -04:00
parent d0c27d8a0c
commit e736c88a0d
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,6 @@
<?php declare(strict_types=1);
namespace Psalm\LaravelPlugin\ReturnTypeProvider;
namespace Psalm\LaravelPlugin\Handlers\Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -22,7 +22,7 @@ use Psalm\Type;
use Psalm\Type\Union;
use function in_array;
final class RelationReturnTypeProvider implements MethodReturnTypeProviderInterface
final class RelationsMethodHandler implements MethodReturnTypeProviderInterface
{
/**
* @return array<string>

View File

@ -4,6 +4,7 @@ namespace Psalm\LaravelPlugin;
use Psalm\LaravelPlugin\Handlers\Application\ContainerHandler;
use Psalm\LaravelPlugin\Handlers\Application\OffsetHandler;
use Psalm\LaravelPlugin\Handlers\Eloquent\ModelPropertyHandler;
use Psalm\LaravelPlugin\Handlers\Eloquent\RelationsMethodHandler;
use Psalm\LaravelPlugin\Handlers\Helpers\PathHandler;
use Psalm\LaravelPlugin\Handlers\Helpers\RedirectHandler;
use Psalm\LaravelPlugin\Handlers\Helpers\TransHandler;
@ -59,6 +60,8 @@ class Plugin implements PluginEntryPointInterface
$registration->registerHooksFromClass(OffsetHandler::class);
require_once 'Handlers/Eloquent/ModelPropertyHandler.php';
$registration->registerHooksFromClass(ModelPropertyHandler::class);
require_once 'Handlers/Eloquent/RelationsMethodHandler.php';
$registration->registerHooksFromClass(RelationsMethodHandler::class);
require_once 'Handlers/Helpers/ViewHandler.php';
$registration->registerHooksFromClass(ViewHandler::class);
require_once 'Handlers/Helpers/PathHandler.php';
@ -73,8 +76,6 @@ class Plugin implements PluginEntryPointInterface
// @todo: migrate these to `Handlers` namespace
require_once 'ReturnTypeProvider/ModelReturnTypeProvider.php';
$registration->registerHooksFromClass(ModelReturnTypeProvider::class);
require_once 'ReturnTypeProvider/RelationReturnTypeProvider.php';
$registration->registerHooksFromClass(RelationReturnTypeProvider::class);
}
private function generateStubFiles(): void