barryvdh/laravel-ide-helper

Facade resolving for callStatic

fredattack opened this issue · 0 comments

Versions:

  • ide-helper Version: 2.13.0
  • Laravel Version: 9.16
  • PHP Version: 8.2

Question:

Hi,

How can I generate helpers for this kind of using, is there any way to do this? :

<?php

namespace App\Facades\Models;

use App\Services\IdentityManagerService;

class IdentityManager
{
    public static function __callStatic(string $name, array $arguments)
    {
        return self::resolve($name, $arguments);
    }

    private static function resolve(string $name, array $arguments)
    {
        return (app()->make(IdentityManagerService::class))->$name(...$arguments);
    }
}

wich resolve this class:

<?php

namespace App\Services;



class IdentityManagerService
{
    public const UNRAW_KEYS = ['account_id', 'parent_id', 'is_imported', 'hash', 'duplicate_ignore', 'bulk_identity_id'];

    /**
     * Create first parent identity and link at default identity on User
     *
     * @param array $newIdentity
     * @return Identity
     */
    public function createFirstIdentity(User $user, array $newIdentity): Identity
    {
       ...
    }
}

and is use like that:

$identity = IdentityManager::createChild(
                        parent:$parentIdentity,
                        newIdentity: $identityData,
                        account: Account::find(26)
                    );

How can i map my facade "IdentityManager" to my Service "IdentityManagerSerice"

Thx