Skip to content

Commit

Permalink
chore: add method annotations for facades
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Jan 1, 2025
1 parent 6d20a7b commit 9b9f0d1
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 181 deletions.
192 changes: 11 additions & 181 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,38 +1,13 @@
parameters:
ignoreErrors:
-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:attempt\\(\\)\\.$#"
count: 1
path: src/Actions/LoginCustomer.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:getUser\\(\\)\\.$#"
message: "#^Result of static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:isImpersonator\\(\\) \\(void\\) is used\\.$#"
count: 1
path: src/Actions/LogoutCustomer.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:isImpersonator\\(\\)\\.$#"
message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Auth\\\\UserProvider\\:\\:register\\(\\)\\.$#"
count: 1
path: src/Actions/LogoutCustomer.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:logout\\(\\)\\.$#"
count: 1
path: src/Actions/LogoutCustomer.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:stopImpersonate\\(\\)\\.$#"
count: 1
path: src/Actions/LogoutCustomer.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:getProvider\\(\\)\\.$#"
count: 1
path: src/Actions/RegisterCustomer.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:login\\(\\)\\.$#"
count: 2
path: src/Actions/RegisterCustomer.php

-
Expand All @@ -45,16 +20,6 @@ parameters:
count: 1
path: src/Auth/AuthServiceProvider.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:isAdminUser\\(\\)\\.$#"
count: 1
path: src/Auth/AuthServiceProvider.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:runningInAdmin\\(\\)\\.$#"
count: 2
path: src/Auth/AuthServiceProvider.php

-
message: "#^Method Illuminate\\\\Foundation\\\\Configuration\\\\Middleware\\:\\:redirectGuestsTo\\(\\) invoked with 2 parameters, 1 required\\.$#"
count: 1
Expand Down Expand Up @@ -225,16 +190,6 @@ parameters:
count: 1
path: src/Auth/UserProvider.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:adminUri\\(\\)\\.$#"
count: 1
path: src/Classes/RouteRegistrar.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:getUser\\(\\)\\.$#"
count: 1
path: src/Classes/UserState.php

-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
Expand All @@ -261,27 +216,7 @@ parameters:
path: src/Extension.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:registerCallback\\(\\)\\.$#"
count: 1
path: src/Extension.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\Template\\:\\:registerHook\\(\\)\\.$#"
count: 1
path: src/Extension.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:prunableModel\\(\\)\\.$#"
count: 1
path: src/Extension.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:runningInAdmin\\(\\)\\.$#"
count: 2
path: src/Extension.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:customer\\(\\)\\.$#"
message: "#^Result of static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:customer\\(\\) \\(void\\) is used\\.$#"
count: 1
path: src/Extension.php

Expand All @@ -305,51 +240,11 @@ parameters:
count: 1
path: src/Http/Controllers/CustomerGroups.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:setContext\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/CustomerGroups.php

-
message: "#^Call to an undefined method Igniter\\\\User\\\\Http\\\\Controllers\\\\Customers\\:\\:formFindModelObject\\(\\)\\.$#"
count: 2
path: src/Http/Controllers/Customers.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:setContext\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Customers.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\Template\\:\\:setButton\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Customers.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:impersonate\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Customers.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:stopImpersonate\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Customers.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\Template\\:\\:setTitle\\(\\)\\.$#"
count: 2
path: src/Http/Controllers/Login.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:attempt\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Login.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:isLogged\\(\\)\\.$#"
count: 2
path: src/Http/Controllers/Login.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Models\\\\User\\:\\:whereEmail\\(\\)\\.$#"
count: 1
Expand All @@ -361,30 +256,15 @@ parameters:
path: src/Http/Controllers/Login.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:isImpersonator\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Logout.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:logout\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Logout.php
message: "#^Result of static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:isLogged\\(\\) \\(void\\) is used\\.$#"
count: 2
path: src/Http/Controllers/Login.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:stopImpersonate\\(\\)\\.$#"
message: "#^Result of static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:isImpersonator\\(\\) \\(void\\) is used\\.$#"
count: 1
path: src/Http/Controllers/Logout.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:setContext\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/UserGroups.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:setContext\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/UserRoles.php

-
message: "#^Access to an undefined property Igniter\\\\User\\\\Models\\\\User\\:\\:\\$email\\.$#"
count: 1
Expand Down Expand Up @@ -416,65 +296,20 @@ parameters:
path: src/Http/Controllers/Users.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:setContext\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Users.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:impersonate\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Users.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:isSuperUser\\(\\)\\.$#"
message: "#^Result of static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:isSuperUser\\(\\) \\(void\\) is used\\.$#"
count: 3
path: src/Http/Controllers/Users.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:login\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Users.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:logout\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Users.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:stopImpersonate\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Users.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:runningInAdmin\\(\\)\\.$#"
count: 1
path: src/Http/Middleware/InjectImpersonateBanner.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:check\\(\\)\\.$#"
count: 1
path: src/Http/Middleware/InjectImpersonateBanner.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:isImpersonator\\(\\)\\.$#"
message: "#^Result of static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:isImpersonator\\(\\) \\(void\\) is used\\.$#"
count: 1
path: src/Http/Middleware/InjectImpersonateBanner.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:hasDatabase\\(\\)\\.$#"
count: 1
path: src/Http/Middleware/LogUserLastSeen.php

-
message: "#^Call to an undefined static method Illuminate\\\\Support\\\\Facades\\\\Event\\:\\:fire\\(\\)\\.$#"
count: 1
path: src/Http/Middleware/ThrottleRequests.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:id\\(\\)\\.$#"
count: 1
path: src/Http/Requests/UserRequest.php

-
message: "#^Access to an undefined property Igniter\\\\User\\\\Models\\\\AssignableLog\\:\\:\\$assignable\\.$#"
count: 2
Expand Down Expand Up @@ -875,11 +710,6 @@ parameters:
count: 1
path: src/Models/UserPreference.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:getUser\\(\\)\\.$#"
count: 1
path: src/Models/UserPreference.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Models\\\\UserPreference\\:\\:applyItemAndUser\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -926,8 +756,8 @@ parameters:
path: src/Notifications/AssigneeUpdatedNotification.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:user\\(\\)\\.$#"
count: 2
message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Auth\\\\Authenticatable\\:\\:getKey\\(\\)\\.$#"
count: 1
path: src/Notifications/AssigneeUpdatedNotification.php

-
Expand Down
62 changes: 62 additions & 0 deletions src/Facades/AdminAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,68 @@

use Illuminate\Support\Facades\Facade;

/**
* @method static void isLogged()
* @method static void isSuperUser()
* @method static \Igniter\User\Models\User|\Illuminate\Contracts\Auth\Authenticatable staff()
* @method static \Illuminate\Database\Eloquent\Collection locations()
* @method static void getId()
* @method static void getUserName()
* @method static void getUserEmail()
* @method static void getStaffName()
* @method static void getStaffEmail()
* @method static \Illuminate\Contracts\Auth\Authenticatable|null user()
* @method static int|string|null id()
* @method static bool once(array $credentials = [])
* @method static \Illuminate\Contracts\Auth\Authenticatable|false onceUsingId(mixed $id)
* @method static bool validate(array $credentials = [])
* @method static \Symfony\Component\HttpFoundation\Response|null basic(string $field = 'email', array $extraConditions = [])
* @method static \Symfony\Component\HttpFoundation\Response|null onceBasic(string $field = 'email', array $extraConditions = [])
* @method static bool attempt(array $credentials = [], bool $remember = false)
* @method static bool attemptWhen(array $credentials = [], array|callable|null $callbacks = null, bool $remember = false)
* @method static \Illuminate\Contracts\Auth\Authenticatable|false loginUsingId(mixed $id, bool $remember = false)
* @method static void login(\Illuminate\Contracts\Auth\Authenticatable $user, bool $remember = false)
* @method static void logout()
* @method static void logoutCurrentDevice()
* @method static \Illuminate\Contracts\Auth\Authenticatable|null logoutOtherDevices(string $password)
* @method static void attempting(mixed $callback)
* @method static \Illuminate\Contracts\Auth\Authenticatable getLastAttempted()
* @method static string getName()
* @method static string getRecallerName()
* @method static bool viaRemember()
* @method static \Igniter\User\Auth\UserGuard setRememberDuration(int $minutes)
* @method static \Illuminate\Contracts\Cookie\QueueingFactory getCookieJar()
* @method static void setCookieJar(\Illuminate\Contracts\Cookie\QueueingFactory $cookie)
* @method static \Illuminate\Contracts\Events\Dispatcher getDispatcher()
* @method static void setDispatcher(\Illuminate\Contracts\Events\Dispatcher $events)
* @method static \Illuminate\Contracts\Session\Session getSession()
* @method static \Illuminate\Contracts\Auth\Authenticatable|null getUser()
* @method static \Igniter\User\Auth\UserGuard setUser(\Illuminate\Contracts\Auth\Authenticatable $user)
* @method static \Symfony\Component\HttpFoundation\Request getRequest()
* @method static \Igniter\User\Auth\UserGuard setRequest(\Symfony\Component\HttpFoundation\Request $request)
* @method static \Illuminate\Support\Timebox getTimebox()
* @method static \Illuminate\Contracts\Auth\Authenticatable authenticate()
* @method static bool hasUser()
* @method static bool check()
* @method static bool guest()
* @method static \Igniter\User\Auth\UserGuard forgetUser()
* @method static \Illuminate\Contracts\Auth\UserProvider getProvider()
* @method static void setProvider(\Illuminate\Contracts\Auth\UserProvider $provider)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static \Illuminate\Contracts\Auth\Authenticatable|\Igniter\User\Auth\Models\User getById(void $identifier)
* @method static mixed getByToken(void $identifier, void $token)
* @method static \Illuminate\Contracts\Auth\Authenticatable|null getByCredentials(array $credentials)
* @method static void validateCredentials(\Igniter\User\Auth\Models\User $user, void $credentials)
* @method static void impersonate(\Igniter\User\Auth\Models\User $user)
* @method static void stopImpersonate()
* @method static void isImpersonator()
* @method static void getImpersonator()
*
* @see \Igniter\User\Auth\UserGuard
*/
class AdminAuth extends Facade
{
/**
Expand Down
Loading

0 comments on commit 9b9f0d1

Please sign in to comment.