diff --git a/.phpstan/phpstan.neon b/.phpstan/phpstan.neon index d4ab1845ad..45f76624f8 100644 --- a/.phpstan/phpstan.neon +++ b/.phpstan/phpstan.neon @@ -6,7 +6,7 @@ includes: parameters: bootstrapFiles: - bootstrap.php - level: 2 + level: 3 inferPrivatePropertyTypeFromConstructor: true paths: - ../public diff --git a/.phpstan/stubs/laravel-gaps.stub b/.phpstan/stubs/laravel-gaps.stub index 3ca6e883cc..979e010d2f 100644 --- a/.phpstan/stubs/laravel-gaps.stub +++ b/.phpstan/stubs/laravel-gaps.stub @@ -24,15 +24,16 @@ namespace Illuminate\Database; */ interface ConnectionInterface {} -namespace Illuminate\Cache; +namespace Illuminate\Contracts\Cache; /** - * Repository forwards lock() via __call to its underlying store when that store is a - * LockProvider (Redis/File/Database/...). StartSession uses it for session locking. + * The concrete Illuminate\Cache\Repository (what Cache::store() returns) forwards lock() via + * __call to its underlying store when that store is a LockProvider (Redis/File/Database/...). + * StartSession::cache() is typed against this contract and uses it for session locking. * * @method \Illuminate\Cache\Lock lock(string $name, int $seconds = 0, ?string $owner = null) */ -class Repository {} +interface Repository {} namespace Illuminate\Contracts\Filesystem; diff --git a/app/Core/Bootloader.php b/app/Core/Bootloader.php index 9b5a663b3c..323f4a6f8b 100644 --- a/app/Core/Bootloader.php +++ b/app/Core/Bootloader.php @@ -17,8 +17,6 @@ class Bootloader /** * Bootloader instance - * - * @var static */ protected static ?Bootloader $instance = null; diff --git a/app/Core/Controller/Frontcontroller.php b/app/Core/Controller/Frontcontroller.php index 3a872eec24..1d2cb0a465 100644 --- a/app/Core/Controller/Frontcontroller.php +++ b/app/Core/Controller/Frontcontroller.php @@ -52,7 +52,7 @@ class Frontcontroller public function __construct(IncomingRequest $request, private PermissionEnforcer $permissionEnforcer) { $this->incomingRequest = $request; - $this->config = config(); + $this->config = app(Environment::class); } /** @@ -257,6 +257,11 @@ public function getValidControllerCall(string $moduleName, string $actionName, s } $classPath = $this->getClassPath($controllerType, $moduleName, $actionName); + + if ($classPath === false) { + throw new NotFoundHttpException("Can't find a valid controller for ".strip_tags($moduleName).'/'.strip_tags($actionName)); + } + $classMethod = $this->getValidControllerMethod($classPath, $methodName); Cache::store('installation')->set('routes.'.$routepath.'.'.($classMethod == 'run' ? $methodNameLower : $classMethod), ['class' => $classPath, 'method' => $classMethod]); @@ -269,7 +274,7 @@ public function getValidControllerCall(string $moduleName, string $actionName, s * * @param string $controllerType The type of controller. Possible values are 'Controllers' or 'Hxcontrollers'. **/ - public function getClassPath(string $controllerType, string $moduleName, string $actionName): string + public function getClassPath(string $controllerType, string $moduleName, string $actionName): string|false { $controllerNs = 'Domain'; diff --git a/app/Core/Db/Db.php b/app/Core/Db/Db.php index 1cd59ed12b..55d58eb85b 100644 --- a/app/Core/Db/Db.php +++ b/app/Core/Db/Db.php @@ -52,7 +52,7 @@ public function __construct($app, ?string $connection = null) /** * Get the PDO connection (lazily retrieved from Laravel's connection pool) * - * @return PDO + * @return \PDO|null */ public function __get($name) { diff --git a/app/Core/Events/EventDispatcher.php b/app/Core/Events/EventDispatcher.php index 5f08b77675..6aeea5fbe5 100644 --- a/app/Core/Events/EventDispatcher.php +++ b/app/Core/Events/EventDispatcher.php @@ -781,15 +781,19 @@ public function listen($events, $listener = null) { if ($events instanceof \Closure) { - return collect($this->firstClosureParameterTypes($events)) + collect($this->firstClosureParameterTypes($events)) ->each(function ($event) use ($events) { $this->listen($event, $events); }); + + return; } elseif ($events instanceof QueuedClosure) { - return collect($this->firstClosureParameterTypes($events->closure)) + collect($this->firstClosureParameterTypes($events->closure)) ->each(function ($event) use ($events) { $this->listen($event, $events->resolve()); }); + + return; } elseif ($listener instanceof QueuedClosure) { $listener = $listener->resolve(); } diff --git a/app/Core/Exceptions/ExceptionHandler.php b/app/Core/Exceptions/ExceptionHandler.php index 11b1df4017..bff3a9abaa 100644 --- a/app/Core/Exceptions/ExceptionHandler.php +++ b/app/Core/Exceptions/ExceptionHandler.php @@ -121,7 +121,7 @@ public function register() /** * Register a reportable callback. * - * @return \Illuminate\Foundation\Exceptions\ReportableHandler + * @return \Leantime\Core\Exceptions\ReportableHandler */ public function reportable(callable $reportUsing) { @@ -435,7 +435,7 @@ protected function renderExceptionWithWhoops(Throwable $e) /** * Get the Whoops handler for the application. * - * @return \Whoops\Handler\Handler + * @return \Whoops\Handler\HandlerInterface */ protected function whoopsHandler() { diff --git a/app/Core/Exceptions/HandleExceptions.php b/app/Core/Exceptions/HandleExceptions.php index efba3b7c54..65d59ad52a 100644 --- a/app/Core/Exceptions/HandleExceptions.php +++ b/app/Core/Exceptions/HandleExceptions.php @@ -25,7 +25,7 @@ class HandleExceptions /** * The application instance. * - * @var \Leantime\Core\Application + * @var \Leantime\Core\Application|null */ protected static $app; diff --git a/app/Core/Middleware/StartSession.php b/app/Core/Middleware/StartSession.php index 8298f6181e..55f8a902f4 100644 --- a/app/Core/Middleware/StartSession.php +++ b/app/Core/Middleware/StartSession.php @@ -467,7 +467,7 @@ protected function sessionIsPersistent(?array $config = null) * Resolve the given cache driver. * * @param string $driver - * @return \Illuminate\Cache\Repository + * @return \Illuminate\Contracts\Cache\Repository */ protected function cache($driver) { diff --git a/app/Core/Middleware/TrustProxies.php b/app/Core/Middleware/TrustProxies.php index 609385bafa..3debbf632c 100644 --- a/app/Core/Middleware/TrustProxies.php +++ b/app/Core/Middleware/TrustProxies.php @@ -24,7 +24,7 @@ class TrustProxies /** * The headers that should be used to detect proxies. * - * @var string + * @var int */ protected $headers = IncomingRequest::HEADER_X_FORWARDED_FOR | IncomingRequest::HEADER_X_FORWARDED_HOST | diff --git a/app/Core/Sessions/PathManifestRepository.php b/app/Core/Sessions/PathManifestRepository.php index d440481414..02fb112807 100644 --- a/app/Core/Sessions/PathManifestRepository.php +++ b/app/Core/Sessions/PathManifestRepository.php @@ -58,19 +58,19 @@ public function loadManifest(string $manifestName) } } - return false; + return null; } /** * Determine if the manifest should be compiled. * - * @param array $manifest + * @param array|null $manifest * @param array $paths * @return bool */ public function shouldRefresh($manifest, $paths) { - return is_null($manifest) || $manifest[$manifest] != $paths; + return is_null($manifest) || $manifest != $paths; } /** diff --git a/app/Core/Support/Cast.php b/app/Core/Support/Cast.php index 00f70fe0e1..cc594c302e 100644 --- a/app/Core/Support/Cast.php +++ b/app/Core/Support/Cast.php @@ -148,7 +148,7 @@ public static function castEnum(mixed $value, string $enumClass): mixed * Casts a string value into a datetime object. * * @param string $value The value to be casted into a datetime object. - * @return \DateTime The datetime object. + * @return \Carbon\CarbonImmutable The datetime object. * * @throws \InvalidArgumentException If the value is not a valid datetime string. **/ diff --git a/app/Core/Support/Format.php b/app/Core/Support/Format.php index ce3955f741..ab45b0f63b 100644 --- a/app/Core/Support/Format.php +++ b/app/Core/Support/Format.php @@ -207,7 +207,7 @@ public function isoDate(): string public function timestamp(): int|bool { if (empty($this->value) || ! $this->value instanceof CarbonImmutable) { - return ''; + return false; } return $this->value->getTimestamp(); @@ -219,7 +219,7 @@ public function timestamp(): int|bool public function jsTimestamp(): int|bool { if (empty($this->value) || ! $this->value instanceof CarbonImmutable) { - return ''; + return false; } return $this->value->getTimestampMs(); diff --git a/app/Core/UI/Template.php b/app/Core/UI/Template.php index c11e32801c..5bcfc4e95b 100644 --- a/app/Core/UI/Template.php +++ b/app/Core/UI/Template.php @@ -188,8 +188,6 @@ public function assign(string $name, mixed $value): void /** * get - get assigned values - * - * @return array */ public function get(string $name): mixed { @@ -688,11 +686,11 @@ public function setNotification(string $msg, string $type, string $event_id = '' * getToggleState - retrieves the toggle state of a submenu by name from the session * * @param string $name - the name of the submenu toggle - * @return string - the toggle state of the submenu (either "true" or "false") + * @return string|false - the toggle state of the submenu ("true"/"false"), or false if unset * * @deprecated this should be in a component */ - public function getToggleState(string $name): string + public function getToggleState(string $name): string|false { if (session()->exists('usersettings.submenuToggle.'.$name)) { return session('usersettings.submenuToggle.'.$name); diff --git a/app/Domain/Auth/Guards/ApiGuard.php b/app/Domain/Auth/Guards/ApiGuard.php index 8e2d43341f..f3ca959669 100644 --- a/app/Domain/Auth/Guards/ApiGuard.php +++ b/app/Domain/Auth/Guards/ApiGuard.php @@ -8,6 +8,7 @@ use Leantime\Core\Http\ApiRequest; use Leantime\Core\Http\IncomingRequest; use Leantime\Domain\Api\Services\Api; +use Leantime\Domain\Auth\Models\AuthenticatableUser; class ApiGuard implements Guard { @@ -64,20 +65,14 @@ public function user() return $this->user; } - $this->user = (object) $apiUser; + $this->user = new AuthenticatableUser((array) $apiUser); return $this->user; } public function id() { - // user() currently returns a stdClass of API-key user data (not yet a real - // Authenticatable — that conversion is tracked for the level-3 auth pass), so read - // the id off the object rather than calling getAuthIdentifier(). - /** @var \stdClass|null $user */ - $user = $this->user(); - - return $user?->id; + return $this->user()?->getAuthIdentifier(); } public function validate(array $credentials = []) diff --git a/app/Domain/Auth/Guards/WebGuard.php b/app/Domain/Auth/Guards/WebGuard.php index f661c6fdbf..efc107e4c8 100644 --- a/app/Domain/Auth/Guards/WebGuard.php +++ b/app/Domain/Auth/Guards/WebGuard.php @@ -51,13 +51,7 @@ public function hasUser() public function id() { - // user() currently returns a stdClass (AuthUser::retrieveById casts to object; the real - // Authenticatable conversion is tracked for the level-3 auth pass), so read the id off - // the object rather than calling getAuthIdentifier(). - /** @var \stdClass|null $user */ - $user = $this->user(); - - return $user?->id; + return $this->user()?->getAuthIdentifier(); } public function validate(array $credentials = []) diff --git a/app/Domain/Auth/Models/AuthenticatableUser.php b/app/Domain/Auth/Models/AuthenticatableUser.php new file mode 100644 index 0000000000..f44837596d --- /dev/null +++ b/app/Domain/Auth/Models/AuthenticatableUser.php @@ -0,0 +1,63 @@ + $attributes A user row (column => value). + */ + public function __construct(array $attributes = []) + { + foreach ($attributes as $key => $value) { + $this->{$key} = $value; + } + } + + public function getAuthIdentifierName(): string + { + return 'id'; + } + + public function getAuthIdentifier(): mixed + { + return $this->id ?? null; + } + + public function getAuthPasswordName(): string + { + return 'password'; + } + + public function getAuthPassword(): string + { + return $this->password ?? ''; + } + + public function getRememberToken(): string + { + return $this->remember_token ?? ''; + } + + public function setRememberToken($value): void + { + // No-op: Leantime does not persist remember tokens (mirrors Auth::setRememberToken and + // AuthUser::updateRememberToken, which are likewise not implemented). + } + + public function getRememberTokenName(): string + { + return 'remember_token'; + } +} diff --git a/app/Domain/Auth/Services/Auth.php b/app/Domain/Auth/Services/Auth.php index 149778b5c0..ad889744fc 100644 --- a/app/Domain/Auth/Services/Auth.php +++ b/app/Domain/Auth/Services/Auth.php @@ -698,7 +698,7 @@ public function getAuthPasswordName() public function getRememberToken() { - return null; // Not implemented yet + return ''; // Not implemented yet (Authenticatable::getRememberToken is contractually a string) } public function setRememberToken($value) diff --git a/app/Domain/Auth/Services/AuthUser.php b/app/Domain/Auth/Services/AuthUser.php index 066a86199c..8e4d865b3c 100644 --- a/app/Domain/Auth/Services/AuthUser.php +++ b/app/Domain/Auth/Services/AuthUser.php @@ -5,6 +5,7 @@ use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Contracts\Auth\UserProvider; use Laravel\Sanctum\HasApiTokens; +use Leantime\Domain\Auth\Models\AuthenticatableUser; use Leantime\Domain\Auth\Services\Auth as AuthService; class AuthUser implements UserProvider @@ -26,12 +27,26 @@ public function __construct( public function retrieveById($identifier) { - return (object) $this->userRepo->getUser($identifier); + $userData = $this->userRepo->getUser($identifier); + + // Not found → null, per the UserProvider contract. Returning a (non-null) empty user + // object would let the guard treat the request as authenticated. + if (empty($userData)) { + return null; + } + + return new AuthenticatableUser((array) $userData); } public function retrieveByToken($identifier, $token) { - return (object) $this->authService->getUserByToken($token); + $userData = $this->authService->getUserByToken($token); + + if (empty($userData)) { + return null; + } + + return new AuthenticatableUser((array) $userData); } public function updateRememberToken(Authenticatable $user, $token) @@ -63,10 +78,12 @@ public function rehashPasswordIfRequired(Authenticatable $user, array $credentia public function getOrCreateUser($user, $source) { + // Look up the existing account in a separate variable — the $user param holds the + // external/OAuth profile data we need to create the account from, so it must not be + // overwritten by the lookup result (doing so previously built new users with empty fields). + $existingUser = $this->authRepo->getUserByEmail($user['email']); - $user = $this->authRepo->getUserByEmail($user['email']); - - if (empty($user) && config()->get('auth.create_user')) { + if (empty($existingUser) && config()->get('auth.create_user')) { $userArray = [ 'firstname' => $user['firstname'], @@ -83,11 +100,11 @@ public function getOrCreateUser($user, $source) 'status' => 'a', ]; - $userId = $this->userRepo->addUser($userArray); - $user = $this->authRepo->getUserByEmail($user['email']); + $this->userRepo->addUser($userArray); + $existingUser = $this->authRepo->getUserByEmail($user['email']); } - return $user; + return $existingUser; } public function setUser($userId) diff --git a/app/Domain/Blueprints/Repositories/Blueprints.php b/app/Domain/Blueprints/Repositories/Blueprints.php index 5560e9c680..2806e790c3 100644 --- a/app/Domain/Blueprints/Repositories/Blueprints.php +++ b/app/Domain/Blueprints/Repositories/Blueprints.php @@ -590,7 +590,7 @@ public function copyCanvas(int $projectId, int $canvasId, int $authorId, string $this->connection->table('zp_canvas_items')->insertUsing($columns, $selectQuery); - return $newCanvasId; + return (int) $newCanvasId; } /** diff --git a/app/Domain/Clients/Controllers/ShowClient.php b/app/Domain/Clients/Controllers/ShowClient.php index fdefed592d..34a1989bce 100644 --- a/app/Domain/Clients/Controllers/ShowClient.php +++ b/app/Domain/Clients/Controllers/ShowClient.php @@ -68,7 +68,7 @@ public function get(array $params): Response return Frontcontroller::redirect(BASE_URL.'/clients/showClient/'.$id.'#files'); } else { - $this->tpl->setNotification($result['msg'], 'error'); + $this->tpl->setNotification(is_array($result) ? ($result['msg'] ?? '') : '', 'error'); } } diff --git a/app/Domain/CsvImport/Services/CsvImport.php b/app/Domain/CsvImport/Services/CsvImport.php index 9d69736bed..0e6100dc73 100644 --- a/app/Domain/CsvImport/Services/CsvImport.php +++ b/app/Domain/CsvImport/Services/CsvImport.php @@ -104,7 +104,7 @@ public function getEntities(): array } /** - * @return void + * @return array|false */ public function getValues(Entity $Entity): mixed { diff --git a/app/Domain/Dashboard/Services/Dashboard.php b/app/Domain/Dashboard/Services/Dashboard.php index cf5e1bf123..230aebae9b 100644 --- a/app/Domain/Dashboard/Services/Dashboard.php +++ b/app/Domain/Dashboard/Services/Dashboard.php @@ -136,6 +136,6 @@ public function buildDeleteCommentUrlBase(): string { $url = parse_url(CURRENT_URL); - return $url['scheme'].'://'.$url['host'].$url['path'].'?delComment='; + return $url['scheme'].'://'.$url['host'].($url['path'] ?? '').'?delComment='; } } diff --git a/app/Domain/Files/Services/Files.php b/app/Domain/Files/Services/Files.php index bfac6a726d..e01379f020 100644 --- a/app/Domain/Files/Services/Files.php +++ b/app/Domain/Files/Services/Files.php @@ -96,7 +96,7 @@ public function getFilesByModule(string $module = '', $entityId = null, $userId * * @api */ - public function upload($file, $module, $moduleId, $entity = null, $disk = 'default'): array|string + public function upload($file, $module, $moduleId, $entity = null, $disk = 'default'): array|string|false { try { // Validate input parameters diff --git a/app/Domain/Files/routes.php b/app/Domain/Files/routes.php index 1916f8045b..e1627798e6 100644 --- a/app/Domain/Files/routes.php +++ b/app/Domain/Files/routes.php @@ -19,7 +19,7 @@ Route::get('/download.php', function () { $qs = request()->getQueryString(); - return redirect()->to('/files/get'.($qs ? '?'.$qs : ''), 301); + return redirect('/files/get'.($qs ? '?'.$qs : ''), 301); }); /* diff --git a/app/Domain/Oidc/Services/Oidc.php b/app/Domain/Oidc/Services/Oidc.php index 34ab1ce126..5de3eccf92 100644 --- a/app/Domain/Oidc/Services/Oidc.php +++ b/app/Domain/Oidc/Services/Oidc.php @@ -455,7 +455,7 @@ private function getJwksUrl(): string /** * @throws GuzzleException */ - private function getTokenUrl(): string + private function getTokenUrl(): string|false { if (! empty($this->tokenUrl || $this->loadEndpoints())) { return $this->tokenUrl; diff --git a/app/Domain/Sprints/Services/Sprints.php b/app/Domain/Sprints/Services/Sprints.php index 889d5f11d7..f8882e95ea 100644 --- a/app/Domain/Sprints/Services/Sprints.php +++ b/app/Domain/Sprints/Services/Sprints.php @@ -84,7 +84,7 @@ public function getCurrentSprintId(int $projectId): bool|int * @api */ #[RequiresPermission(SprintsPermissions::VIEW, projectIdParam: 'projectId')] - public function getUpcomingSprint(int $projectId): false|array + public function getUpcomingSprint(int $projectId): false|\Leantime\Domain\Sprints\Models\Sprints { $sprint = $this->sprintRepository->getUpcomingSprint($projectId); diff --git a/app/Domain/Tickets/Controllers/DelMilestone.php b/app/Domain/Tickets/Controllers/DelMilestone.php index 87e8a352e4..7bbe5d57af 100644 --- a/app/Domain/Tickets/Controllers/DelMilestone.php +++ b/app/Domain/Tickets/Controllers/DelMilestone.php @@ -52,7 +52,7 @@ public function post($params): Response return Frontcontroller::redirect(BASE_URL.'/tickets/roadmap'); } - $this->tpl->setNotification($this->language->__($result['msg']), 'error'); + $this->tpl->setNotification($this->language->__(is_array($result) ? ($result['msg'] ?? '') : ''), 'error'); $this->tpl->assign('ticket', $this->ticketService->getTicket($id)); return $this->tpl->displayPartial('tickets.delMilestone'); diff --git a/app/Domain/Tickets/Controllers/ShowTicket.php b/app/Domain/Tickets/Controllers/ShowTicket.php index d29eda2834..1022966445 100644 --- a/app/Domain/Tickets/Controllers/ShowTicket.php +++ b/app/Domain/Tickets/Controllers/ShowTicket.php @@ -85,7 +85,7 @@ public function get($params): Response return Frontcontroller::redirect(BASE_URL.'/tickets/showTicket/'.$id.'#files'); } - $this->tpl->setNotification($result['msg'], 'error'); + $this->tpl->setNotification(is_array($result) ? ($result['msg'] ?? '') : '', 'error'); } // Delete comment diff --git a/app/Domain/Tickets/Repositories/Tickets.php b/app/Domain/Tickets/Repositories/Tickets.php index c979b32a3e..7ffb37783b 100644 --- a/app/Domain/Tickets/Repositories/Tickets.php +++ b/app/Domain/Tickets/Repositories/Tickets.php @@ -1727,7 +1727,7 @@ public function updateTicketStatus($ticketId, $status, int $ticketSorting = -1, return $this->connection->table('zp_tickets') ->where('id', $ticketId) - ->update($updates); + ->update($updates) > 0; } /** @@ -1994,7 +1994,7 @@ public function removeCollaborators(int $ticketId): bool ->where('entityAType', 'Ticket') ->where('entityBType', 'User') ->where('relationship', EntityRelationshipEnum::Collaborator->value) - ->delete(); + ->delete() > 0; } /** diff --git a/app/Domain/Tickets/Services/Tickets.php b/app/Domain/Tickets/Services/Tickets.php index 4ffe6d1581..fb109e28ae 100644 --- a/app/Domain/Tickets/Services/Tickets.php +++ b/app/Domain/Tickets/Services/Tickets.php @@ -1590,7 +1590,7 @@ private function sortItemsHierarchically($items): array return $flattened; } - return $tree; + return []; } private function sortTicketsWithinMilestone($tickets): array diff --git a/app/Domain/Users/Repositories/Users.php b/app/Domain/Users/Repositories/Users.php index 74dbb7ed2d..8ab07d53c2 100644 --- a/app/Domain/Users/Repositories/Users.php +++ b/app/Domain/Users/Repositories/Users.php @@ -304,7 +304,7 @@ public function editUser(array $values, $id): bool return $this->connection->table('zp_user') ->where('id', $id) - ->update($updateData); + ->update($updateData) > 0; } /** @@ -338,7 +338,7 @@ public function removeFromClient(int $userId): bool ->update([ 'clientId' => null, 'modified' => now(), - ]); + ]) > 0; } /** @@ -454,7 +454,7 @@ public function patchUser($id, $params): bool return $this->connection->table('zp_user') ->where('id', $id) - ->update($updates); + ->update($updates) > 0; } /** diff --git a/app/Domain/Users/Services/Users.php b/app/Domain/Users/Services/Users.php index d5a6e64cbb..7ede2f8a2c 100644 --- a/app/Domain/Users/Services/Users.php +++ b/app/Domain/Users/Services/Users.php @@ -314,14 +314,14 @@ public function checkPasswordStrength(string $password): bool * createUserInvite - generates a new invite token, creates the user in the db and sends the invitation email TODO: Should accept userModel * * @param array $values basic user values - * @return bool|int returns new user id on success, false on failure + * @return false|string returns the new user id on success, false on failure * * @throws BindingResolutionException * * @api */ #[RequiresPermission(UsersPermissions::CREATE, global: true)] - public function createUserInvite(array $values): bool|int + public function createUserInvite(array $values): false|string { // Generate strong password diff --git a/app/helpers.php b/app/helpers.php index fe6bc86fa3..74c92f9d8d 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -157,7 +157,7 @@ function dtHelper(): DateTimeHelper * @param int $http_response_code * @param array $headers * @param bool|null $secure - * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse + * @return \Symfony\Component\HttpFoundation\RedirectResponse */ function redirect($url = null, $http_response_code = 302, $headers = [], $secure = null) { @@ -244,37 +244,6 @@ function base_path($path = '') } } -if (! function_exists('redirect')) { - /** - * Get an instance of the redirector. - * - * @param string|null $url - * @param int $http_response_code - * @param array $headers - * @param bool|null $secure - * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse - */ - function redirect($url = null, $http_response_code = 302, $headers = [], $secure = null) - { - return new RedirectResponse( - trim(preg_replace('/\s\s+/', '', strip_tags($url))), - $http_response_code - ); - } -} - -if (! function_exists('currentRoute')) { - /** - * Get an instance of the redirector. - */ - function currentRoute() - { - - return app('request')->getCurrentRoute(); - - } -} - if (! function_exists('safe_unserialize')) { /** * Safely unserialize data without allowing object instantiation.