From b213a8b7d170a99c6df2a84b5739c27b474a481c Mon Sep 17 00:00:00 2001 From: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> Date: Wed, 1 Jan 2025 03:27:19 +0000 Subject: [PATCH] chore: add method annotations for facades Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> --- phpstan-baseline.neon | 116 +++------------------------------------ src/Facades/Location.php | 79 ++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 108 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f468233..ff15f1d 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -6,27 +6,12 @@ parameters: path: database/migrations/2020_09_17_000300_create_reviews_table_or_rename.php - - message: "#^Call to an undefined static method Igniter\\\\Cart\\\\Facades\\\\Cart\\:\\:subtotal\\(\\)\\.$#" + message: "#^Result of static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:orderType\\(\\) \\(void\\) is used\\.$#" count: 1 path: src/CartConditions/Delivery.php - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:coveredArea\\(\\)\\.$#" - count: 1 - path: src/CartConditions/Delivery.php - - - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:orderType\\(\\)\\.$#" - count: 1 - path: src/CartConditions/Delivery.php - - - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:checkDistance\\(\\)\\.$#" - count: 1 - path: src/Classes/CoveredArea.php - - - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:userPosition\\(\\)\\.$#" + message: "#^Result of static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:checkDistance\\(\\) \\(void\\) is used\\.$#" count: 1 path: src/Classes/CoveredArea.php @@ -190,31 +175,6 @@ parameters: count: 1 path: src/Classes/WorkingTimeslot.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\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:geocode\\(\\)\\.$#" - 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\\\\Local\\\\Facades\\\\Location\\:\\:updateNearbyArea\\(\\)\\.$#" - count: 1 - path: src/Extension.php - - - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:updateUserPosition\\(\\)\\.$#" - count: 1 - path: src/Extension.php - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Models\\\\LocationArea\\:\\:find\\(\\)\\.$#" count: 1 @@ -260,11 +220,6 @@ parameters: count: 1 path: src/Http/Actions/LocationAwareController.php - - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:currentOrAssigned\\(\\)\\.$#" - count: 1 - path: src/Http/Actions/LocationAwareController.php - - message: "#^Call to an undefined method Igniter\\\\Local\\\\Http\\\\Controllers\\\\Locations\\:\\:getFormModel\\(\\)\\.$#" count: 1 @@ -275,41 +230,11 @@ parameters: count: 1 path: src/Http/Controllers/Locations.php - - - message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:setContext\\(\\)\\.$#" - count: 1 - path: src/Http/Controllers/Locations.php - - message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:getRatingOptions\\(\\)\\.$#" count: 1 path: src/Http/Controllers/Reviews.php - - - message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:setContext\\(\\)\\.$#" - count: 1 - path: src/Http/Controllers/Reviews.php - - - - message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:hasDatabase\\(\\)\\.$#" - count: 1 - path: src/Http/Middleware/CheckLocation.php - - - - message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:runningInAdmin\\(\\)\\.$#" - count: 2 - path: src/Http/Middleware/CheckLocation.php - - - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:current\\(\\)\\.$#" - count: 1 - path: src/Http/Middleware/CheckLocation.php - - - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:currentOrDefault\\(\\)\\.$#" - count: 1 - path: src/Http/Middleware/CheckLocation.php - - message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:check\\(\\)\\.$#" count: 1 @@ -346,17 +271,17 @@ parameters: path: src/Http/Requests/ReviewRequest.php - - message: "#^Call to an undefined static method Igniter\\\\Cart\\\\Models\\\\Order\\:\\:where\\(\\)\\.$#" + message: "#^Call to an undefined method Igniter\\\\Local\\\\Contracts\\\\LocationInterface\\:\\:getOrderTimeInterval\\(\\)\\.$#" count: 1 path: src/Listeners/MaxOrderPerTimeslotReached.php - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:current\\(\\)\\.$#" - count: 1 + message: "#^Call to an undefined method Igniter\\\\Local\\\\Contracts\\\\LocationInterface\\:\\:getSettings\\(\\)\\.$#" + count: 2 path: src/Listeners/MaxOrderPerTimeslotReached.php - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:getId\\(\\)\\.$#" + message: "#^Call to an undefined static method Igniter\\\\Cart\\\\Models\\\\Order\\:\\:where\\(\\)\\.$#" count: 1 path: src/Listeners/MaxOrderPerTimeslotReached.php @@ -366,22 +291,12 @@ parameters: path: src/MainMenuWidgets/LocationPicker.php - - message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:getLogs\\(\\)\\.$#" - count: 1 - path: src/MainMenuWidgets/LocationPicker.php - - - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:current\\(\\)\\.$#" - count: 2 - path: src/MainMenuWidgets/LocationPicker.php - - - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:resetSession\\(\\)\\.$#" + message: "#^Call to an undefined method Igniter\\\\Local\\\\Contracts\\\\LocationInterface\\:\\:getKey\\(\\)\\.$#" count: 1 path: src/MainMenuWidgets/LocationPicker.php - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:setCurrent\\(\\)\\.$#" + message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:getLogs\\(\\)\\.$#" count: 1 path: src/MainMenuWidgets/LocationPicker.php @@ -540,11 +455,6 @@ parameters: count: 2 path: src/Models/Location.php - - - message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:geocode\\(\\)\\.$#" - count: 1 - path: src/Models/Location.php - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Models\\\\Location\\:\\:whereIsEnabled\\(\\)\\.$#" count: 1 @@ -575,11 +485,6 @@ parameters: count: 2 path: src/Models/LocationArea.php - - - message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:reverse\\(\\)\\.$#" - count: 1 - path: src/Models/LocationArea.php - - message: "#^Access to an undefined property Igniter\\\\Local\\\\Models\\\\LocationSettings\\:\\:\\$data\\.$#" count: 2 @@ -665,11 +570,6 @@ parameters: count: 1 path: src/Models/Review.php - - - message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:runningInAdmin\\(\\)\\.$#" - count: 1 - path: src/Models/Review.php - - message: "#^Call to an undefined static method Igniter\\\\Local\\\\Models\\\\Review\\:\\:whereReviewable\\(\\)\\.$#" count: 1 diff --git a/src/Facades/Location.php b/src/Facades/Location.php index 8498f71..dc06200 100644 --- a/src/Facades/Location.php +++ b/src/Facades/Location.php @@ -4,6 +4,85 @@ use Illuminate\Support\Facades\Facade; +/** + * @method static string|null resolveLocationSlug() + * @method static void locationSlugResolver(\Closure $resolver) + * @method static bool check() + * @method static \Igniter\Local\Contracts\LocationInterface|null current() + * @method static \Igniter\Local\Contracts\LocationInterface|null currentOrDefault() + * @method static array currentOrAssigned() + * @method static void setCurrent(\Igniter\Local\Contracts\LocationInterface $locationModel) + * @method static \Igniter\Local\Contracts\LocationInterface|null getModel() + * @method static \Igniter\Local\Classes\Location setModel(\Igniter\Local\Contracts\LocationInterface $model) + * @method static int|null getId() + * @method static string|null getName() + * @method static \Igniter\Local\Contracts\LocationInterface createLocationModel() + * @method static void extendLocationQuery(\Illuminate\Database\Eloquent\Builder $query) + * @method static \Igniter\Local\Contracts\LocationInterface|null getById(string|int $identifier) + * @method static \Igniter\Local\Contracts\LocationInterface|null getBySlug(string $slug) + * @method static void clearInternalCache() + * @method static void updateOrderType(void $code = null) + * @method static void orderType() + * @method static void checkOrderType(void $code = null) + * @method static \Igniter\Cart\Classes\AbstractOrderType getOrderType(void $code = null) + * @method static void getOrderTypes() + * @method static void orderTypeIsDelivery() + * @method static void orderTypeIsCollection() + * @method static void hasOrderType(void $code = null) + * @method static void getActiveOrderTypes() + * @method static void updateScheduleTimeSlot(void $dateTime, void $isAsap = null) + * @method static void openingSchedule() + * @method static void deliverySchedule() + * @method static void collectionSchedule() + * @method static void openTime(void $type = null, void $format = null) + * @method static void closeTime(void $type = null, void $format = null) + * @method static void lastOrderTime() + * @method static void checkOrderTime(void $timestamp = null, void $orderTypeCode = null) + * @method static \Carbon\Carbon orderDateTime() + * @method static void orderTimeIsAsap() + * @method static void hasAsapSchedule() + * @method static void isOpened() + * @method static void asapScheduleTimeslot() + * @method static void isClosed() + * @method static void firstScheduleTimeslot() + * @method static void scheduleTimeslot(void $orderType = null) + * @method static void orderLeadTime() + * @method static void orderTimeInterval() + * @method static void checkNoOrderTypeAvailable() + * @method static void hasLaterSchedule() + * @method static \Igniter\Local\Classes\WorkingSchedule workingSchedule(string $type, array|int|null $days = null) + * @method static void updateNearbyArea(\Igniter\Local\Contracts\AreaInterface $area) + * @method static void setCoveredArea(\Igniter\Local\Classes\CoveredArea $coveredArea) + * @method static void updateUserPosition(\Igniter\Flame\Geolite\Model\Location $position) + * @method static void clearCoveredArea() + * @method static void requiresUserPosition() + * @method static void isCurrentAreaId(void $areaId) + * @method static void getAreaId() + * @method static \Igniter\Local\Classes\CoveredArea coveredArea() + * @method static \Igniter\Flame\Geolite\Model\Location userPosition() + * @method static void deliveryAreas() + * @method static void deliveryAmount(void $cartTotal) + * @method static void minimumOrderTotal(void $orderType = null) + * @method static void getDeliveryChargeConditions() + * @method static void checkMinimumOrderTotal(void $cartTotal, void $orderType = null) + * @method static void checkDistance() + * @method static void checkDeliveryCoverage(\Igniter\Flame\Geolite\Model\Location|null $userPosition = null) + * @method static \Illuminate\Support\Collection searchByCoordinates(\Igniter\Flame\Geolite\Contracts\CoordinatesInterface $coordinates, int $limit = 20) + * @method static \Igniter\Local\Classes\Location bindEvent(string $event, callable $callback, int $priority = 0) + * @method static \Igniter\Local\Classes\Location bindEventOnce(string $event, callable $callback) + * @method static \Igniter\Local\Classes\Location unbindEvent(string|null $event = null) + * @method static mixed fireEvent(string $event, array $params = [], bool $halt = false) + * @method static mixed fireSystemEvent(string $event, array $params = [], bool $halt = true) + * @method static mixed getSession(string|null $key = null, mixed $default = null) + * @method static void putSession(string $key, mixed $value) + * @method static bool hasSession(string $key) + * @method static void flashSession(string $key, mixed $value) + * @method static void forgetSession(string $key) + * @method static void resetSession() + * @method static \Igniter\Local\Classes\Location setSessionKey(string $key) + * + * @see \Igniter\Local\Classes\Location + */ class Location extends Facade { /**