From 2609c5e54008fc1fff4af670c0b901f915e1e163 Mon Sep 17 00:00:00 2001 From: Alexis Gousseau Date: Tue, 8 Apr 2025 11:47:49 +0200 Subject: [PATCH] fix: :art: resolve phpcs and phpstan errors --- app/Console/Commands/CreateUser.php | 18 +- app/Enums/Credit/AccountTypeEnum.php | 6 +- app/Enums/Credit/BalanceOperationEnum.php | 6 +- app/Enums/Credit/EstimationStatusEnum.php | 8 +- app/Enums/Credit/EstimationTimeEnum.php | 49 -- app/Enums/Informations/InfoColorsEnum.php | 20 +- app/Enums/Invoices/InvoiceStatusEnum.php | 6 +- app/Enums/Invoices/TaskTypeEnum.php | 28 +- app/Enums/MessageTypeEnum.php | 6 +- app/Enums/Tickets/TicketFileTypeEnum.php | 12 +- app/Enums/Tickets/TicketStatusEnum.php | 42 +- app/Enums/Tickets/TicketTypeEnum.php | 24 +- app/Enums/Users/GitlabUsersEnum.php | 4 +- app/Enums/Users/RoleEnum.php | 8 +- app/Events/TicketStatusChanged.php | 2 +- app/Exceptions/Handler.php | 2 +- .../Bo/Auth/ForgotPasswordController.php | 2 +- .../Bo/Auth/ResetPasswordController.php | 6 +- .../Bo/Credit/AccountController.php | 19 +- .../Bo/Credit/CreditLogController.php | 8 +- app/Http/Controllers/Bo/InvoiceController.php | 7 +- app/Http/Controllers/Bo/ProjectController.php | 6 +- app/Http/Controllers/Bo/SiteController.php | 2 +- app/Http/Controllers/Bo/TicketController.php | 181 +++--- .../Controllers/Bo/TicketTypeController.php | 2 +- app/Http/Controllers/Bo/UserController.php | 18 +- app/Http/Controllers/Controller.php | 10 +- app/Http/Kernel.php | 22 +- app/Http/Middleware/Authenticate.php | 2 - app/Http/Middleware/HtmlSanitizer.php | 8 +- .../Middleware/RedirectIfAuthenticated.php | 3 +- app/Http/Middleware/SecureHeaders.php | 7 +- app/Http/Middleware/TrustHosts.php | 2 +- .../Requests/Bo/AssignTicketToUserRequest.php | 14 +- .../Requests/Bo/Brands/StoreBrandRequest.php | 12 +- app/Http/Requests/Bo/ChangeTicketStatus.php | 4 +- .../Bo/Companies/StoreCompanyRequest.php | 4 +- app/Http/Requests/Bo/CreateMessage.php | 18 +- .../Bo/Credit/AnswerEstimateRequest.php | 6 +- .../Bo/Credit/CreateEstimateRequest.php | 8 +- .../StoreCreditAccountRequest.php | 12 +- .../Bo/CreditLogs/StoreCreditLogRequest.php | 4 +- .../Informations/StoreInformationRequest.php | 12 +- .../Bo/Invoices/StoreInvoiceRequest.php | 42 +- .../Bo/Invoices/UpdateInvoiceRequest.php | 2 +- .../Requests/Bo/Labels/StoreLabelRequest.php | 8 +- .../Requests/Bo/Labels/UpdateLabelRequest.php | 2 +- .../Bo/Packages/StorePackageRequest.php | 8 +- .../Bo/Projects/StoreProjectRequest.php | 6 +- .../Bo/Projects/UpdateProjectRequest.php | 2 +- .../Requests/Bo/Sites/StoreSiteRequest.php | 28 +- .../Requests/Bo/Sites/UpdateSiteRequest.php | 2 +- app/Http/Requests/Bo/SortTickets.php | 10 +- app/Http/Requests/Bo/StoreTicket.php | 4 +- .../TicketTypes/UpdateTicketTypeRequest.php | 2 +- .../Requests/Bo/UpdateChangeOrderRequest.php | 1 - app/Http/Requests/Bo/UpdateTicket.php | 9 +- .../Requests/Bo/Users/StoreUserRequest.php | 24 +- .../Requests/Bo/Users/UpdateUserRequest.php | 2 +- app/Http/Resources/UserLabeledResource.php | 6 +- app/Interfaces/SpsConfigInterface.php | 6 +- app/Jobs/AutoCloseOldTickets.php | 2 +- app/Jobs/SendTicketMentionMail.php | 2 +- app/Jobs/SendUserCreatedEmail.php | 2 +- app/Jobs/WarnBeforeAutoCloseTicket.php | 2 +- app/Lib/Helpers/CollectionHelper.php | 26 +- app/Lib/Helpers/ExceptionsHelper.php | 14 +- app/Lib/Helpers/FileStorageHelper.php | 28 +- app/Lib/Helpers/ToolboxHelper.php | 56 +- app/Listeners/AddStatusMessages.php | 2 +- app/Listeners/SendNotificationMailToAdmin.php | 2 +- .../SendNotificationMailToTicketCreator.php | 6 +- .../SendSubscriptionsNotificationsMail.php | 2 +- app/Mail/NewTicket.php | 4 +- app/Mail/TicketMention.php | 4 +- app/Mail/TicketUpdate.php | 10 +- app/Mail/UserCreatedMail.php | 2 +- app/Models/Brand.php | 7 +- app/Models/Company.php | 12 +- app/Models/Credit/Account.php | 18 +- app/Models/Credit/CreditLog.php | 22 +- app/Models/Credit/Estimation.php | 22 +- app/Models/Information.php | 6 +- app/Models/Invoice.php | 43 +- app/Models/Label.php | 10 +- app/Models/Message.php | 19 +- app/Models/Package.php | 2 +- app/Models/Project.php | 4 +- app/Models/Site.php | 42 +- app/Models/Ticket.php | 80 ++- app/Models/Ticket/TicketType.php | 12 +- app/Models/User.php | 49 +- app/Notifications/ResetPassword.php | 2 +- app/Policies/AccountPolicy.php | 12 +- app/Policies/CreditLogPolicy.php | 2 +- app/Policies/EstimationPolicy.php | 2 +- app/Policies/SitePolicy.php | 2 +- app/Policies/TicketPolicy.php | 73 ++- app/Providers/AppServiceProvider.php | 2 +- app/Providers/BroadcastServiceProvider.php | 2 +- app/Providers/RouteServiceProvider.php | 28 +- app/Providers/TranslationServiceProvider.php | 13 +- app/Providers/ViewServiceProvider.php | 2 +- app/Traits/Controllers/ChangesModelOrder.php | 1 + app/Traits/Enums/BaseEnum.php | 57 +- app/Traits/Enums/SpsConfigTrait.php | 9 +- app/Traits/Models/IsCachedAsCollection.php | 2 +- app/Traits/Models/MiniCrudModel.php | 2 +- composer.json | 3 +- composer.lock | 570 ++++++++++++------ database/factories/CompanyFactory.php | 2 +- database/factories/InvoiceFactory.php | 22 +- database/factories/PackageFactory.php | 4 +- database/factories/UserFactory.php | 10 +- ...22_05_24_104346_assign_user_to_tickets.php | 4 +- ...22_05_24_122728_move_images_to_storage.php | 17 +- .../2022_05_25_120339_create_labels_table.php | 4 +- ...05_25_121407_create_label_ticket_table.php | 4 +- .../2022_05_30_091333_create_brands_table.php | 6 +- ...022_05_30_091340_add_brand_id_to_sites.php | 4 +- ...30_091401_create_credit_accounts_table.php | 11 +- ..._05_30_091412_create_credit_logs_table.php | 11 +- ...091438_create_credit_estimations_table.php | 20 +- ...453_create_credit_estimation_log_table.php | 8 +- ...t_floating_point_on_credit_estimations.php | 4 +- ...022_08_22_154457_create_packages_table.php | 5 +- ...22_08_23_085321_create_companies_table.php | 6 +- ...022_08_23_085833_create_invoices_table.php | 4 +- ...6_112109_change_sites_projets_relation.php | 4 +- ...023_04_06_101917_change_tickets_status.php | 4 +- .../2023_04_06_122125_add_message_type.php | 4 +- ...23_04_18_123853_create_dutyhours_table.php | 4 +- ...04_18_150623_create_informations_table.php | 4 +- ...04_19_160127_create_ticket_types_table.php | 6 +- ..._01_125540_drop_macro_activities_table.php | 1 - ...2023_08_18_091917_drop_schedules_table.php | 1 - database/seeders/DatabaseSeeder.php | 2 +- database/seeders/InvoicingSeeder.php | 2 +- package-lock.json | 2 +- phpstan.neon | 8 + routes/web-bo.php | 8 +- 141 files changed, 1235 insertions(+), 1061 deletions(-) delete mode 100644 app/Enums/Credit/EstimationTimeEnum.php create mode 100644 phpstan.neon diff --git a/app/Console/Commands/CreateUser.php b/app/Console/Commands/CreateUser.php index 127f606..9497e8f 100644 --- a/app/Console/Commands/CreateUser.php +++ b/app/Console/Commands/CreateUser.php @@ -20,7 +20,7 @@ class CreateUser extends Command /** * The console command description. * - * @var string + * @var string|null */ protected $description = 'Create a user'; @@ -34,21 +34,21 @@ class CreateUser extends Command /** * The email of the new user. * - * @var string + * @var string|null */ protected $email; /** * The password of the new user. * - * @var string + * @var string|null */ protected $password; /** * The role of the new user. * - * @var integer + * @var \App\Enums\Users\RoleEnum|null */ protected $role; @@ -59,7 +59,7 @@ class CreateUser extends Command */ public function handle() { - $this->name = null; + $this->name = ""; $this->addName(); $this->email = null; @@ -72,10 +72,10 @@ class CreateUser extends Command $this->addRole(); $user = new User([ - 'name' => $this->name, - 'email' => $this->email, + 'name' => $this->name, + 'email' => $this->email, 'password' => $this->password, - 'role' => $this->role + 'role' => $this->role ]); $user->saveOrFail(); @@ -90,7 +90,7 @@ class CreateUser extends Command */ private function addName(): void { - while (is_null($this->name)) { + while (empty($this->name)) { try { $tmp = $this->ask('Type the wanted user name', 'Admin'); $validator = Validator::make(['name' => $tmp], [ diff --git a/app/Enums/Credit/AccountTypeEnum.php b/app/Enums/Credit/AccountTypeEnum.php index 2e2c126..462803e 100644 --- a/app/Enums/Credit/AccountTypeEnum.php +++ b/app/Enums/Credit/AccountTypeEnum.php @@ -12,10 +12,12 @@ enum AccountTypeEnum: int case seo = 1; /** - * Optionnal labels definition + * Optionnal labels definition. + * + * @phpstan-ignore-next-line */ private const LABELS = [ self::development->name => "Jours de développement", - self::seo->name => "Jours de seo", + self::seo->name => "Jours de seo", ]; } diff --git a/app/Enums/Credit/BalanceOperationEnum.php b/app/Enums/Credit/BalanceOperationEnum.php index 0b3caa2..b8c3833 100644 --- a/app/Enums/Credit/BalanceOperationEnum.php +++ b/app/Enums/Credit/BalanceOperationEnum.php @@ -12,10 +12,12 @@ enum BalanceOperationEnum: int case debit = 1; /** - * Optionnal labels definition + * Optionnal labels definition. + * + * @phpstan-ignore-next-line */ private const LABELS = [ self::credit->name => "Créditer un compte", - self::debit->name => "Débiter un compte", + self::debit->name => "Débiter un compte", ]; } diff --git a/app/Enums/Credit/EstimationStatusEnum.php b/app/Enums/Credit/EstimationStatusEnum.php index 15d46ac..961ecea 100644 --- a/app/Enums/Credit/EstimationStatusEnum.php +++ b/app/Enums/Credit/EstimationStatusEnum.php @@ -13,11 +13,13 @@ enum EstimationStatusEnum: int case refused = 2; /** - * Optionnal labels definition + * Optionnal labels definition. + * + * @phpstan-ignore-next-line */ private const LABELS = [ - self::pending->name => "En attente", + self::pending->name => "En attente", self::accepted->name => "Acceptée", - self::refused->name => "Refusée", + self::refused->name => "Refusée", ]; } diff --git a/app/Enums/Credit/EstimationTimeEnum.php b/app/Enums/Credit/EstimationTimeEnum.php deleted file mode 100644 index 86fb130..0000000 --- a/app/Enums/Credit/EstimationTimeEnum.php +++ /dev/null @@ -1,49 +0,0 @@ -name => "Une demi-heure", - self::hour->name => "Une heure", - self::hourAndHalf->name => "Une heure et demie", - self::twoHours->name => "Deux heures", - self::twoHoursAndHalf->name => "Deux heures et demie", - self::threeHours->name => "Trois heures", - self::twoHoursAndHalf->name => "Trois heures et demie", - self::fourHours->name => "Quatre heures", - self::fourHoursAndHalf->name => "Quatre heures et demie", - self::fiveHours->name => "Cinq heures", - self::fiveHoursAndHalf->name => "Cinq heures et demie", - self::sixHours->name => "Six heures", - self::sixHoursAndHalf->name => "Six heures et demie", - self::sevenHours->name => "Sept heures", - self::sevenHoursAndHalf->name => "Sept heures et demi", - self::eightHours->name => "Huit heures", - ]; -} diff --git a/app/Enums/Informations/InfoColorsEnum.php b/app/Enums/Informations/InfoColorsEnum.php index fb210f6..c90fdf8 100644 --- a/app/Enums/Informations/InfoColorsEnum.php +++ b/app/Enums/Informations/InfoColorsEnum.php @@ -18,21 +18,21 @@ enum InfoColorsEnum: int case dark = 7; /** - * Optionnal labels definition + * Optionnal labels definition. */ private const CLASSES = [ - self::primary->name => "primary", + self::primary->name => "primary", self::secondary->name => "secondary", - self::success->name => "success", - self::danger->name => "danger", - self::warning->name => "warning", - self::info->name => "info", - self::light->name => "light", - self::dark->name => "dark", + self::success->name => "success", + self::danger->name => "danger", + self::warning->name => "warning", + self::info->name => "info", + self::light->name => "light", + self::dark->name => "dark", ]; /** - * Get Class + * Get Class. * * @return string */ @@ -42,7 +42,7 @@ enum InfoColorsEnum: int } /** - * Get enum classes + * Get enum classes. * * @return array */ diff --git a/app/Enums/Invoices/InvoiceStatusEnum.php b/app/Enums/Invoices/InvoiceStatusEnum.php index f9e0163..4a0d355 100644 --- a/app/Enums/Invoices/InvoiceStatusEnum.php +++ b/app/Enums/Invoices/InvoiceStatusEnum.php @@ -15,10 +15,12 @@ enum InvoiceStatusEnum: int /** * Optionnal labels definition. + * + * @phpstan-ignore-next-line */ private const LABELS = [ - self::opened->name => "Ouvert (nouveaux ou en cours)", - self::refused->name => "Refusé (par le client ou aucune réponse de sa part)", + self::opened->name => "Ouvert (nouveaux ou en cours)", + self::refused->name => "Refusé (par le client ou aucune réponse de sa part)", self::canceled->name => "Annulé (supprimé)", self::archived->name => "Archivé (validé et envoyé à la comptabilité)", ]; diff --git a/app/Enums/Invoices/TaskTypeEnum.php b/app/Enums/Invoices/TaskTypeEnum.php index b63cc21..55288e9 100644 --- a/app/Enums/Invoices/TaskTypeEnum.php +++ b/app/Enums/Invoices/TaskTypeEnum.php @@ -14,41 +14,43 @@ enum TaskTypeEnum: int case arbitrary = 4; /** - * Optionnal labels definition + * Optionnal labels definition. + * + * @phpstan-ignore-next-line */ private const LABELS = [ - self::web->name => "Web", - self::seo->name => "SEO", - self::package->name => "Forfait", + self::web->name => "Web", + self::seo->name => "SEO", + self::package->name => "Forfait", self::arbitrary->name => "Libre", ]; /** - * Custom added prices definition + * Custom added prices definition. */ private const PRICES = [ - self::web->name => 600, - self::seo->name => 690, + self::web->name => 600, + self::seo->name => 690, // * Linked to packages table - self::package->name => 0, + self::package->name => 0, // * Arbitrary number self::arbitrary->name => 0, ]; /** - * Get Price + * Get Price. * - * @return string + * @return integer */ - public function price(): string + public function price(): int { return self::PRICES[$this->name]; } /** - * Get enum prices + * Get enum prices. * - * @return array + * @return array */ public static function toPrices(): array { diff --git a/app/Enums/MessageTypeEnum.php b/app/Enums/MessageTypeEnum.php index 381c9cf..c2bc808 100644 --- a/app/Enums/MessageTypeEnum.php +++ b/app/Enums/MessageTypeEnum.php @@ -12,10 +12,12 @@ enum MessageTypeEnum: int case public = 2; /** - * Optionnal labels definition + * Optionnal labels definition. + * + * @phpstan-ignore-next-line */ private const LABELS = [ self::private->name => "Privé", - self::public->name => "Public", + self::public->name => "Public", ]; } diff --git a/app/Enums/Tickets/TicketFileTypeEnum.php b/app/Enums/Tickets/TicketFileTypeEnum.php index 7665508..01705b1 100644 --- a/app/Enums/Tickets/TicketFileTypeEnum.php +++ b/app/Enums/Tickets/TicketFileTypeEnum.php @@ -4,7 +4,7 @@ namespace App\Enums\Tickets; use App\Traits\Enums\BaseEnum; -enum TicketFileTypeEnum: int +enum TicketFileTypeEnum: string { use BaseEnum; @@ -18,7 +18,9 @@ enum TicketFileTypeEnum: int case csv = '.csv'; /** - * Optionnal labels definition + * Optionnal labels definition. + * + * @phpstan-ignore-next-line */ private const LABELS = [ self::png->name => "Fichier png", @@ -32,7 +34,7 @@ enum TicketFileTypeEnum: int ]; /** - * Custom added mimes type definition + * Custom added mimes type definition. */ private const MIMETYPE = [ self::png->name => 'image/png', @@ -46,7 +48,7 @@ enum TicketFileTypeEnum: int ]; /** - * Get Class + * Get Class. * * @return string */ @@ -56,7 +58,7 @@ enum TicketFileTypeEnum: int } /** - * Get enum classes + * Get enum classes. * * @return array */ diff --git a/app/Enums/Tickets/TicketStatusEnum.php b/app/Enums/Tickets/TicketStatusEnum.php index 744be98..3009094 100644 --- a/app/Enums/Tickets/TicketStatusEnum.php +++ b/app/Enums/Tickets/TicketStatusEnum.php @@ -19,37 +19,39 @@ enum TicketStatusEnum: int case archived = 9; /** - * Optionnal labels definition + * Optionnal labels definition. + * + * @phpstan-ignore-next-line */ private const LABELS = [ - self::new->name => "Nouveau", - self::estimateTodo->name => "Étude chef(s) de projet", - self::takenInAccount->name => "Pris en compte", - self::waiting->name => "En attente de réponse", + self::new->name => "Nouveau", + self::estimateTodo->name => "Étude chef(s) de projet", + self::takenInAccount->name => "Pris en compte", + self::waiting->name => "En attente de réponse", self::waitingValidation->name => "En attente de validation", - self::recette->name => "En recettage", - self::recetteValidated->name => "Recettage validé", - self::production->name => "En production", - self::archived->name => "Archivé", + self::recette->name => "En recettage", + self::recetteValidated->name => "Recettage validé", + self::production->name => "En production", + self::archived->name => "Archivé", ]; /** - * Custom added classes definition + * Custom added classes definition. */ private const CLASSES = [ - self::new->name => 'text-danger', - self::estimateTodo->name => 'text-info', - self::takenInAccount->name => 'text-info', - self::waiting->name => 'text-white bg-danger', + self::new->name => 'text-danger', + self::estimateTodo->name => 'text-info', + self::takenInAccount->name => 'text-info', + self::waiting->name => 'text-white bg-danger', self::waitingValidation->name => 'text-warning bg-danger', - self::recette->name => 'text-primary', - self::recetteValidated->name => 'text-success', - self::production->name => 'text-success', - self::archived->name => 'text-secondary', + self::recette->name => 'text-primary', + self::recetteValidated->name => 'text-success', + self::production->name => 'text-success', + self::archived->name => 'text-secondary', ]; /** - * Get Class + * Get Class. * * @return string */ @@ -59,7 +61,7 @@ enum TicketStatusEnum: int } /** - * Get enum classes + * Get enum classes. * * @return array */ diff --git a/app/Enums/Tickets/TicketTypeEnum.php b/app/Enums/Tickets/TicketTypeEnum.php index da89622..692c18d 100644 --- a/app/Enums/Tickets/TicketTypeEnum.php +++ b/app/Enums/Tickets/TicketTypeEnum.php @@ -16,27 +16,29 @@ enum TicketTypeEnum: int case advice = 6; /** - * Optionnal labels definition + * Optionnal labels definition. + * + * @phpstan-ignore-next-line */ private const LABELS = [ - self::bug->name => "Bug", - self::evolution->name => "Évolution", - self::br->name => "Demande BR", + self::bug->name => "Bug", + self::evolution->name => "Évolution", + self::br->name => "Demande BR", self::newsletter->name => "Demande newsletter", - self::qrcode->name => "Demande de QR Code", - self::advice->name => "Conseil - Accompagnement", + self::qrcode->name => "Demande de QR Code", + self::advice->name => "Conseil - Accompagnement", ]; /** * Custom added classes definition */ private const CLASSES = [ - self::bug->name => "bg-danger", - self::evolution->name => "bg-success", - self::br->name => "bg-primary", + self::bug->name => "bg-danger", + self::evolution->name => "bg-success", + self::br->name => "bg-primary", self::newsletter->name => "bg-warning", - self::qrcode->name => "bg-secondary", - self::advice->name => "bg-info", + self::qrcode->name => "bg-secondary", + self::advice->name => "bg-info", ]; /** diff --git a/app/Enums/Users/GitlabUsersEnum.php b/app/Enums/Users/GitlabUsersEnum.php index 43cbcdd..67bebcc 100644 --- a/app/Enums/Users/GitlabUsersEnum.php +++ b/app/Enums/Users/GitlabUsersEnum.php @@ -16,7 +16,9 @@ enum GitlabUsersEnum: int case default = 24; /** - * Optionnal labels definition + * Optionnal labels definition. + * + * @phpstan-ignore-next-line */ private const LABELS = [ self::default->name => "Default", diff --git a/app/Enums/Users/RoleEnum.php b/app/Enums/Users/RoleEnum.php index 64b0f6b..a6ff2fe 100644 --- a/app/Enums/Users/RoleEnum.php +++ b/app/Enums/Users/RoleEnum.php @@ -13,11 +13,13 @@ enum RoleEnum: int case client = 2; /** - * Optionnal labels definition + * Optionnal labels definition. + * + * @phpstan-ignore-next-line */ private const LABELS = [ self::developper->name => "Developpeur", - self::admin->name => "Administrateur", - self::client->name => "Client", + self::admin->name => "Administrateur", + self::client->name => "Client", ]; } diff --git a/app/Events/TicketStatusChanged.php b/app/Events/TicketStatusChanged.php index 3f4c76a..01b722c 100644 --- a/app/Events/TicketStatusChanged.php +++ b/app/Events/TicketStatusChanged.php @@ -15,7 +15,7 @@ class TicketStatusChanged use InteractsWithSockets; use SerializesModels; - /** @var \App\Models\Site */ + /** @var \App\Models\Ticket */ public $ticket; /** @var \App\Models\User */ diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 2b45543..f0dbb74 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -36,7 +36,7 @@ class Handler extends ExceptionHandler * * @return void */ - public function register() + public function register(): void { $this->reportable(function (\Throwable $e) { if (app()->bound('sentry')) { diff --git a/app/Http/Controllers/Bo/Auth/ForgotPasswordController.php b/app/Http/Controllers/Bo/Auth/ForgotPasswordController.php index 3f28ecf..e7ac159 100644 --- a/app/Http/Controllers/Bo/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Bo/Auth/ForgotPasswordController.php @@ -10,7 +10,7 @@ class ForgotPasswordController extends Controller use SendsPasswordResetEmails; /** - * ForgotPasswordController + * ForgotPasswordController. * * @return void */ diff --git a/app/Http/Controllers/Bo/Auth/ResetPasswordController.php b/app/Http/Controllers/Bo/Auth/ResetPasswordController.php index f8c31b5..3f5d8cd 100644 --- a/app/Http/Controllers/Bo/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Bo/Auth/ResetPasswordController.php @@ -23,11 +23,11 @@ class ResetPasswordController extends Controller * * @return array */ - protected function rules() + protected function rules(): array { return [ - 'token' => 'required', - 'email' => 'required|email', + 'token' => 'required', + 'email' => 'required|email', 'password' => [ 'required', 'confirmed', Password::min(8) ->mixedCase() diff --git a/app/Http/Controllers/Bo/Credit/AccountController.php b/app/Http/Controllers/Bo/Credit/AccountController.php index 9cc4a21..f50ea39 100644 --- a/app/Http/Controllers/Bo/Credit/AccountController.php +++ b/app/Http/Controllers/Bo/Credit/AccountController.php @@ -7,6 +7,7 @@ use App\Http\Requests\Bo\CreditAccounts\StoreCreditAccountRequest; use App\Models\Brand; use App\Models\Credit\Account; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Illuminate\Support\Str; @@ -21,13 +22,11 @@ class AccountController extends Controller public function index(Request $request): \Illuminate\Contracts\View\View { /** @var \App\Models\User $user */ - $user = auth()->user(); + $user = Auth::user(); - if (!$user->isAdmin()) { - $brandModels = $user->brands()->pluck('id'); - } else { - $brandModels = $request->brand ?? Brand::all()->pluck('id'); - } + $brandModels = (!$user->isAdmin()) + ? $user->brands()->pluck('id') + : $request->brand ?? Brand::query()->pluck('id'); /** @var \Illuminate\Database\Eloquent\Builder $credit_accountModels */ $credit_accountModels = Account::query()->whereIn('brand_id', $brandModels); @@ -62,14 +61,14 @@ class AccountController extends Controller /** * Show the form for creating a new resource. * - * @param \App\Models\Brand $brand - * @param \App\Models\Account $account + * @param \App\Models\Brand $brand + * @param \App\Models\Credit\Account $account * @return \Illuminate\Contracts\View\View */ public function create(Brand $brand, Account $account): \Illuminate\Contracts\View\View { return view('bo.pages.credit_accounts.create', [ - 'brandModel' => $brand, + 'brandModel' => $brand, 'credit_accountModel' => $account ]); } @@ -85,7 +84,7 @@ class AccountController extends Controller { return DB::transaction(function () use ($brand, $request) { $credit_accountModel = new Account(); - $credit_accountModel->brand_id = $brand->id; + $credit_accountModel->brand_id = $brand->getKey(); $credit_accountModel->fill($request->validated()); if ($credit_accountModel->saveOrFail()) { diff --git a/app/Http/Controllers/Bo/Credit/CreditLogController.php b/app/Http/Controllers/Bo/Credit/CreditLogController.php index ba3c9b2..e13e7b8 100644 --- a/app/Http/Controllers/Bo/Credit/CreditLogController.php +++ b/app/Http/Controllers/Bo/Credit/CreditLogController.php @@ -58,14 +58,14 @@ class CreditLogController extends Controller /** * Show the form for creating a new resource. * - * @param \App\Models\Brand $brand - * @param \App\Models\Account $account + * @param \App\Models\Brand $brand + * @param \App\Models\Credit\Account $account * @return \Illuminate\Contracts\View\View */ public function create(Brand $brand, Account $account): \Illuminate\Contracts\View\View { return view('bo.pages.credit_logs.create', [ - 'brandModel' => $brand, + 'brandModel' => $brand, 'credit_accountModel' => $account ]); } @@ -74,7 +74,7 @@ class CreditLogController extends Controller * Store a newly created resource in storage. * * @param \App\Models\Brand $brand - * @param \App\Models\Account $account + * @param \App\Models\Credit\Account $account * @param \App\Http\Requests\Bo\CreditLogs\StoreCreditLogRequest $request * @return \Illuminate\Http\RedirectResponse */ diff --git a/app/Http/Controllers/Bo/InvoiceController.php b/app/Http/Controllers/Bo/InvoiceController.php index c9e27d3..45eaeef 100644 --- a/app/Http/Controllers/Bo/InvoiceController.php +++ b/app/Http/Controllers/Bo/InvoiceController.php @@ -176,8 +176,9 @@ class InvoiceController extends Controller * @param \App\Models\Invoice $invoice * @return \Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\Response */ - public function download(Invoice $invoice) - { + public function download( + Invoice $invoice + ): \Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\Response { if (Gate::allows('isAdmin')) { return $invoice->generateInvoice() ->stream(Str::slug(trans('Devis :appname :date - ref :ref', [ @@ -199,7 +200,7 @@ class InvoiceController extends Controller * Get a paginate resource. * * @param \Illuminate\Http\Request $request - * @return Illuminate\Http\JsonResponse + * @return \Illuminate\Http\JsonResponse */ public function jsonPaginate(Request $request): \Illuminate\Http\JsonResponse { diff --git a/app/Http/Controllers/Bo/ProjectController.php b/app/Http/Controllers/Bo/ProjectController.php index daea75d..e66f7c7 100644 --- a/app/Http/Controllers/Bo/ProjectController.php +++ b/app/Http/Controllers/Bo/ProjectController.php @@ -50,9 +50,9 @@ class ProjectController extends Controller * Crud show view * * @param \App\Models\Project $project - * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory + * @return \Illuminate\Contracts\View\View */ - public function show(Project $project) + public function show(Project $project): \Illuminate\Contracts\View\View { return view('bo.pages.projects.show', [ 'projectModel' => $project @@ -178,7 +178,7 @@ class ProjectController extends Controller * Get a paginate resource. * * @param \Illuminate\Http\Request $request - * @return Illuminate\Http\JsonResponse + * @return \Illuminate\Http\JsonResponse */ public function jsonPaginate(Request $request): \Illuminate\Http\JsonResponse { diff --git a/app/Http/Controllers/Bo/SiteController.php b/app/Http/Controllers/Bo/SiteController.php index de9e73e..c62f6ee 100644 --- a/app/Http/Controllers/Bo/SiteController.php +++ b/app/Http/Controllers/Bo/SiteController.php @@ -189,7 +189,7 @@ class SiteController extends Controller * Get a paginate resource. * * @param \Illuminate\Http\Request $request - * @return Illuminate\Http\JsonResponse + * @return \Illuminate\Http\JsonResponse */ public function jsonPaginate(Request $request): \Illuminate\Http\JsonResponse { diff --git a/app/Http/Controllers/Bo/TicketController.php b/app/Http/Controllers/Bo/TicketController.php index e3b891b..692ec35 100644 --- a/app/Http/Controllers/Bo/TicketController.php +++ b/app/Http/Controllers/Bo/TicketController.php @@ -28,6 +28,7 @@ use GrahamCampbell\GitLab\Facades\GitLab; use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\Request; use Illuminate\Support\Arr; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Session; @@ -62,7 +63,7 @@ class TicketController extends Controller $q->where('name', 'LIKE', "%$request->s%"); }); } - /** @var \Illuminate/Pagination/LengthAwarePaginator $tickets */ + /** @var \Illuminate\Pagination\LengthAwarePaginator $tickets */ $tickets = $tickets->paginate(); return \response()->json($tickets->getCollection()->map(function (Ticket $ticket) { return [ @@ -128,10 +129,12 @@ class TicketController extends Controller * * @param Request $request * @param Ticket $ticket - * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory + * @return \Illuminate\Http\JsonResponse|\Illuminate\Contracts\View\View */ - public function show(Request $request, Ticket $ticket) - { + public function show( + Request $request, + Ticket $ticket + ): \Illuminate\Http\JsonResponse|\Illuminate\Contracts\View\View { if ($request->ajax()) { return \response()->json([ 'label' => $ticket->formatName($ticket), @@ -162,9 +165,9 @@ class TicketController extends Controller /** * Show create Form * - * @return \Illuminate\Http\RedirectResponse + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Contracts\View\View */ - public function create() + public function create(): \Illuminate\Http\RedirectResponse|\Illuminate\Contracts\View\View { /** @var \App\Models\User */ $user = auth()->user(); @@ -187,7 +190,7 @@ class TicketController extends Controller * @param StoreTicket $request * @return \Illuminate\Http\RedirectResponse */ - public function store(StoreTicket $request) + public function store(StoreTicket $request): \Illuminate\Http\RedirectResponse { try { return DB::transaction(function () use ($request) { @@ -240,13 +243,13 @@ class TicketController extends Controller } /** - * Show update form + * Show update form. * * @param Ticket $ticket - * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory + * @return \Illuminate\Contracts\View\View * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ - public function edit(Ticket $ticket) + public function edit(Ticket $ticket): \Illuminate\Contracts\View\View { /** @var \App\Models\User */ $user = auth()->user(); @@ -259,13 +262,13 @@ class TicketController extends Controller } /** - * Update Model + * Update Model. * * @param UpdateTicket $request * @param Ticket $ticket * @return \Illuminate\Http\RedirectResponse */ - public function update(UpdateTicket $request, Ticket $ticket) + public function update(UpdateTicket $request, Ticket $ticket): \Illuminate\Http\RedirectResponse { $ticket->fill($request->validated()); @@ -304,13 +307,13 @@ class TicketController extends Controller } /** - * Change ticket Status + * Change ticket Status. * * @param ChangeTicketStatus $request * @param Ticket $ticket * @return \Illuminate\Http\RedirectResponse */ - public function changeStatus(ChangeTicketStatus $request, Ticket $ticket) + public function changeStatus(ChangeTicketStatus $request, Ticket $ticket): \Illuminate\Http\RedirectResponse { $ticket->fill($request->validated()); $ticket->saveOrFail(); @@ -320,25 +323,25 @@ class TicketController extends Controller } /** - * Add a new Message to the Ticket + * Add a new Message to the Ticket. * * @param CreateMessage $request * @param Ticket $ticket * @return \Illuminate\Http\RedirectResponse */ - public function createMessage(CreateMessage $request, Ticket $ticket) + public function createMessage(CreateMessage $request, Ticket $ticket): \Illuminate\Http\RedirectResponse { try { return DB::transaction(function () use ($request, $ticket) { + /** @var \App\Models\User $user */ + $user = Auth::user(); + /** @var \Illuminate\Http\UploadedFile|null */ $filesMessage = $request->file_messages; $message = new Message($request->validated()); - $message->user()->associate(auth()->user()); + $message->user()->associate($user); $message->ticket()->associate($ticket); - /** @var \App\Models\User */ - $user = auth()->user(); - if ($request->subscribe) { if (!$user->subscriptions()->find($ticket->id)) { $user->subscriptions()->attach($ticket->id); @@ -374,7 +377,7 @@ class TicketController extends Controller } /** - * Update Message + * Update Message. * * @param UpdateMessage $request * @param Ticket $ticket @@ -382,8 +385,11 @@ class TicketController extends Controller * @return \Illuminate\Http\RedirectResponse * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed */ - public function updateMessage(UpdateMessage $request, Ticket $ticket, Message $message) - { + public function updateMessage( + UpdateMessage $request, + Ticket $ticket, + Message $message + ): \Illuminate\Http\RedirectResponse { $message->message = $request->message; $message->saveOrFail(); @@ -392,12 +398,12 @@ class TicketController extends Controller } /** - * Change ticket status to archived + * Change ticket status to archived. * * @param Ticket $ticket * @return \Illuminate\Http\RedirectResponse */ - public function setToArchive(Ticket $ticket) + public function setToArchive(Ticket $ticket): \Illuminate\Http\RedirectResponse { $ticket->status = TicketStatusEnum::archived; $ticket->saveOrFail(); @@ -406,15 +412,15 @@ class TicketController extends Controller } /** - * Subscribe to ticket + * Subscribe to ticket. * * @param Ticket $ticket * @return \Illuminate\Http\RedirectResponse */ - public function subscribe(Ticket $ticket) + public function subscribe(Ticket $ticket): \Illuminate\Http\RedirectResponse { - /** @var \App\Models\User */ - $user = auth()->user(); + /** @var \App\Models\User $user */ + $user = Auth::user(); $user->subscriptions()->toggle($ticket->id); if ($user->subscriptions()->where('ticket_id', $ticket->id)->exists()) { return back() @@ -424,15 +430,15 @@ class TicketController extends Controller } /** - * Reopen ticket + * Reopen ticket. * * @param Ticket $ticket * @return \Illuminate\Http\RedirectResponse */ - public function reopen(Ticket $ticket) + public function reopen(Ticket $ticket): \Illuminate\Http\RedirectResponse { $message = trans(':ticketName à réouvert le ticket n°:ticketNumber', [ - 'ticketName' => $ticket->user->name, + 'ticketName' => $ticket->user->name, 'ticketNumber' => $ticket->id, ]); /** @var \App\Enums\Tickets\TicketStatusEnum */ @@ -442,27 +448,28 @@ class TicketController extends Controller event(new TicketStatusChanged($ticket, $oldStatus, null, $message, false, false)); event(new NotifySubscriptions($ticket, $message, collect([$ticket->user]))); - /** @var \App\Models\User */ - $user = auth()->user(); + /** @var \App\Models\User $user */ + $user = Auth::user(); $user->subscriptions()->toggle($ticket->id); return back()->with('warning', trans('Votre ticket à été réouvert.')); } /** - * Assign ticket to user ticket + * Assign ticket to user ticket. * * @param AssignTicketToUserRequest $request * @param Ticket $ticket * @return \Illuminate\Http\RedirectResponse */ - public function assignTo(AssignTicketToUserRequest $request, Ticket $ticket) + public function assignTo(AssignTicketToUserRequest $request, Ticket $ticket): \Illuminate\Http\RedirectResponse { - /** @var \App\Models\User */ - $user = auth()->user(); + /** @var \App\Models\User $user */ + $user = Auth::user(); - /** @var \App\Models\User|null */ - if ($assignedUser = User::whereId($request->assign)->first()) { + /** @var \App\Models\User|null $assignedUser */ + $assignedUser = User::whereId($request->assign)->first(); + if ($assignedUser) { $message = trans(':admin a assigné le ticket n°:ticketNumber à :assignedAdmin', [ 'admin' => $user->name, 'ticketNumber' => $ticket->id, @@ -488,8 +495,6 @@ class TicketController extends Controller event(new TicketStatusChanged($ticket, $oldStatus, null, $message, true, false)); event(new NotifySubscriptions($ticket, $message, collect([$ticket->user]))); - /** @var \App\Models\User */ - $user = auth()->user(); $user->subscriptions()->toggle($ticket->id); if ($assignedUser) { @@ -517,9 +522,9 @@ class TicketController extends Controller return back()->with('error', trans('Le ticket que vous avez renseigné ne fait pas partie du même site.')); } - if (!$ticket->linkedTicket()->where('linked_ticket_id', $linkedTicket->id)->exists()) { - $ticket->linkedTicket()->attach($linkedTicket->id); - $linkedTicket->linkedTicket()->attach($ticket->id); + if (!$ticket->linkedTickets()->where('linked_ticket_id', $linkedTicket->id)->exists()) { + $ticket->linkedTickets()->attach($linkedTicket->id); + $linkedTicket->linkedTickets()->attach($ticket->id); return back()->with('success', trans('Les tickets ont été liés avec succès.')); } @@ -536,8 +541,8 @@ class TicketController extends Controller */ public function unlinkTicket(Ticket $ticket, Ticket $linkedTicket) { - $ticket->linkedTicket()->detach($linkedTicket->id); - $linkedTicket->linkedTicket()->detach($ticket->id); + $ticket->linkedTickets()->detach($linkedTicket->id); + $linkedTicket->linkedTickets()->detach($ticket->id); return back()->with('warning', trans('Le lien entre les tickets à été supprimé.')); } @@ -545,14 +550,14 @@ class TicketController extends Controller // * PRIVATES /** - * Filter Tickets request constructor + * Filter Tickets request constructor. * - * @param Builder $tickets - * @param Request $request - * @return Builder - * @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh + * @param \Illuminate\Database\Eloquent\Builder $tickets + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Database\Eloquent\Builder + * @phpcs:disable Generic.Metrics.CyclomaticComplexity.MaxExceeded */ - private function filterTickets(Builder $tickets, Request $request): Builder + private function filterTickets(Builder $tickets, Request $request): \Illuminate\Database\Eloquent\Builder { //phpcs:enable if ($request->rst) { @@ -659,13 +664,13 @@ class TicketController extends Controller } /** - * Search ticket sql request constructor + * Search ticket sql request constructor. * - * @param Builder $tickets - * @param Request $request - * @return Builder + * @param \Illuminate\Database\Eloquent\Builder $tickets + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Database\Eloquent\Builder */ - private function searchTicket(Builder $tickets, Request $request): Builder + private function searchTicket(Builder $tickets, Request $request): \Illuminate\Database\Eloquent\Builder { if ($request->exists('search')) { if (empty($request->search)) { @@ -681,29 +686,27 @@ class TicketController extends Controller return $this->searchQuery($tickets, Session::get('tickets.search'), function ($q) { $words = explode(' ', Session::get('tickets.search')); - if (\is_array($words)) { - foreach ($words as $word) { - if (!strlen($word)) { - continue; - } - $s = collect(TicketStatusEnum::cases())->filter(function (TicketStatusEnum $t) use ($word) { - return Str::slug($t->label()) === Str::slug($word); - })->map(function (TicketStatusEnum $ticket) { - return $ticket->value; + foreach ($words as $word) { + if (!strlen($word)) { + continue; + } + $s = collect(TicketStatusEnum::cases())->filter(function (TicketStatusEnum $t) use ($word) { + return Str::slug($t->label()) === Str::slug($word); + })->map(function (TicketStatusEnum $ticket) { + return $ticket->value; + }); + $t = collect(TicketTypeEnum::cases())->filter(function (TicketTypeEnum $s) use ($word) { + return Str::slug($s->label()) === Str::slug($word); + })->map(function (TicketTypeEnum $ticket) { + return $ticket->value; + }); + $q->orWhere('id', $word) + ->orWhereIn('status', $s) + ->orWhereIn('type', $t) + ->orWhereHas('user', function ($q) use ($word) { + $q->where('name', 'LIKE', "%$word%"); }); - $t = collect(TicketTypeEnum::cases())->filter(function (TicketTypeEnum $s) use ($word) { - return Str::slug($s->label()) === Str::slug($word); - })->map(function (TicketTypeEnum $ticket) { - return $ticket->value; - }); - $q->orWhere('id', $word) - ->orWhereIn('status', $s) - ->orWhereIn('type', $t) - ->orWhereHas('user', function ($q) use ($word) { - $q->where('name', 'LIKE', "%$word%"); - }); - } //end foreach - } //end if + } //end foreach }, 'text', 'title', 'file', 'file2', 'file3', 'file4', 'file5'); } @@ -711,7 +714,7 @@ class TicketController extends Controller * Get a paginate resource. * * @param \Illuminate\Http\Request $request - * @return Illuminate\Http\JsonResponse + * @return \Illuminate\Http\JsonResponse */ public function jsonPaginate(Request $request): \Illuminate\Http\JsonResponse { @@ -742,9 +745,11 @@ class TicketController extends Controller * * @param \App\Models\Ticket $ticket * @return \Illuminate\Http\RedirectResponse + * @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh */ - public function createGitlabIssue(Ticket $ticket) + public function createGitlabIssue(Ticket $ticket): \Illuminate\Http\RedirectResponse { + //phpcs:enable $gitlabRepoId = $ticket->site->gitlab_project_id; $description = \sprintf("%s
", $ticket->text); $cLabel = match ($ticket->type) { @@ -765,7 +770,6 @@ class TicketController extends Controller $description .= $this->formatGitlabFiles($ticket, $uploadedFile, $key + 1); } } - $issue = GitLab::issues()->create($gitlabRepoId, [ 'title' => sprintf( 'ts-%s : %s', @@ -797,14 +801,14 @@ class TicketController extends Controller } /** - * Format files for Gitlab issues + * Format files for Gitlab issues. * * @param \App\Models\Ticket $ticket * @param array $uploadedFile * @param integer $fileNb * @return string */ - private function formatGitlabFiles(Ticket $ticket, array $uploadedFile, int $fileNb) + private function formatGitlabFiles(Ticket $ticket, array $uploadedFile, int $fileNb): string { if (Str::endsWith($ticket->file, ['jpg', 'png', 'jpeg', 'pptx', 'docx', 'xslx', 'csv'])) { $file = \sprintf( @@ -835,7 +839,8 @@ class TicketController extends Controller $paramNames = collect(request()->route()->parameterNames); $className = Str::of($paramNames->get($paramNames->count() - 2))->lower()->studly(); $className = "\\App\\Models\\{$className}"; - $model = Arr::get($params, $paramNames->count() - 2); + /** @var \App\Models\Ticket|null $model */ + $model = Arr::get($params, $paramNames->count() - 2); if (!class_exists($className)) { throw new \RuntimeException("The {$className} class doesn't exist."); @@ -849,7 +854,7 @@ class TicketController extends Controller throw new \RuntimeException("The {$className} doesn't match second last binded param."); } - /** @var \Illuminate\Database\Eloquent\Model|null */ + /** @var \App\Models\Ticket|null */ $model = $className::query()->where($model->getRouteKeyName(), $model->getRouteKey())->first(); if (!$model) { @@ -857,7 +862,7 @@ class TicketController extends Controller } return DB::transaction(function () use ($request, $className, $model) { - /** @var \Illuminate\Support\Collection $models */ + /** @var \Illuminate\Support\Collection $models */ $models = $className::query() ->orderBy('order', 'ASC') ->where('site_id', $model->site_id) diff --git a/app/Http/Controllers/Bo/TicketTypeController.php b/app/Http/Controllers/Bo/TicketTypeController.php index 9722789..5fc3653 100644 --- a/app/Http/Controllers/Bo/TicketTypeController.php +++ b/app/Http/Controllers/Bo/TicketTypeController.php @@ -45,7 +45,7 @@ class TicketTypeController extends Controller /** * Show the form for editing the specified resource. * - * @param App\Models\Ticket\TicketType $ticketType + * @param \App\Models\Ticket\TicketType $ticketType * @return \Illuminate\Contracts\View\View * @ignore phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ diff --git a/app/Http/Controllers/Bo/UserController.php b/app/Http/Controllers/Bo/UserController.php index 12f2e33..bf95e4c 100644 --- a/app/Http/Controllers/Bo/UserController.php +++ b/app/Http/Controllers/Bo/UserController.php @@ -166,7 +166,7 @@ class UserController extends Controller } /** - * Password reset form + * Password reset form. * * @return \Illuminate\Contracts\View\View */ @@ -176,7 +176,7 @@ class UserController extends Controller } /** - * Password reset submit + * Password reset submit. * * @return \Illuminate\Http\RedirectResponse */ @@ -187,18 +187,4 @@ class UserController extends Controller $request = new Request(['email' => $user->email]); return app(ForgotPasswordController::class)->sendResetLinkEmail($request); } - - /** - * Get february last day date of the year - * - * @param integer $year - * @return integer 28 or 29 - */ - private function getLastDayFebruary(int $year): int - { - if ((is_int($year / 4) && !is_int($year / 100)) || is_int($year / 400)) { - return 29; - } - return 28; - } } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 5686abc..5565337 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -4,7 +4,6 @@ namespace App\Http\Controllers; use App\Enums\Tickets\TicketStatusEnum; use App\Models\Ticket; -use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; @@ -89,7 +88,7 @@ class Controller extends BaseController string $search, callable $searchQuery = null, string ...$fields - ): Builder { + ): \Illuminate\Database\Eloquent\Builder { if (count($fields)) { // Search using words. $words = explode(' ', $search); @@ -199,7 +198,7 @@ class Controller extends BaseController * @param array $ignore * @return \Illuminate\Database\Eloquent\Builder */ - protected function sortQuery(Builder $query, array $ignore = []): Builder + protected function sortQuery(Builder $query, array $ignore = []): \Illuminate\Database\Eloquent\Builder { $rName = request()->route()->getName(); $table = $query->getModel()->getTable(); @@ -218,8 +217,7 @@ class Controller extends BaseController } if (request()->sort_col and request()->sort_way and Schema::hasColumn($table, request()->sort_col)) { if ( - !isset($ignore) or - (isset($ignore) and !in_array(request()->sort_col, $ignore)) + !in_array(request()->sort_col, $ignore) ) { $query = $query->orderBy(\sprintf("$table.%s", request()->sort_col), request()->sort_way); } @@ -234,7 +232,7 @@ class Controller extends BaseController * @param integer|null $pagination * @return \Illuminate\Pagination\LengthAwarePaginator */ - protected function customPaginate(Builder $query, $pagination): LengthAwarePaginator + protected function customPaginate(Builder $query, $pagination): \Illuminate\Pagination\LengthAwarePaginator { if ($pagination) { Cache::put('pagination', $pagination); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index e931a2c..57d3bd0 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -54,17 +54,17 @@ class Kernel extends HttpKernel * @var array */ protected $routeMiddleware = [ - 'auth' => \App\Http\Middleware\Authenticate::class, - 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, - 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, - 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, - 'can' => \Illuminate\Auth\Middleware\Authorize::class, - 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, - 'is-admin' => \App\Http\Middleware\IsAdmin::class, + 'auth' => \App\Http\Middleware\Authenticate::class, + 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, + 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, + 'can' => \Illuminate\Auth\Middleware\Authorize::class, + 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, + 'is-admin' => \App\Http\Middleware\IsAdmin::class, 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, - 'signed' => \App\Http\Middleware\ValidateSignature::class, - 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, - 'htmlsanitize' => \App\Http\Middleware\HtmlSanitizer::class, + 'signed' => \App\Http\Middleware\ValidateSignature::class, + 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, + 'htmlsanitize' => \App\Http\Middleware\HtmlSanitizer::class, ]; } diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index feb58cb..dd06004 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -34,7 +34,5 @@ class Authenticate extends Middleware return route('login'); } abort(401); - - return null; } } diff --git a/app/Http/Middleware/HtmlSanitizer.php b/app/Http/Middleware/HtmlSanitizer.php index 857ca84..c7324fd 100644 --- a/app/Http/Middleware/HtmlSanitizer.php +++ b/app/Http/Middleware/HtmlSanitizer.php @@ -4,7 +4,6 @@ namespace App\Http\Middleware; use App\Lib\Helpers\ToolboxHelper; use Illuminate\Http\Request; -use Symfony\Component\HttpFoundation\Response; class HtmlSanitizer { @@ -16,8 +15,11 @@ class HtmlSanitizer * @param string|array ...$params * @return \Symfony\Component\HttpFoundation\Response */ - public function handle(Request $request, \Closure $next, string|array ...$params): Response - { + public function handle( + Request $request, + \Closure $next, + string|array ...$params + ): \Symfony\Component\HttpFoundation\Response { $inputs = $request->all(); /** @var callable|null */ $cleanInput = null; diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 7b691f9..9eb7baa 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -4,7 +4,6 @@ namespace App\Http\Middleware; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; -use Symfony\Component\HttpFoundation\Response; class RedirectIfAuthenticated { @@ -18,7 +17,7 @@ class RedirectIfAuthenticated * @throws \RuntimeException If guard is unhandled. * @phpcs:disable Squiz.Commenting.FunctionComment.IncorrectTypeHint */ - public function handle(Request $request, \Closure $next, ...$guards): Response + public function handle(Request $request, \Closure $next, ...$guards): \Symfony\Component\HttpFoundation\Response { // phpcs:enable phpcs:disable $guards = empty($guards) ? [null] : $guards; diff --git a/app/Http/Middleware/SecureHeaders.php b/app/Http/Middleware/SecureHeaders.php index cae7777..2ef9d74 100644 --- a/app/Http/Middleware/SecureHeaders.php +++ b/app/Http/Middleware/SecureHeaders.php @@ -7,7 +7,6 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\View; use Illuminate\Support\Facades\Vite; -use Symfony\Component\HttpFoundation\Response; class SecureHeaders { @@ -31,7 +30,7 @@ class SecureHeaders * @return \Symfony\Component\HttpFoundation\Response * @phpcs:disable Squiz.Commenting.FunctionComment.IncorrectTypeHint */ - public function handle(Request $request, Closure $next): Response + public function handle(Request $request, Closure $next): \Symfony\Component\HttpFoundation\Response { // phpcs:enable View::share('nonce', $nonce = Vite::useCspNonce()); @@ -89,12 +88,12 @@ class SecureHeaders } /** - * Remove unwanted headers + * Remove unwanted headers. * * @param array $headerList * @return void */ - private function removeUnwantedHeaders(array $headerList) + private function removeUnwantedHeaders(array $headerList): void { foreach ($headerList as $header) { header_remove($header); diff --git a/app/Http/Middleware/TrustHosts.php b/app/Http/Middleware/TrustHosts.php index 7186414..c9c58bd 100644 --- a/app/Http/Middleware/TrustHosts.php +++ b/app/Http/Middleware/TrustHosts.php @@ -11,7 +11,7 @@ class TrustHosts extends Middleware * * @return array */ - public function hosts() + public function hosts(): array { return [ $this->allSubdomainsOfApplicationUrl(), diff --git a/app/Http/Requests/Bo/AssignTicketToUserRequest.php b/app/Http/Requests/Bo/AssignTicketToUserRequest.php index e474f26..331c325 100644 --- a/app/Http/Requests/Bo/AssignTicketToUserRequest.php +++ b/app/Http/Requests/Bo/AssignTicketToUserRequest.php @@ -4,6 +4,7 @@ namespace App\Http\Requests\Bo; use App\Models\User; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Auth; class AssignTicketToUserRequest extends FormRequest { @@ -12,11 +13,11 @@ class AssignTicketToUserRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { - /** @var \App\Models\User */ - $user = auth()->user(); - return auth()->check() and $user->isAdmin(); + /** @var \App\Models\User $user */ + $user = Auth::user(); + return Auth::check() and $user->isAdmin(); } /** @@ -24,15 +25,14 @@ class AssignTicketToUserRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'assign' => [ 'nullable', 'exists:users,id', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed function ($attribute, $value, $fail) { - /** @var \App\Models\User $user */ - if ($user = User::whereId($value)->first() and !$user->isAdmin()) { + if ($user = User::query()->whereId($value)->first() and !$user->isAdmin()) { $fail(trans('Cet utilisateur ne peut se voir assigner un ticket')); } } diff --git a/app/Http/Requests/Bo/Brands/StoreBrandRequest.php b/app/Http/Requests/Bo/Brands/StoreBrandRequest.php index 7b5261c..3a119d5 100644 --- a/app/Http/Requests/Bo/Brands/StoreBrandRequest.php +++ b/app/Http/Requests/Bo/Brands/StoreBrandRequest.php @@ -12,7 +12,7 @@ class StoreBrandRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return Gate::allows('isAdmin'); } @@ -22,11 +22,11 @@ class StoreBrandRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ - 'name' => 'required|string|min:3|max:255', - 'sites' => 'nullable|array', + 'name' => 'required|string|min:3|max:255', + 'sites' => 'nullable|array', 'sites.*.id' => 'required|exists:sites,id' ]; } @@ -39,8 +39,8 @@ class StoreBrandRequest extends FormRequest public function attributes(): array { return [ - 'name' => trans('Nom de la marque'), - 'sites' => trans('Sites associés à la marque'), + 'name' => trans('Nom de la marque'), + 'sites' => trans('Sites associés à la marque'), 'sites.*.id' => trans('Élément parmis les sites associés à la marque'), ]; } diff --git a/app/Http/Requests/Bo/ChangeTicketStatus.php b/app/Http/Requests/Bo/ChangeTicketStatus.php index 9832a6f..1a0d0dc 100644 --- a/app/Http/Requests/Bo/ChangeTicketStatus.php +++ b/app/Http/Requests/Bo/ChangeTicketStatus.php @@ -12,7 +12,7 @@ class ChangeTicketStatus extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { /** @var \App\Models\User */ $user = auth()->user(); @@ -24,7 +24,7 @@ class ChangeTicketStatus extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'status' => [ diff --git a/app/Http/Requests/Bo/Companies/StoreCompanyRequest.php b/app/Http/Requests/Bo/Companies/StoreCompanyRequest.php index 4101aa4..b471e3a 100644 --- a/app/Http/Requests/Bo/Companies/StoreCompanyRequest.php +++ b/app/Http/Requests/Bo/Companies/StoreCompanyRequest.php @@ -12,7 +12,7 @@ class StoreCompanyRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return Gate::allows('isAdmin'); } @@ -22,7 +22,7 @@ class StoreCompanyRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|string|min:3|max:255', diff --git a/app/Http/Requests/Bo/CreateMessage.php b/app/Http/Requests/Bo/CreateMessage.php index 5031dc5..7d36af1 100644 --- a/app/Http/Requests/Bo/CreateMessage.php +++ b/app/Http/Requests/Bo/CreateMessage.php @@ -4,6 +4,7 @@ namespace App\Http\Requests\Bo; use App\Enums\MessageTypeEnum; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Auth; use Illuminate\Validation\Rules\Enum; class CreateMessage extends FormRequest @@ -13,10 +14,11 @@ class CreateMessage extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { - /** @var \App\Models\User|null */ - if (!($user = auth()->user())) { + /** @var \App\Models\User|null $user */ + $user = Auth::user(); + if (!($user)) { return false; } if ( @@ -25,7 +27,7 @@ class CreateMessage extends FormRequest ) { return false; } - return auth()->check() and $user->sites and ($user->isAdmin() or $user->sites->contains( + return Auth::check() and $user->sites and ($user->isAdmin() or $user->sites->contains( $this->route()->ticket->site_id )); } @@ -35,7 +37,7 @@ class CreateMessage extends FormRequest * * @return void */ - protected function prepareForValidation() + protected function prepareForValidation(): void { $this->merge([ 'subscribe' => $this->subscribe ? true : false, @@ -48,10 +50,10 @@ class CreateMessage extends FormRequest * * @return array */ - public function rules() + public function rules(): array { - /** @var \App\Models\User */ - $user = auth()->user(); + /** @var \App\Models\User $user */ + $user = Auth::user(); return [ 'subscribe' => 'required|boolean', 'message' => 'required|min:' . ($user->isAdmin() ? '5' : '20'), diff --git a/app/Http/Requests/Bo/Credit/AnswerEstimateRequest.php b/app/Http/Requests/Bo/Credit/AnswerEstimateRequest.php index 0713f96..c35aa04 100644 --- a/app/Http/Requests/Bo/Credit/AnswerEstimateRequest.php +++ b/app/Http/Requests/Bo/Credit/AnswerEstimateRequest.php @@ -11,7 +11,7 @@ class AnswerEstimateRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { if (!auth()->check()) { return false; @@ -26,7 +26,7 @@ class AnswerEstimateRequest extends FormRequest * * @return void */ - protected function prepareForValidation() + protected function prepareForValidation(): void { $this->merge([ 'answer' => $this->status === 'accept' @@ -38,7 +38,7 @@ class AnswerEstimateRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'status' => 'required|in:accept,refuse', diff --git a/app/Http/Requests/Bo/Credit/CreateEstimateRequest.php b/app/Http/Requests/Bo/Credit/CreateEstimateRequest.php index da90770..945e68b 100644 --- a/app/Http/Requests/Bo/Credit/CreateEstimateRequest.php +++ b/app/Http/Requests/Bo/Credit/CreateEstimateRequest.php @@ -12,7 +12,7 @@ class CreateEstimateRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { if (!auth()->check()) { return false; @@ -27,12 +27,12 @@ class CreateEstimateRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { /** @var \App\Models\Ticket */ $ticket = $this->ticket; return [ - 'amount' => [ + 'amount' => [ 'required', 'numeric', 'gt:0', @@ -64,7 +64,7 @@ class CreateEstimateRequest extends FormRequest public function attributes(): array { return [ - 'amount' => 'Montant', + 'amount' => 'Montant', 'credit_account_id' => 'Compte à débiter' ]; } diff --git a/app/Http/Requests/Bo/CreditAccounts/StoreCreditAccountRequest.php b/app/Http/Requests/Bo/CreditAccounts/StoreCreditAccountRequest.php index e5adb88..4691e75 100644 --- a/app/Http/Requests/Bo/CreditAccounts/StoreCreditAccountRequest.php +++ b/app/Http/Requests/Bo/CreditAccounts/StoreCreditAccountRequest.php @@ -14,7 +14,7 @@ class StoreCreditAccountRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return Gate::allows('isAdmin'); } @@ -24,11 +24,11 @@ class StoreCreditAccountRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ - 'label' => 'required|string|min:3|max:255', - 'type' => [ + 'label' => 'required|string|min:3|max:255', + 'type' => [ 'required', Rule::in(collect(AccountTypeEnum::cases())->pluck('value')->all()), ], @@ -44,8 +44,8 @@ class StoreCreditAccountRequest extends FormRequest public function attributes(): array { return [ - 'label' => trans('Label du compte'), - 'type' => trans('Type du compte'), + 'label' => trans('Label du compte'), + 'type' => trans('Type du compte'), 'balance' => trans('Solde du compte'), ]; } diff --git a/app/Http/Requests/Bo/CreditLogs/StoreCreditLogRequest.php b/app/Http/Requests/Bo/CreditLogs/StoreCreditLogRequest.php index 9d04ef7..1312ad9 100644 --- a/app/Http/Requests/Bo/CreditLogs/StoreCreditLogRequest.php +++ b/app/Http/Requests/Bo/CreditLogs/StoreCreditLogRequest.php @@ -12,7 +12,7 @@ class StoreCreditLogRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return Gate::allows('isAdmin'); } @@ -22,7 +22,7 @@ class StoreCreditLogRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'amount' => [ diff --git a/app/Http/Requests/Bo/Informations/StoreInformationRequest.php b/app/Http/Requests/Bo/Informations/StoreInformationRequest.php index c1c18e0..ac7bef9 100644 --- a/app/Http/Requests/Bo/Informations/StoreInformationRequest.php +++ b/app/Http/Requests/Bo/Informations/StoreInformationRequest.php @@ -14,7 +14,7 @@ class StoreInformationRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return Gate::allows('isAdmin'); } @@ -24,12 +24,12 @@ class StoreInformationRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ - 'title' => 'required|string|min:3|max:255', + 'title' => 'required|string|min:3|max:255', 'message' => 'required|string|min:3|max:255', - 'type' => [ + 'type' => [ 'required', Rule::in(collect(InfoColorsEnum::cases())->pluck('value')->all()), ], @@ -44,9 +44,9 @@ class StoreInformationRequest extends FormRequest public function attributes(): array { return [ - 'title' => trans('Titre de l\'information'), + 'title' => trans('Titre de l\'information'), 'message' => trans('Message de l\'information'), - 'type' => trans('Type d\'information'), + 'type' => trans('Type d\'information'), ]; } } diff --git a/app/Http/Requests/Bo/Invoices/StoreInvoiceRequest.php b/app/Http/Requests/Bo/Invoices/StoreInvoiceRequest.php index 6a4d839..84d33e2 100644 --- a/app/Http/Requests/Bo/Invoices/StoreInvoiceRequest.php +++ b/app/Http/Requests/Bo/Invoices/StoreInvoiceRequest.php @@ -15,7 +15,7 @@ class StoreInvoiceRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return Gate::allows('isAdmin'); } @@ -25,7 +25,7 @@ class StoreInvoiceRequest extends FormRequest * * @return void */ - protected function prepareForValidation() + protected function prepareForValidation(): void { $this->merge([ 'tasks' => request()->tasks ? \collect(json_decode(request()->tasks)) @@ -41,7 +41,7 @@ class StoreInvoiceRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'firstname' => 'required|string|min:3|max:255', @@ -73,25 +73,25 @@ class StoreInvoiceRequest extends FormRequest public function attributes(): array { return [ - 'firstname' => trans('Prénom de la personne associée'), - 'lastname' => trans('Nom de la personne associée'), - 'object' => trans('Objet du devis'), - 'tasks' => trans('Tâches du devis'), - 'tasks.*' => trans('Tâches du devis'), - 'tasks.*.days' => trans('Nombre de jours dédiés à la tâche'), - 'tasks.*.amount' => trans('Montant dédié à la tâche'), - 'tasks.*.desc' => trans('Description dédié à la tâche'), - 'tasks.*.type' => trans('Type de tâche'), - 'tasks.*.package' => trans('Forfait dédié à la tâche'), - 'comment' => trans('Commentaire du devis'), - 'show_days' => trans('Visibilité des jours'), - 'site_id' => trans('Site associé'), - 'company_id' => trans('Companie associé'), - 'invoiced_to_id' => trans('Entité à facturer'), - 'signed_date' => trans('Date de signature du Devis'), - 'sent_client_date' => trans('Date d\'envoi du Devis au client'), + 'firstname' => trans('Prénom de la personne associée'), + 'lastname' => trans('Nom de la personne associée'), + 'object' => trans('Objet du devis'), + 'tasks' => trans('Tâches du devis'), + 'tasks.*' => trans('Tâches du devis'), + 'tasks.*.days' => trans('Nombre de jours dédiés à la tâche'), + 'tasks.*.amount' => trans('Montant dédié à la tâche'), + 'tasks.*.desc' => trans('Description dédié à la tâche'), + 'tasks.*.type' => trans('Type de tâche'), + 'tasks.*.package' => trans('Forfait dédié à la tâche'), + 'comment' => trans('Commentaire du devis'), + 'show_days' => trans('Visibilité des jours'), + 'site_id' => trans('Site associé'), + 'company_id' => trans('Companie associé'), + 'invoiced_to_id' => trans('Entité à facturer'), + 'signed_date' => trans('Date de signature du Devis'), + 'sent_client_date' => trans('Date d\'envoi du Devis au client'), 'sent_accounting_date' => trans('Date d\'envoi du Devis à la comptabilité'), - 'status' => trans('État du devis'), + 'status' => trans('État du devis'), ]; } } diff --git a/app/Http/Requests/Bo/Invoices/UpdateInvoiceRequest.php b/app/Http/Requests/Bo/Invoices/UpdateInvoiceRequest.php index fe65552..a9903d0 100644 --- a/app/Http/Requests/Bo/Invoices/UpdateInvoiceRequest.php +++ b/app/Http/Requests/Bo/Invoices/UpdateInvoiceRequest.php @@ -12,7 +12,7 @@ class UpdateInvoiceRequest extends StoreInvoiceRequest * * @return array */ - public function rules() + public function rules(): array { $rules = []; $model = $this->route('invoice'); diff --git a/app/Http/Requests/Bo/Labels/StoreLabelRequest.php b/app/Http/Requests/Bo/Labels/StoreLabelRequest.php index f1235d7..0159353 100644 --- a/app/Http/Requests/Bo/Labels/StoreLabelRequest.php +++ b/app/Http/Requests/Bo/Labels/StoreLabelRequest.php @@ -13,7 +13,7 @@ class StoreLabelRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return Gate::allows('isAdmin'); } @@ -23,10 +23,10 @@ class StoreLabelRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ - 'name' => 'required|string|min:2|max:255|unique:labels,name', + 'name' => 'required|string|min:2|max:255|unique:labels,name', 'color' => [ 'required', new Hex(), @@ -42,7 +42,7 @@ class StoreLabelRequest extends FormRequest public function attributes(): array { return [ - 'name' => trans('validation.attributes.name'), + 'name' => trans('validation.attributes.name'), 'color' => trans('validation.attributes.color'), ]; } diff --git a/app/Http/Requests/Bo/Labels/UpdateLabelRequest.php b/app/Http/Requests/Bo/Labels/UpdateLabelRequest.php index bb08e9b..395aa9f 100644 --- a/app/Http/Requests/Bo/Labels/UpdateLabelRequest.php +++ b/app/Http/Requests/Bo/Labels/UpdateLabelRequest.php @@ -9,7 +9,7 @@ class UpdateLabelRequest extends StoreLabelRequest * * @return array */ - public function rules() + public function rules(): array { return array_merge(parent::rules(), [ 'name' => 'required|string|min:2|max:255|unique:labels,name,' . $this->route('label')->id . ',id', diff --git a/app/Http/Requests/Bo/Packages/StorePackageRequest.php b/app/Http/Requests/Bo/Packages/StorePackageRequest.php index 179cf88..fd008d4 100644 --- a/app/Http/Requests/Bo/Packages/StorePackageRequest.php +++ b/app/Http/Requests/Bo/Packages/StorePackageRequest.php @@ -12,7 +12,7 @@ class StorePackageRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return Gate::allows('isAdmin'); } @@ -22,10 +22,10 @@ class StorePackageRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ - 'name' => 'required|string|min:3|max:255', + 'name' => 'required|string|min:3|max:255', 'amount' => 'required|numeric|min:0|regex:/^\d+(\.\d{1,2})?$/', ]; } @@ -38,7 +38,7 @@ class StorePackageRequest extends FormRequest public function attributes(): array { return [ - 'name' => trans('Nom'), + 'name' => trans('Nom'), 'amount' => trans('Montant (par jour)'), ]; } diff --git a/app/Http/Requests/Bo/Projects/StoreProjectRequest.php b/app/Http/Requests/Bo/Projects/StoreProjectRequest.php index 918ff18..9d1df0d 100644 --- a/app/Http/Requests/Bo/Projects/StoreProjectRequest.php +++ b/app/Http/Requests/Bo/Projects/StoreProjectRequest.php @@ -12,7 +12,7 @@ class StoreProjectRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return Gate::allows('isAdmin'); } @@ -22,10 +22,10 @@ class StoreProjectRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ - 'name' => 'required|string|min:3|max:255|unique:projects,name', + 'name' => 'required|string|min:3|max:255|unique:projects,name', 'site_id' => 'required|exists:sites,id', ]; } diff --git a/app/Http/Requests/Bo/Projects/UpdateProjectRequest.php b/app/Http/Requests/Bo/Projects/UpdateProjectRequest.php index 5e12e4a..746ebaa 100644 --- a/app/Http/Requests/Bo/Projects/UpdateProjectRequest.php +++ b/app/Http/Requests/Bo/Projects/UpdateProjectRequest.php @@ -9,7 +9,7 @@ class UpdateProjectRequest extends StoreProjectRequest * * @return array */ - public function rules() + public function rules(): array { return array_merge(parent::rules(), [ 'name' => 'required|string|min:3|max:255|unique:projects,name,' . $this->route('project')->id . ',id', diff --git a/app/Http/Requests/Bo/Sites/StoreSiteRequest.php b/app/Http/Requests/Bo/Sites/StoreSiteRequest.php index a55bf3c..d13ddac 100644 --- a/app/Http/Requests/Bo/Sites/StoreSiteRequest.php +++ b/app/Http/Requests/Bo/Sites/StoreSiteRequest.php @@ -12,7 +12,7 @@ class StoreSiteRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return Gate::allows('isAdmin'); } @@ -22,16 +22,16 @@ class StoreSiteRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ - 'name' => 'required|string|min:3|max:255', - 'users' => 'nullable|array', - 'users.*.id' => 'required|exists:users,id', - 'gitlab_project_id' => 'nullable|unique:sites,gitlab_project_id', + 'name' => 'required|string|min:3|max:255', + 'users' => 'nullable|array', + 'users.*.id' => 'required|exists:users,id', + 'gitlab_project_id' => 'nullable|unique:sites,gitlab_project_id', 'project_manager_id' => 'nullable|exists:users,id', - 'url_re7' => 'nullable|url', - 'url_prod' => 'nullable|url' + 'url_re7' => 'nullable|url', + 'url_prod' => 'nullable|url' ]; } @@ -43,13 +43,13 @@ class StoreSiteRequest extends FormRequest public function attributes(): array { return [ - 'name' => trans('Nom du site'), - 'users' => trans('Utilisateurs associés au site'), - 'users.*.id' => trans('Élément parmis les Utilisateurs associés au site'), - 'gitlab_project_id' => trans('ID du dépôt Gitlab'), + 'name' => trans('Nom du site'), + 'users' => trans('Utilisateurs associés au site'), + 'users.*.id' => trans('Élément parmis les Utilisateurs associés au site'), + 'gitlab_project_id' => trans('ID du dépôt Gitlab'), 'project_manager_id' => trans('Chef de projet'), - 'url_re7' => trans('Url de RECETTE'), - 'url_prod' => trans('Url de prod') + 'url_re7' => trans('Url de RECETTE'), + 'url_prod' => trans('Url de prod') ]; } } diff --git a/app/Http/Requests/Bo/Sites/UpdateSiteRequest.php b/app/Http/Requests/Bo/Sites/UpdateSiteRequest.php index 56899c7..8aa4397 100644 --- a/app/Http/Requests/Bo/Sites/UpdateSiteRequest.php +++ b/app/Http/Requests/Bo/Sites/UpdateSiteRequest.php @@ -9,7 +9,7 @@ class UpdateSiteRequest extends StoreSiteRequest * * @return array */ - public function rules() + public function rules(): array { return array_merge(parent::rules(), [ 'gitlab_project_id' => 'nullable|unique:sites,gitlab_project_id,' . $this->route('site')->id . ',id', diff --git a/app/Http/Requests/Bo/SortTickets.php b/app/Http/Requests/Bo/SortTickets.php index 8be66fd..e3ada66 100644 --- a/app/Http/Requests/Bo/SortTickets.php +++ b/app/Http/Requests/Bo/SortTickets.php @@ -12,7 +12,7 @@ class SortTickets extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return auth()->check(); } @@ -22,12 +22,12 @@ class SortTickets extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ - 'search' => 'nullable|string', + 'search' => 'nullable|string', 'sort_way' => 'sometimes|in:asc,desc', - 'status' => [ + 'status' => [ 'sometimes', // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed function ($attribute, $value, $fail) { @@ -38,7 +38,7 @@ class SortTickets extends FormRequest } } ], - 'pr' => 'sometimes|int|exists:sites,id' + 'pr' => 'sometimes|int|exists:sites,id' ]; } } diff --git a/app/Http/Requests/Bo/StoreTicket.php b/app/Http/Requests/Bo/StoreTicket.php index e6fa419..097cd14 100644 --- a/app/Http/Requests/Bo/StoreTicket.php +++ b/app/Http/Requests/Bo/StoreTicket.php @@ -14,7 +14,7 @@ class StoreTicket extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return auth()->check(); } @@ -24,7 +24,7 @@ class StoreTicket extends FormRequest * * @return void */ - protected function prepareForValidation() + protected function prepareForValidation(): void { /** @var \App\Models\User|null */ $user = auth()->user(); diff --git a/app/Http/Requests/Bo/TicketTypes/UpdateTicketTypeRequest.php b/app/Http/Requests/Bo/TicketTypes/UpdateTicketTypeRequest.php index 759f50f..dca0361 100644 --- a/app/Http/Requests/Bo/TicketTypes/UpdateTicketTypeRequest.php +++ b/app/Http/Requests/Bo/TicketTypes/UpdateTicketTypeRequest.php @@ -37,7 +37,7 @@ class UpdateTicketTypeRequest extends FormRequest public function attributes(): array { return [ - 'type' => trans('Type'), + 'type' => trans('Type'), 'template' => trans('Template'), ]; } diff --git a/app/Http/Requests/Bo/UpdateChangeOrderRequest.php b/app/Http/Requests/Bo/UpdateChangeOrderRequest.php index d4829c7..d6be727 100644 --- a/app/Http/Requests/Bo/UpdateChangeOrderRequest.php +++ b/app/Http/Requests/Bo/UpdateChangeOrderRequest.php @@ -39,5 +39,4 @@ class UpdateChangeOrderRequest extends FormRequest 'direction' => 'required|boolean', ]; } - } diff --git a/app/Http/Requests/Bo/UpdateTicket.php b/app/Http/Requests/Bo/UpdateTicket.php index 2bde3b8..bb6cf42 100644 --- a/app/Http/Requests/Bo/UpdateTicket.php +++ b/app/Http/Requests/Bo/UpdateTicket.php @@ -2,6 +2,8 @@ namespace App\Http\Requests\Bo; +use Illuminate\Support\Facades\Auth; + class UpdateTicket extends StoreTicket { /** @@ -11,11 +13,12 @@ class UpdateTicket extends StoreTicket */ public function authorize(): bool { - /** @var \App\Models\User|null */ - if (!($user = auth()->user())) { + /** @var \App\Models\User|null $user */ + $user = Auth::user(); + if (!($user)) { return false; } - return auth()->check() and ($user->isAdmin() or + return Auth::check() and ($user->isAdmin() or optional(request()->route()->ticket)->created_by === $user->id ); } diff --git a/app/Http/Requests/Bo/Users/StoreUserRequest.php b/app/Http/Requests/Bo/Users/StoreUserRequest.php index 0faab0e..52f34ee 100644 --- a/app/Http/Requests/Bo/Users/StoreUserRequest.php +++ b/app/Http/Requests/Bo/Users/StoreUserRequest.php @@ -14,7 +14,7 @@ class StoreUserRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { return Gate::allows('isAdmin'); } @@ -24,18 +24,18 @@ class StoreUserRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ - 'name' => 'required|string|min:3|max:255', - 'email' => 'email|required|unique:users,email', - 'role' => [ + 'name' => 'required|string|min:3|max:255', + 'email' => 'email|required|unique:users,email', + 'role' => [ 'required', Rule::in(collect(RoleEnum::cases())->pluck('value')->all()), ], - 'sites' => 'nullable|array', + 'sites' => 'nullable|array', 'sites.*.id' => 'required|exists:sites,id', - 'gitlab_id' => 'nullable|integer|unique:users,gitlab_id' + 'gitlab_id' => 'nullable|integer|unique:users,gitlab_id' ]; } @@ -47,12 +47,12 @@ class StoreUserRequest extends FormRequest public function attributes(): array { return [ - 'name' => trans('Nom de l\'utilisateur'), - 'email' => trans('Email de l\'utilisateur'), - 'role' => trans('Rôle de l\'utilisateur'), - 'sites' => trans('Sites associés à l\'utilisateur'), + 'name' => trans('Nom de l\'utilisateur'), + 'email' => trans('Email de l\'utilisateur'), + 'role' => trans('Rôle de l\'utilisateur'), + 'sites' => trans('Sites associés à l\'utilisateur'), 'sites.*.id' => trans('Élément parmis les sites associés à l\'utilisateur'), - 'gitlab_id' => trans("ID de l'utilisateur Gitlab") + 'gitlab_id' => trans("ID de l'utilisateur Gitlab") ]; } } diff --git a/app/Http/Requests/Bo/Users/UpdateUserRequest.php b/app/Http/Requests/Bo/Users/UpdateUserRequest.php index 0940353..6f575c0 100644 --- a/app/Http/Requests/Bo/Users/UpdateUserRequest.php +++ b/app/Http/Requests/Bo/Users/UpdateUserRequest.php @@ -9,7 +9,7 @@ class UpdateUserRequest extends StoreUserRequest * * @return array */ - public function rules() + public function rules(): array { return array_merge(parent::rules(), [ 'email' => 'email|required|unique:users,email,' . $this->route('user')->id . ',id', diff --git a/app/Http/Resources/UserLabeledResource.php b/app/Http/Resources/UserLabeledResource.php index 712f04c..dc193a1 100644 --- a/app/Http/Resources/UserLabeledResource.php +++ b/app/Http/Resources/UserLabeledResource.php @@ -12,17 +12,17 @@ class UserLabeledResource extends ResourceCollection * Transform the resource collection into an array. * * @param \Illuminate\Http\Request $request - * @return array + * @return \Illuminate\Support\Collection * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ - public function toArray(Request $request) + public function toArray(Request $request): \Illuminate\Support\Collection { // phpcs:enable return $this->collection->mapWithKeys(function (User $user, $key) { return [ $key => [ 'label' => sprintf('%d %s', $user->id, $user->name), - 'key' => $user->id + 'key' => $user->id ] ]; }); diff --git a/app/Interfaces/SpsConfigInterface.php b/app/Interfaces/SpsConfigInterface.php index 1e87835..7e98848 100644 --- a/app/Interfaces/SpsConfigInterface.php +++ b/app/Interfaces/SpsConfigInterface.php @@ -6,11 +6,12 @@ interface SpsConfigInterface { /** * URL method - * Website (SP) url ex: https://le-gaulois-pro.s-web.test + * Website (SP) url ex: https://le-gaulois-pro.s-web.test * * @return string */ public function url(): string; + /** * acsBase64 method * Return destination url base64 encoded @@ -18,6 +19,7 @@ interface SpsConfigInterface * @return string */ public function acsBase64(): string; + /** * destination method * Return acs url concatenated with url @@ -25,6 +27,7 @@ interface SpsConfigInterface * @return string */ public function destination(): string; + /** * logout method * Return sls url concatenated with url @@ -32,6 +35,7 @@ interface SpsConfigInterface * @return string */ public function logout(): string; + /** * certificate method * Return certificate (.pem) file from kebab case of Enum name diff --git a/app/Jobs/AutoCloseOldTickets.php b/app/Jobs/AutoCloseOldTickets.php index c4f2e90..39ee31f 100644 --- a/app/Jobs/AutoCloseOldTickets.php +++ b/app/Jobs/AutoCloseOldTickets.php @@ -15,7 +15,7 @@ class AutoCloseOldTickets * * @return void */ - public function handle() + public function handle(): void { $limitDays = 15; $message = 'En l\'absence d\'activitée depuis 15 jours ce ticket est automatiquement clos et archivé.'; diff --git a/app/Jobs/SendTicketMentionMail.php b/app/Jobs/SendTicketMentionMail.php index eb429fe..01d052d 100644 --- a/app/Jobs/SendTicketMentionMail.php +++ b/app/Jobs/SendTicketMentionMail.php @@ -39,7 +39,7 @@ class SendTicketMentionMail implements ShouldQueue * * @return void */ - public function handle() + public function handle(): void { Mail::to($this->user->email)->send($this->mail); Log::debug(sprintf('Mention mail sent to %s', $this->user->email)); diff --git a/app/Jobs/SendUserCreatedEmail.php b/app/Jobs/SendUserCreatedEmail.php index 56fe1bc..6cd4e46 100644 --- a/app/Jobs/SendUserCreatedEmail.php +++ b/app/Jobs/SendUserCreatedEmail.php @@ -36,7 +36,7 @@ class SendUserCreatedEmail implements ShouldQueue * * @return void */ - public function handle() + public function handle(): void { Mail::to(['email' => $this->user->email]) ->send(new UserCreatedMail($this->user)); diff --git a/app/Jobs/WarnBeforeAutoCloseTicket.php b/app/Jobs/WarnBeforeAutoCloseTicket.php index b77bf33..0ef6629 100644 --- a/app/Jobs/WarnBeforeAutoCloseTicket.php +++ b/app/Jobs/WarnBeforeAutoCloseTicket.php @@ -15,7 +15,7 @@ class WarnBeforeAutoCloseTicket * * @return void */ - public function handle() + public function handle(): void { $warningDays = 7; // phpcs:ignore Generic.Files.LineLength.TooLong diff --git a/app/Lib/Helpers/CollectionHelper.php b/app/Lib/Helpers/CollectionHelper.php index b9e9ecd..f65b955 100644 --- a/app/Lib/Helpers/CollectionHelper.php +++ b/app/Lib/Helpers/CollectionHelper.php @@ -16,7 +16,7 @@ class CollectionHelper * @param integer $pageSize * @return \Illuminate\Pagination\LengthAwarePaginator */ - public static function paginate(Collection $results, int $pageSize): LengthAwarePaginator + public static function paginate(Collection $results, int $pageSize): \Illuminate\Pagination\LengthAwarePaginator { $page = Paginator::resolveCurrentPage('page'); @@ -31,8 +31,11 @@ class CollectionHelper * @param integer $page * @return \Illuminate\Pagination\LengthAwarePaginator */ - public static function paginateManually(Collection $results, int $pageSize, int $page = 1): LengthAwarePaginator - { + public static function paginateManually( + Collection $results, + int $pageSize, + int $page = 1 + ): \Illuminate\Pagination\LengthAwarePaginator { $total = $results->count(); return self::paginator($results->forPage($page, $pageSize), $total, $pageSize, $page, [ @@ -51,14 +54,19 @@ class CollectionHelper * @param array $options * @return \Illuminate\Pagination\LengthAwarePaginator */ - protected static function paginator(Collection $items, int $total, int $perPage, int $currentPage, array $options) - { + protected static function paginator( + Collection $items, + int $total, + int $perPage, + int $currentPage, + array $options + ): \Illuminate\Pagination\LengthAwarePaginator { return Container::getInstance()->makeWith(LengthAwarePaginator::class, [ - 'items' => $items, - 'total' => $total, - 'perPage' => $perPage, + 'items' => $items, + 'total' => $total, + 'perPage' => $perPage, 'currentPage' => $currentPage, - 'options' => $options + 'options' => $options ]); } } diff --git a/app/Lib/Helpers/ExceptionsHelper.php b/app/Lib/Helpers/ExceptionsHelper.php index 4813275..4d15d69 100644 --- a/app/Lib/Helpers/ExceptionsHelper.php +++ b/app/Lib/Helpers/ExceptionsHelper.php @@ -5,7 +5,7 @@ namespace App\Lib\Helpers; class ExceptionsHelper { /** - * Handle sentry event + * Handle sentry event. * * @param \Sentry\Event $event * @return null|\Sentry\Event @@ -26,7 +26,7 @@ class ExceptionsHelper } /** - * Anonimize Sentry Exception bag + * Anonimize Sentry Exception bag. * * @param \Sentry\ExceptionDataBag $exceptionDataBag * @return \Sentry\ExceptionDataBag @@ -42,7 +42,7 @@ class ExceptionsHelper } /** - * Anonymise sentry stacktrace + * Anonymise sentry stacktrace. * * @param \Sentry\Stacktrace $stackTrace * @return \Sentry\Stacktrace @@ -70,7 +70,7 @@ class ExceptionsHelper } /** - * Get anonymized sentry params + * Get anonymized sentry params. * * @param mixed[] $params * @return string[] @@ -105,7 +105,7 @@ class ExceptionsHelper /** - * Anonymize at least Sql queries + * Anonymize at least Sql queries. * * @param string $message * @return string @@ -120,7 +120,7 @@ class ExceptionsHelper } /** - * Anonymize stack trace + * Anonymize stack trace. * * @param \Throwable $e * @return string @@ -159,7 +159,7 @@ class ExceptionsHelper } /** - * Handle Args + * Handle Args. * * @param array $stack * @return string diff --git a/app/Lib/Helpers/FileStorageHelper.php b/app/Lib/Helpers/FileStorageHelper.php index a6a783d..934902c 100644 --- a/app/Lib/Helpers/FileStorageHelper.php +++ b/app/Lib/Helpers/FileStorageHelper.php @@ -175,7 +175,7 @@ class FileStorageHelper /** * Remove all old files from string attribute html that are stored in public that - * are nove present anymore on new html string + * are nove present anymore on new html string. * * @param string $newHtmlString The html string with alreadyParsed files using storeModelFilesFromHtml. * @param string $oldHtmlString The old html string with alreadyParsed files using storeModelFilesFromHtml. @@ -188,7 +188,7 @@ class FileStorageHelper /** * Remove all old files that are stored in public that - * are not present anymore on new array files + * are not present anymore on new array files. * * @param string[] $oldFiles The old array files. * @param string[] $newFiles The new array files. @@ -208,7 +208,7 @@ class FileStorageHelper } /** - * Remove all files from string attribute html that are stored in public + * Remove all files from string attribute html that are stored in public. * * @param string $htmlString The html string with alreadyParsed files using storeModelFilesFromHtml. * @return void @@ -225,7 +225,7 @@ class FileStorageHelper } /** - * Find all occurence of files in html + * Find all occurence of files in html. * * @param string $html * @return array @@ -241,7 +241,7 @@ class FileStorageHelper /** * Filter array to get only uploaded files that exists - * on disk 'public' (using helper storage strategy) + * on disk 'public' (using helper storage strategy). * * @param array $urls * @return array @@ -261,8 +261,7 @@ class FileStorageHelper } /** - * Filter array to get only uploaded files that exists - * on disk 'uploads' + * Filter array to get only uploaded files that exists on disk 'uploads'. * * @param array $urls * @return array @@ -284,8 +283,7 @@ class FileStorageHelper } /** - * Prepare storage path and return - * the file full path + * Prepare storage path and return the file full path. * * @param string $tableName Model table name. * @param string $filename The basename for the file. @@ -316,7 +314,7 @@ class FileStorageHelper /** * Create sub folders to store files using pattern * storage/modelfiles/posts/10/04/19/5f - * year/month/day/md5 first 2 letters + * year/month/day/md5 first 2 letters. * * @param string $storage_dir * @param string $table @@ -342,7 +340,7 @@ class FileStorageHelper } /** - * Get unique filename if the path is already occupied + * Get unique filename if the path is already occupied. * * @param string $folderPath * @param string $filename @@ -365,7 +363,7 @@ class FileStorageHelper } /** - * Slugify the filename + * Slugify the filename. * * @param string $filename * @return string @@ -376,7 +374,7 @@ class FileStorageHelper } /** - * Sanitize File name for uploaded files + * Sanitize File name for uploaded files. * * @param string $filename The original uploaded client file name. * @param boolean $beautify Beautify the filename. @@ -402,7 +400,7 @@ class FileStorageHelper $filename = Str::of($filename)->ltrim('.-'); // * Optional beautification if ($beautify) { - $filename = static::beautifyFilename($filename); + $filename = self::beautifyFilename($filename); } // * Maximize filename length to 255 bytes http://serverfault.com/a/9548/44086 /** @var string */ @@ -421,7 +419,7 @@ class FileStorageHelper } /** - * Beautify a filename + * Beautify a filename. * * @param string $filename * @return string diff --git a/app/Lib/Helpers/ToolboxHelper.php b/app/Lib/Helpers/ToolboxHelper.php index 507eadc..df75edc 100644 --- a/app/Lib/Helpers/ToolboxHelper.php +++ b/app/Lib/Helpers/ToolboxHelper.php @@ -2,8 +2,8 @@ namespace App\Lib\Helpers; -use Illuminate\Contracts\Database\Eloquent\Builder; use Illuminate\Contracts\Pagination\LengthAwarePaginator; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Http\Request; use Illuminate\Support\Facades\File; @@ -57,7 +57,7 @@ class ToolboxHelper } /** - * Check uri points to image file + * Check uri points to image file. * * @param string $url * @return boolean @@ -69,7 +69,7 @@ class ToolboxHelper } /** - * Check uri points to pdf file + * Check uri points to pdf file. * * @param string $url * @return boolean @@ -85,7 +85,7 @@ class ToolboxHelper * Only embed allowed are for MP4 self hosted videos right now * * https is force by ckeditor MediaElements which natively supports - * only cloud hosted medias (youtube, spotify etc..) + * only cloud hosted medias (youtube, spotify etc..). * * @param string $input * @return string @@ -97,7 +97,7 @@ class ToolboxHelper } /** - * Assert That no Back Office url is present on txt + * Assert That no Back Office url is present on txt. * * @param string $field * @param string $text @@ -140,7 +140,7 @@ class ToolboxHelper } /** - * Assert That only external url is present on txt + * Assert That only external url is present on txt. * * @param string $field * @param string $text @@ -184,7 +184,7 @@ class ToolboxHelper } /** - * Assert Is Unique + * Assert Is Unique. * * @param \Illuminate\Database\Eloquent\Model $model * @param array $columns @@ -235,7 +235,7 @@ class ToolboxHelper } /** - * Mutltibyte string replace + * Mutltibyte string replace. * * @param array|string $search * @param array|string $replace @@ -279,7 +279,7 @@ class ToolboxHelper } /** - * Asserts that the field is unique + * Asserts that the field is unique. * * @param string $table * @param string $field @@ -295,7 +295,7 @@ class ToolboxHelper string|int|float|bool|null|array $value, ?int $id = null, ?callable $query = null - ) { + ): void { if (!$query) { Validator::make([$field => $value], [ self::mbReplace('.', '\.', $field) => Rule::unique($table, $field)->ignore($id), @@ -316,7 +316,7 @@ class ToolboxHelper } /** - * Get original polyfill with autotranslate behavior + * Get original polyfill with autotranslate behavior. * * @param \Illuminate\Database\Eloquent\Model $model * @param string $attribute @@ -335,20 +335,20 @@ class ToolboxHelper } /** - * Dynamic model query + * Dynamic model query. * - * @param string $defaultLocale - * @param \Illuminate\Contracts\Database\Eloquent\Builder $q - * @param string $column - * @param string $value - * @return \Illuminate\Contracts\Database\Eloquent\Builder + * @param string $defaultLocale + * @param \Illuminate\Database\Eloquent\Builder $q + * @param string $column + * @param string $value + * @return \Illuminate\Database\Eloquent\Builder */ public static function queryColumnWithLocales( string $defaultLocale, Builder $q, string $column, string $value - ): Builder { + ): \Illuminate\Contracts\Database\Eloquent\Builder { $currentLocale = app()->currentLocale(); $locales = collect(config('app.locales')) ->mapWithKeys(fn(string $locale) => [$locale => $locale]); @@ -376,7 +376,7 @@ class ToolboxHelper } /** - * Generates an array from a dot separated string + * Generates an array from a dot separated string. * * @param string $path * @param mixed $value @@ -395,7 +395,7 @@ class ToolboxHelper } /** - * Convert deeply an object to array + * Convert deeply an object to array. * * @param array|object $input * @return array @@ -418,7 +418,7 @@ class ToolboxHelper } /** - * Convert deeply an array to object + * Convert deeply an array to object. * * @param array|object $input * @return object @@ -441,15 +441,15 @@ class ToolboxHelper } /** - * Validate picture + * Validate picture. * * @param string $attribute * @param string|null $value - * @param callback $fail + * @param callable $fail * @param object $sizes * @return void */ - public static function validatePicture(string $attribute, string|null $value, callable $fail, object $sizes) + public static function validatePicture(string $attribute, string|null $value, callable $fail, object $sizes): void { if (!($useStorage = Storage::exists($value)) and !File::exists($value)) { $fail(trans(':attribute n\'existe pas dans le système de fichier', [ @@ -502,7 +502,7 @@ class ToolboxHelper } /** - * Get the file full path + * Get the file full path. * * @param string $value * @param boolean $useStorage @@ -516,13 +516,13 @@ class ToolboxHelper } /** - * Get the file mimetype + * Get the file mimetype. * * @param string $value * @param boolean $useStorage * @return string|false */ - private static function getUploadedFileMimeType(string $value, bool $useStorage) + private static function getUploadedFileMimeType(string $value, bool $useStorage): string|false { return !$useStorage ? File::mimeType($value) : Storage::mimeType($value); } @@ -559,6 +559,6 @@ class ToolboxHelper ] ); - return \response()->json($models ?? 500); + return \response()->json($models); } } diff --git a/app/Listeners/AddStatusMessages.php b/app/Listeners/AddStatusMessages.php index 1edf542..6587a27 100644 --- a/app/Listeners/AddStatusMessages.php +++ b/app/Listeners/AddStatusMessages.php @@ -16,7 +16,7 @@ class AddStatusMessages * @return void * @phpcs:disable Generic.Metrics.CyclomaticComplexity */ - public function handle(TicketStatusChanged $event) + public function handle(TicketStatusChanged $event): void { // phpcs:enable $message = new Message(); diff --git a/app/Listeners/SendNotificationMailToAdmin.php b/app/Listeners/SendNotificationMailToAdmin.php index 8498763..e4b189f 100644 --- a/app/Listeners/SendNotificationMailToAdmin.php +++ b/app/Listeners/SendNotificationMailToAdmin.php @@ -14,7 +14,7 @@ class SendNotificationMailToAdmin * @param \App\Events\NotifyAdmin $event * @return void */ - public function handle(NotifyAdmin $event) + public function handle(NotifyAdmin $event): void { $ticket = $event->ticket; Mail::to(config('mail.MAIL_ADMIN')) diff --git a/app/Listeners/SendNotificationMailToTicketCreator.php b/app/Listeners/SendNotificationMailToTicketCreator.php index edd52b6..368ae80 100644 --- a/app/Listeners/SendNotificationMailToTicketCreator.php +++ b/app/Listeners/SendNotificationMailToTicketCreator.php @@ -14,10 +14,12 @@ class SendNotificationMailToTicketCreator * @param \App\Events\NotifyTicketCreator $event * @return void */ - public function handle(NotifyTicketCreator $event) + public function handle(NotifyTicketCreator $event): void { $ticket = $event->ticket; - Mail::to($ticket->user()->withTrashed()->first()->email) + /** @var \App\Models\User */ + $user = $ticket->user(); + Mail::to($user->withTrashed()->first()->email) ->send(new TicketUpdate($ticket, $event->corpsMaj)); } } diff --git a/app/Listeners/SendSubscriptionsNotificationsMail.php b/app/Listeners/SendSubscriptionsNotificationsMail.php index 1f46865..3bdf2cf 100644 --- a/app/Listeners/SendSubscriptionsNotificationsMail.php +++ b/app/Listeners/SendSubscriptionsNotificationsMail.php @@ -16,7 +16,7 @@ class SendSubscriptionsNotificationsMail * @param \App\Events\NotifySubscriptions $event * @return void */ - public function handle(NotifySubscriptions $event) + public function handle(NotifySubscriptions $event): void { $ignoreConnectedUserEmail = Auth::user()->email ?? ''; $ignoreUsers = $event->ignoreUsers ?? collect(); diff --git a/app/Mail/NewTicket.php b/app/Mail/NewTicket.php index 41cc0fd..c1d5699 100644 --- a/app/Mail/NewTicket.php +++ b/app/Mail/NewTicket.php @@ -31,10 +31,10 @@ class NewTicket extends Mailable * * @return $this */ - public function build() + public function build(): self { $ticket = $this->ticket; return $this->subject("[Support] Nouveau ticket n°" . $ticket->id) - ->view('emails.new-ticket', compact('ticket')); + ->view('emails.new-ticket', compact('ticket')); } } diff --git a/app/Mail/TicketMention.php b/app/Mail/TicketMention.php index 005f6d4..10ce855 100644 --- a/app/Mail/TicketMention.php +++ b/app/Mail/TicketMention.php @@ -37,11 +37,11 @@ class TicketMention extends Mailable * * @return $this */ - public function build() + public function build(): self { $ticket = $this->ticket; $corpsMaj = ToolboxHelper::plainToHtml($this->corpsMaj); return $this->subject("[Support] Vous avez été mentionné sur le ticket n° $ticket->id") - ->view('emails.ticket-mention', compact('ticket', 'corpsMaj')); + ->view('emails.ticket-mention', compact('ticket', 'corpsMaj')); } } diff --git a/app/Mail/TicketUpdate.php b/app/Mail/TicketUpdate.php index fc64140..c50bd29 100644 --- a/app/Mail/TicketUpdate.php +++ b/app/Mail/TicketUpdate.php @@ -37,11 +37,13 @@ class TicketUpdate extends Mailable * * @return $this */ - public function build() + public function build(): self { - $ticket = $this->ticket; + $ticket = $this->ticket; + /** @var \App\Models\Site */ + $site = $ticket->site; $corpsMaj = \html_entity_decode(ToolboxHelper::plainToHtml($this->corpsMaj)); - return $this->subject("[Support][{$ticket->site->name}] Ticket n°$ticket->id") - ->view('emails.ticket-update', compact('ticket', 'corpsMaj')); + return $this->subject("[Support][{$site->name}] Ticket n°$ticket->id") + ->view('emails.ticket-update', compact('ticket', 'corpsMaj')); } } diff --git a/app/Mail/UserCreatedMail.php b/app/Mail/UserCreatedMail.php index 0019e4e..03bdde5 100644 --- a/app/Mail/UserCreatedMail.php +++ b/app/Mail/UserCreatedMail.php @@ -26,7 +26,7 @@ class UserCreatedMail extends Mailable * * @return $this */ - public function build() + public function build(): self { return $this ->subject(sprintf('%s : Votre compte a été crée', config('app.name'))) diff --git a/app/Models/Brand.php b/app/Models/Brand.php index b5513db..bbaf3c8 100644 --- a/app/Models/Brand.php +++ b/app/Models/Brand.php @@ -16,7 +16,7 @@ class Brand extends Model /** * The attributes that are fillable. * - * @var array + * @var list */ protected $fillable = [ 'name' @@ -50,6 +50,7 @@ class Brand extends Model */ public static function deleteSites(Brand $brand): void { + /** @var \App\Models\Site $site */ foreach ($brand->sites as $site) { $site->brand_id = null; $site->saveOrFail(); @@ -63,7 +64,7 @@ class Brand extends Model * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function sites() + public function sites(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(Site::class); } @@ -73,7 +74,7 @@ class Brand extends Model * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function accounts() + public function accounts(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(Account::class); } diff --git a/app/Models/Company.php b/app/Models/Company.php index 63cd49d..2b26ad7 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -16,7 +16,7 @@ class Company extends Model /** * The attributes that are fillable. * - * @var array + * @var list */ protected $fillable = [ 'name' @@ -25,28 +25,28 @@ class Company extends Model /** * The accessors to append to the model's array form. * - * @var array + * @var list */ protected $appends = [ 'value' ]; /** - * HasMany Invoices + * HasMany Invoices. * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function invoices() + public function invoices(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(Invoice::class); } /** - * Return value attribute for belongsto search component + * Return value attribute for belongsto search component. * * @return \Illuminate\Database\Eloquent\Casts\Attribute */ - protected function value(): Attribute + protected function value(): \Illuminate\Database\Eloquent\Casts\Attribute { return new Attribute( get: fn () => $this->id, diff --git a/app/Models/Credit/Account.php b/app/Models/Credit/Account.php index 865b6da..236e9a4 100644 --- a/app/Models/Credit/Account.php +++ b/app/Models/Credit/Account.php @@ -7,10 +7,10 @@ use App\Models\Brand; use Illuminate\Database\Eloquent\Model; /** - * @property string $label - * @property AccountTypeEnum $type - * @property integer $balance - * @property Brand $brand_id + * @property string $label + * @property \App\Enums\Credit\AccountTypeEnum $type + * @property integer $balance + * @property integer $brand_id */ class Account extends Model { @@ -24,7 +24,7 @@ class Account extends Model /** * The attributes that are fillable. * - * @var array + * @var list */ protected $fillable = [ 'label', @@ -36,7 +36,7 @@ class Account extends Model /** * The attributes that should be cast. * - * @var array + * @var array */ protected $casts = [ 'type' => AccountTypeEnum::class @@ -47,7 +47,7 @@ class Account extends Model * * @return void */ - protected static function booted() + protected static function booted(): void { static::deleting(function () { throw new \Error('Action impossible'); @@ -61,7 +61,7 @@ class Account extends Model * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function brand() + public function brand(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Brand::class); } @@ -71,7 +71,7 @@ class Account extends Model * * @return \Illuminate\Database\Eloquent\Relations\HasOne */ - public function creditlogs() + public function creditlogs(): \Illuminate\Database\Eloquent\Relations\HasOne { return $this->HasOne(CreditLog::class, 'credit_account_id'); } diff --git a/app/Models/Credit/CreditLog.php b/app/Models/Credit/CreditLog.php index dc8c250..4d06471 100644 --- a/app/Models/Credit/CreditLog.php +++ b/app/Models/Credit/CreditLog.php @@ -6,10 +6,10 @@ use App\Enums\Credit\BalanceOperationEnum; use Illuminate\Database\Eloquent\Model; /** - * @property BalanceOperationEnum $type - * @property double $amount - * @property Account $credit_account_id - * @property date $created_at + * @property \App\Enums\Credit\BalanceOperationEnum $type + * @property double $amount + * @property Account $credit_account_id + * @property \Illuminate\Support\Carbon $created_at */ class CreditLog extends Model { @@ -23,7 +23,7 @@ class CreditLog extends Model /** * The attributes that are fillable. * - * @var array + * @var list */ protected $fillable = [ 'type', @@ -35,7 +35,7 @@ class CreditLog extends Model /** * The attributes that should be cast. * - * @var array + * @var array */ protected $casts = [ 'type' => BalanceOperationEnum::class @@ -46,7 +46,7 @@ class CreditLog extends Model * * @return void */ - protected static function booted() + protected static function booted(): void { static::creating(function (self $model) { $model->created_at = now(); @@ -66,22 +66,22 @@ class CreditLog extends Model // * RELATIONSHIPS /** - * BelongsToMany estimation relation (1 nullable) + * BelongsToMany estimation relation (1 nullable). * * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ - public function estimation() + public function estimation(): \Illuminate\Database\Eloquent\Relations\BelongsToMany { return $this->belongsToMany(Estimation::class, EstimationLog::class, 'credit_log_id', 'credit_estimation_id') ->withTimestamps(); } /** - * BelongsTo account relation + * BelongsTo account relation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function account() + public function account(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Account::class, 'credit_account_id'); } diff --git a/app/Models/Credit/Estimation.php b/app/Models/Credit/Estimation.php index 2069164..5ff14ea 100644 --- a/app/Models/Credit/Estimation.php +++ b/app/Models/Credit/Estimation.php @@ -14,7 +14,7 @@ class Estimation extends Model /** * The attributes that should be cast to native types. * - * @var array + * @var array */ protected $casts = [ 'status' => EstimationStatusEnum::class @@ -30,7 +30,7 @@ class Estimation extends Model /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'amount', 'status', 'credit_account_id' @@ -41,7 +41,7 @@ class Estimation extends Model * * @return void */ - protected static function booted() + protected static function booted(): void { static::updating(function (self $model) { if (!$model->original['validator_id'] !== $model->validator_id) { @@ -62,43 +62,43 @@ class Estimation extends Model // * RELATIONSHIPS /** - * BelongsTo Ticket relation + * BelongsTo Ticket relation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function ticket() + public function ticket(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Ticket::class); } /** - * BelongsTo Credit\Account relation + * BelongsTo Credit\Account relation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function account() + public function account(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Account::class, 'credit_account_id'); } /** * BelongsTo User relation - * The use who created the estimate + * The use who created the estimate. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function estimator() + public function estimator(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'estimator_id'); } /** * BelongsTo User relation (nullable) - * The use who validated the estimate + * The use who validated the estimate. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function validator() + public function validator(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'validator_id'); } diff --git a/app/Models/Information.php b/app/Models/Information.php index 40d377b..73c69f8 100644 --- a/app/Models/Information.php +++ b/app/Models/Information.php @@ -32,7 +32,7 @@ class Information extends Model /** * The attributes that are fillable. * - * @var array + * @var list */ protected $fillable = [ 'title', @@ -43,7 +43,7 @@ class Information extends Model /** * The attributes that should be cast. * - * @var array + * @var array */ protected $casts = [ 'type' => InfoColorsEnum::class, @@ -56,7 +56,7 @@ class Information extends Model * * @return void */ - protected static function booted() + protected static function booted(): void { static::created(function () { cache()->put('infos', Information::all(), 3600); diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 75244de..768cf98 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -9,7 +9,6 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Str; -use Mccarlosen\LaravelMpdf\LaravelMpdf; /** * @property string $ref @@ -36,7 +35,7 @@ class Invoice extends Model /** * The attributes that are fillable. * - * @var array + * @var list */ protected $fillable = [ 'ref', @@ -60,14 +59,14 @@ class Invoice extends Model /** * The attributes that should be cast. * - * @var array + * @var array */ protected $casts = [ - 'tasks' => 'array', - 'signed_date' => 'date', - 'sent_client_date' => 'date', + 'tasks' => 'array', + 'signed_date' => 'date', + 'sent_client_date' => 'date', 'sent_accounting_date' => 'date', - 'status' => InvoiceStatusEnum::class, + 'status' => InvoiceStatusEnum::class, ]; /** @@ -75,7 +74,7 @@ class Invoice extends Model * * @return void */ - protected static function booted() + protected static function booted(): void { static::creating(function (self $model) { $model->ref = \sprintf( @@ -118,30 +117,30 @@ class Invoice extends Model // * RELATIONSHIPS /** - * BelongsTo Site + * BelongsTo Site. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function site() + public function site(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->BelongsTo(Site::class); } /** - * BelongsTo Company + * BelongsTo Company. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function company() + public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->BelongsTo(Company::class); } /** - * BelongsTo Company + * BelongsTo Company. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function companyInvoiced() + public function companyInvoiced(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->BelongsTo(Company::class, 'invoiced_to_id'); } @@ -149,9 +148,9 @@ class Invoice extends Model // * METHODS /** - * Get the tasks line structure skel + * Get the tasks line structure skel. * - * @return array + * @return array */ public static function getTaskStructure(): array { @@ -170,11 +169,11 @@ class Invoice extends Model } /** - * Generate Invoice + * Generate Invoice. * - * @return LaravelMpdf + * @return \Mccarlosen\LaravelMpdf\LaravelMpdf */ - public function generateInvoice(): LaravelMpdf + public function generateInvoice(): \Mccarlosen\LaravelMpdf\LaravelMpdf { /** @var \Illuminate\Database\Eloquent\Collection<\App\Models\Package> */ $packages = Package::get()->keyBy('id')->all(); @@ -186,10 +185,10 @@ class Invoice extends Model 'bo.pages.documents.invoice', $this->toArray(), [ - 'site' => $this->site, - 'company' => $this->company, + 'site' => $this->site, + 'company' => $this->company, 'companyInvoiced' => $this->companyInvoiced, - 'packages' => $packages, + 'packages' => $packages, ], [ 'mode' => '', diff --git a/app/Models/Label.php b/app/Models/Label.php index 903d86c..474fcaa 100644 --- a/app/Models/Label.php +++ b/app/Models/Label.php @@ -21,7 +21,7 @@ class Label extends Model /** * The attributes that should be cast. * - * @var array + * @var array */ protected $casts = [ 'color' => HtmlColor::class, @@ -30,7 +30,7 @@ class Label extends Model /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'name', @@ -42,7 +42,7 @@ class Label extends Model * * @return void */ - protected static function booted() + protected static function booted(): void { static::creating(function (self $model) { ToolboxHelper::assertIsUnique($model, ['name']); @@ -59,7 +59,7 @@ class Label extends Model * * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ - public function tickets() + public function tickets(): \Illuminate\Database\Eloquent\Relations\BelongsToMany { return $this->belongsToMany(Ticket::class); } @@ -69,7 +69,7 @@ class Label extends Model * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function site() + public function site(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Site::class); } diff --git a/app/Models/Message.php b/app/Models/Message.php index 41daedd..591ee77 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -9,12 +9,9 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; /** - * - * @property string $message The message content. + * @property string $message The message content. * @property \App\Enums\MessageTypeEnum $type The message is not visible for clients. - * @property string $file The message joined file path. - * - * @package App\Models + * @property string $file The message joined file path. */ class Message extends Model { @@ -23,7 +20,7 @@ class Message extends Model /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'message', @@ -33,7 +30,7 @@ class Message extends Model /** * The attributes that should be cast to native types. * - * @var array + * @var array */ protected $casts = [ 'type' => MessageTypeEnum::class @@ -44,7 +41,7 @@ class Message extends Model * * @return void */ - protected static function booted() + protected static function booted(): void { static::created(function (Message $message) { $message->load(['user' => function ($q) { @@ -109,7 +106,7 @@ class Message extends Model event(new NotifySubscriptions( $message->ticket, trans('Nouvelle réponse de :name :
:message', [ - 'name' => $message->user->name, + 'name' => $message->user->name, 'message' => $message->message ]), $dontNotifyUsers @@ -125,7 +122,7 @@ class Message extends Model * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function ticket() + public function ticket(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Ticket::class, 'ticket_id'); } @@ -135,7 +132,7 @@ class Message extends Model * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function user() + public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'user_id'); } diff --git a/app/Models/Package.php b/app/Models/Package.php index 947e30b..9200f4a 100644 --- a/app/Models/Package.php +++ b/app/Models/Package.php @@ -23,7 +23,7 @@ class Package extends Model /** * The attributes that are fillable. * - * @var array + * @var list */ protected $fillable = [ 'name', diff --git a/app/Models/Project.php b/app/Models/Project.php index 4461b3c..b6b740e 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -16,7 +16,7 @@ class Project extends Model /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'name', @@ -30,7 +30,7 @@ class Project extends Model * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function site() + public function site(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Site::class); } diff --git a/app/Models/Site.php b/app/Models/Site.php index d8aa825..44195b1 100644 --- a/app/Models/Site.php +++ b/app/Models/Site.php @@ -10,11 +10,11 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; /** - * @property string $name - * @property string $url_re7 - * @property string $url_prod - * @property integer $gitlab_project_id - * @property Brand $brand_id + * @property string $name + * @property string $url_re7 + * @property string $url_prod + * @property integer $gitlab_project_id + * @property integer|null $brand_id */ class Site extends Model { @@ -24,7 +24,7 @@ class Site extends Model /** * The attributes that are fillable. * - * @var array + * @var list */ protected $fillable = [ 'name', @@ -37,7 +37,7 @@ class Site extends Model /** * The accessors to append to the model's array form. * - * @var array + * @var list */ protected $appends = [ 'value' @@ -49,7 +49,7 @@ class Site extends Model * * @return void */ - protected static function booted() + protected static function booted(): void { static::creating(function (self $model) { self::manageFields($model); @@ -64,10 +64,10 @@ class Site extends Model /** * Common methods function. * - * @param Model $model + * @param self $model * @return void */ - private static function manageFields(Model $model) + private static function manageFields(self $model): void { if ($model->url_re7) { ToolboxHelper::assertNoInternalUrls('url_re7', $model->url_re7); @@ -82,31 +82,31 @@ class Site extends Model /** * HasMany Message relation - * The users of type client that would have access to this site tickets + * The users of type client that would have access to this site tickets. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ - public function users() + public function users(): \Illuminate\Database\Eloquent\Relations\BelongsToMany { return $this->belongsToMany(User::class); } /** - * HasMany Ticket relation + * HasMany Ticket relation. * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function tickets() + public function tickets(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(Ticket::class, 'site_id'); } /** - * BelongsTo Brand relation + * BelongsTo Brand relation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function brand() + public function brand(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Brand::class); } @@ -127,20 +127,20 @@ class Site extends Model * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function project() + public function project(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Project::class); } /** - * Return value attribute for belongsto search component + * Return value attribute for belongsto search component. * * @return \Illuminate\Database\Eloquent\Casts\Attribute */ - protected function value(): Attribute + protected function value(): \Illuminate\Database\Eloquent\Casts\Attribute { return new Attribute( - get: fn () => $this->id, + get: fn() => $this->id, ); } } diff --git a/app/Models/Ticket.php b/app/Models/Ticket.php index 5eda697..42f78ee 100644 --- a/app/Models/Ticket.php +++ b/app/Models/Ticket.php @@ -16,9 +16,21 @@ use App\Models\Ticket\TicketType; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\ModelNotFoundException; -use Illuminate\Support\Collection; use Illuminate\Support\Str; +/** + * @property string $title The message joined file path. + * @property string $text Ticket description. + * @property \App\Models\Site $site_id Site associated. + * @property \App\Enums\Tickets\TicketTypeEnum $type Ticket type. + * @property \App\Enums\Tickets\TicketStatusEnum $status Ticket status. + * @property integer $is_internal Internal ticket or not. + * @property integer $order Ticket order. + * @property \Carbon\Carbon $date_mep Production date wished. + * @property \Carbon\Carbon $last_activity Last activity in the ticket. + * @property-read \Carbon\Carbon $created_at Created date. + * @property-read \Carbon\Carbon $updated_at Updated date. + */ class Ticket extends Model { use HasFactory; @@ -26,24 +38,24 @@ class Ticket extends Model /** * The attributes that are fillable. * - * @var array + * @var list */ protected $fillable = [ + 'title', + 'text', 'site_id', 'type', 'status', + 'is_internal', 'order', 'date_mep', - 'text', - 'title', - 'is_internal', 'last_activity', ]; /** * The attributes that should be cast. * - * @var array + * @var array */ protected $casts = [ 'is_internal' => 'bool', @@ -58,7 +70,7 @@ class Ticket extends Model * * @return void */ - protected static function booted() + protected static function booted(): void { static::creating(function (Ticket $ticket) { // If bug force the ticket status on new. All the others are estimateTodo. @@ -70,7 +82,10 @@ class Ticket extends Model } }); static::updating(function (Ticket $ticket) { - if (!$ticket->original['status'] !== $ticket->status->value && $ticket->original['order'] === $ticket->order) { + if ( + !$ticket->original['status'] !== $ticket->status->value && + $ticket->original['order'] === $ticket->order + ) { event(new TicketStatusChanged( $ticket, TicketStatusEnum::make($ticket->original['status']), @@ -104,91 +119,93 @@ class Ticket extends Model */ private static function setOrder(self $model, bool $isArchived = false): void { - $model->order = \intval(self::query()->where('status', $isArchived ? '=' : '!=', TicketStatusEnum::archived)->max('order')) + 1; + $model->order = \intval(self::query() + ->where('status', $isArchived ? '=' : '!=', TicketStatusEnum::archived) + ->max('order')) + 1; } // * RELATIONSHIPS /** - * HasOne Credit\Estimation relation + * HasOne Credit\Estimation relation. * * @return \Illuminate\Database\Eloquent\Relations\HasOne */ - public function estimation() + public function estimation(): \Illuminate\Database\Eloquent\Relations\HasOne { return $this->hasOne(Estimation::class); } /** - * BelongsTo Site relation + * BelongsTo Site relation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function site() + public function site(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Site::class); } /** * BelongsTo User relation - * The user that created the ticket + * The user that created the ticket. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function user() + public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'created_by'); } /** * BelongsTo User relation - * The user that is in charge of the ticket + * The user that is in charge of the ticket. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function assignedUser() + public function assignedUser(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'assigned_to'); } /** - * HasMany Message relation + * HasMany Message relation. * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function messages() + public function messages(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(Message::class, 'ticket_id'); } /** * BelongsToMany User relation - * The Users that are following this ticket + * The Users that are following this ticket. * * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ - public function subscriptions() + public function subscriptions(): \Illuminate\Database\Eloquent\Relations\BelongsToMany { return $this->belongsToMany(User::class, 'subscriptions'); } /** - * BelongsToMany Label relation + * BelongsToMany Label relation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ - public function labels() + public function labels(): \Illuminate\Database\Eloquent\Relations\BelongsToMany { return $this->belongsToMany(Label::class, 'label_ticket'); } /** - * BelongsTo ticket_type + * BelongsTo ticket_type. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function ticketType() + public function ticketType(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(TicketType::class, 'type', 'type'); } @@ -207,12 +224,12 @@ class Ticket extends Model /** * Parse message @user tags and send emails to concerned users - * returns and array with to users notified + * returns and array with to users notified. * * @param Message $message - * @return Collection + * @return \Illuminate\Support\Collection */ - public function sendBeenMentionnedToUser(Message $message): Collection + public function sendBeenMentionnedToUser(Message $message): \Illuminate\Support\Collection { $ticket = $this; // Find @user + send mail si un seul user est trouvé. @@ -259,14 +276,14 @@ class Ticket extends Model } /** - * full_name getter + * full_name getter. * * @return string */ public function getFullNameAttribute(): string { return trans('Ticket n° :ticketId : :ticketSiteName', [ - 'ticketId' => $this->id, + 'ticketId' => $this->id, 'ticketSiteName' => $this->site->name ]); } @@ -280,7 +297,8 @@ class Ticket extends Model public function accountIsValidForThisTicket(Account $account): bool { /** @var \App\Models\Brand|null */ - if (!($siteBrand = optional($this->site)->brand)) { + $siteBrand = optional($this->site)->brand; + if (!$siteBrand) { return false; } diff --git a/app/Models/Ticket/TicketType.php b/app/Models/Ticket/TicketType.php index 264ec40..8604f88 100644 --- a/app/Models/Ticket/TicketType.php +++ b/app/Models/Ticket/TicketType.php @@ -19,7 +19,7 @@ class TicketType extends Model /** * The attributes that are fillable. * - * @var array + * @var list */ protected $fillable = [ 'type', @@ -29,7 +29,7 @@ class TicketType extends Model /** * The attributes that should be cast. * - * @var array + * @var array */ protected $casts = [ 'type' => TicketTypeEnum::class, @@ -40,7 +40,7 @@ class TicketType extends Model * * @return void */ - protected static function booted() + protected static function booted(): void { static::creating(function () { throw new \Error('Action impossible'); @@ -56,11 +56,11 @@ class TicketType extends Model // * RELATIONSHIPS /** - * BelongsToMany tickets + * BelongsToMany tickets. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function tickets() + public function tickets(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(Ticket::class, 'type', 'type'); } diff --git a/app/Models/User.php b/app/Models/User.php index 4b1a499..cfa82fb 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -5,7 +5,6 @@ namespace App\Models; use App\Enums\Users\RoleEnum; use App\Jobs\SendUserCreatedEmail; use App\Notifications\ResetPassword; -use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; @@ -20,7 +19,7 @@ use Illuminate\Support\Str; * @property string $password * @property string $remember_token * @property RoleEnum $role - * @property Collection $sites + * @property \Illuminate\Database\Eloquent\Collection $sites */ class User extends Authenticatable { @@ -38,7 +37,7 @@ class User extends Authenticatable /** * The attributes that are fillable. * - * @var array + * @var list */ protected $fillable = [ 'name', @@ -52,7 +51,7 @@ class User extends Authenticatable /** * The attributes that should be hidden for arrays. * - * @var array + * @var list */ protected $hidden = [ 'password', @@ -62,11 +61,11 @@ class User extends Authenticatable /** * The attributes that should be cast. * - * @var array + * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', - 'role' => RoleEnum::class + 'role' => RoleEnum::class ]; /** @@ -74,7 +73,7 @@ class User extends Authenticatable * * @return void */ - protected static function booted() + protected static function booted(): void { static::creating(function (User $user) { if (\is_null($user->password)) { @@ -100,32 +99,32 @@ class User extends Authenticatable // * METHODS /** - * get User brands + * Get User brands. * - * @return \Illuminate\Database\Eloquent\Collection<\App\Models\Brand> + * @return \Illuminate\Database\Eloquent\Collection<(int|string), \App\Models\Brand> */ - public function brands() + public function brands(): \Illuminate\Database\Eloquent\Collection { return $this->sites->pluck('brand')->filter(); } /** - * Send User creation confirm mail + * Send User creation confirm mail. * * @return void */ - public function sendMailConfirm() + public function sendMailConfirm(): void { dispatch(new SendUserCreatedEmail($this)); } /** - * Send User reset password mail + * Send User reset password mail. * * @param mixed $token * @return void */ - public function sendPasswordResetNotification(mixed $token) + public function sendPasswordResetNotification(mixed $token): void { /** @var string $token */ $this->notify(new ResetPassword($token)); @@ -143,11 +142,11 @@ class User extends Authenticatable } /** - * Get All Admin users + * Get All Admin users. * - * @return Collection + * @return \Illuminate\Database\Eloquent\Collection */ - public static function adminUsers(): Collection + public static function adminUsers(): \Illuminate\Database\Eloquent\Collection { return Cache::remember('AdminUsers', 86400, function () { return self::whereIn('role', [RoleEnum::admin, RoleEnum::developper])->orderBy('name')->get(); @@ -157,41 +156,41 @@ class User extends Authenticatable // * RELATIONSHIPS /** - * HasMany Ticket relation + * HasMany Ticket relation. * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function tickets() + public function tickets(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(Ticket::class, 'created_by'); } /** - * HasMany Message relation + * HasMany Message relation. * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function messages() + public function messages(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(Message::class, 'user_id'); } /** - * BelongsToMany Ticket relation + * BelongsToMany Ticket relation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ - public function subscriptions() + public function subscriptions(): \Illuminate\Database\Eloquent\Relations\BelongsToMany { return $this->belongsToMany(Ticket::class, 'subscriptions'); } /** - * BelongsToMany Site relation + * BelongsToMany Site relation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ - public function sites() + public function sites(): \Illuminate\Database\Eloquent\Relations\BelongsToMany { return $this->belongsToMany(Site::class); } diff --git a/app/Notifications/ResetPassword.php b/app/Notifications/ResetPassword.php index e9ee470..8faf397 100644 --- a/app/Notifications/ResetPassword.php +++ b/app/Notifications/ResetPassword.php @@ -16,7 +16,7 @@ class ResetPassword extends ResetPasswordNotification * @param mixed $url * @return \Illuminate\Notifications\Messages\MailMessage */ - protected function buildMailMessage(mixed $url) + protected function buildMailMessage(mixed $url): \Illuminate\Notifications\Messages\MailMessage { $message = (new MailMessage()) ->subject(trans('Reinitialisation de mot de passe')) diff --git a/app/Policies/AccountPolicy.php b/app/Policies/AccountPolicy.php index 23468ee..1d8acde 100644 --- a/app/Policies/AccountPolicy.php +++ b/app/Policies/AccountPolicy.php @@ -14,7 +14,7 @@ class AccountPolicy * * @return boolean */ - public function viewAny() + public function viewAny(): bool { return auth()->check(); } @@ -24,7 +24,7 @@ class AccountPolicy * * @return boolean */ - public function view() + public function view(): bool { return false; } @@ -35,7 +35,7 @@ class AccountPolicy * @param \App\Models\User $user * @return boolean */ - public function create(User $user) + public function create(User $user): bool { return $user->isAdmin(); } @@ -45,7 +45,7 @@ class AccountPolicy * * @return boolean */ - public function update() + public function update(): bool { return false; } @@ -56,7 +56,7 @@ class AccountPolicy * @param \App\Models\User $user * @return boolean */ - public function delete(User $user) + public function delete(User $user): bool { return $user->isAdmin(); } @@ -66,7 +66,7 @@ class AccountPolicy * * @return boolean */ - public function credit() + public function credit(): bool { return true; } diff --git a/app/Policies/CreditLogPolicy.php b/app/Policies/CreditLogPolicy.php index 56f6309..a914ff0 100644 --- a/app/Policies/CreditLogPolicy.php +++ b/app/Policies/CreditLogPolicy.php @@ -15,7 +15,7 @@ class CreditLogPolicy * @param \App\Models\User $user * @return boolean */ - public function update(User $user) + public function update(User $user): bool { return $user->isAdmin() or $user->brands()->count() > 0; } diff --git a/app/Policies/EstimationPolicy.php b/app/Policies/EstimationPolicy.php index 3e89d6c..a90ecdf 100644 --- a/app/Policies/EstimationPolicy.php +++ b/app/Policies/EstimationPolicy.php @@ -19,7 +19,7 @@ class EstimationPolicy * @return boolean * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter */ - public function answer(User $user, Estimation $estimation) + public function answer(User $user, Estimation $estimation): bool { // phpcs:enable return $estimation->status->equals(EstimationStatusEnum::pending); diff --git a/app/Policies/SitePolicy.php b/app/Policies/SitePolicy.php index 1cf86d2..5afdcaa 100644 --- a/app/Policies/SitePolicy.php +++ b/app/Policies/SitePolicy.php @@ -13,7 +13,7 @@ class SitePolicy * * @return boolean */ - public function viewAny() + public function viewAny(): bool { return auth()->check(); } diff --git a/app/Policies/TicketPolicy.php b/app/Policies/TicketPolicy.php index 506d58f..8763e29 100644 --- a/app/Policies/TicketPolicy.php +++ b/app/Policies/TicketPolicy.php @@ -7,7 +7,6 @@ use App\Enums\Tickets\TicketTypeEnum; use App\Enums\Users\RoleEnum; use App\Models\Ticket; use App\Models\User; -use Error; use Illuminate\Auth\Access\HandlesAuthorization; class TicketPolicy @@ -19,7 +18,7 @@ class TicketPolicy * * @return boolean */ - public function viewAny() + public function viewAny(): bool { return auth()->check(); } @@ -29,7 +28,7 @@ class TicketPolicy * * @return boolean */ - public function view() + public function view(): bool { return auth()->check(); } @@ -39,7 +38,7 @@ class TicketPolicy * * @return boolean */ - public function create() + public function create(): bool { return auth()->check(); } @@ -51,7 +50,7 @@ class TicketPolicy * @param \App\Models\Ticket $ticket * @return boolean */ - public function update(User $user, Ticket $ticket) + public function update(User $user, Ticket $ticket): bool { return $user->sites->contains($ticket->site_id) || $user->isAdmin(); @@ -63,7 +62,7 @@ class TicketPolicy * @param \App\Models\User $user * @return boolean */ - public function changeStatus(User $user) + public function changeStatus(User $user): bool { return $user->isAdmin(); } @@ -74,7 +73,18 @@ class TicketPolicy * @param \App\Models\User $user * @return boolean */ - public function linkTicket(User $user) + public function linkTicket(User $user): bool + { + return $user->isAdmin(); + } + + /** + * Determine if the user can change ticket order. + * + * @param \App\Models\User $user + * @return boolean + */ + public function changeOrder(User $user): bool { return $user->isAdmin(); } @@ -85,7 +95,7 @@ class TicketPolicy * @param \App\Models\User $user * @return boolean */ - public function changeInternalStatus(User $user) + public function changeInternalStatus(User $user): bool { return $user->isAdmin(); } @@ -95,7 +105,7 @@ class TicketPolicy * * @return boolean */ - public function delete() + public function delete(): bool { return false; } @@ -105,7 +115,7 @@ class TicketPolicy * * @return boolean */ - public function forceDelete() + public function forceDelete(): bool { return false; } @@ -117,7 +127,7 @@ class TicketPolicy * @param \App\Models\Ticket $ticket * @return boolean */ - public function restore(User $user, Ticket $ticket) + public function restore(User $user, Ticket $ticket): bool { return $user->sites->contains($ticket->site_id) || $user->isAdmin(); @@ -131,7 +141,7 @@ class TicketPolicy * @return boolean * phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed */ - public function suscribeToTicket(User $user, Ticket $ticket) + public function suscribeToTicket(User $user, Ticket $ticket): bool { // phpcs:enable return !$ticket->status->equals(TicketStatusEnum::archived); @@ -145,7 +155,7 @@ class TicketPolicy * @return boolean * phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed */ - public function createMessage(User $user, Ticket $ticket) + public function createMessage(User $user, Ticket $ticket): bool { // phpcs:enable return !$ticket->status->equals(TicketStatusEnum::archived); @@ -157,7 +167,7 @@ class TicketPolicy * @param \App\Models\User $user * @return boolean */ - public function createPrivateMessage(User $user) + public function createPrivateMessage(User $user): bool { return $user->isAdmin(); } @@ -169,7 +179,7 @@ class TicketPolicy * @param \App\Models\Ticket $ticket * @return boolean */ - public function updateMessage(User $user, Ticket $ticket) + public function updateMessage(User $user, Ticket $ticket): bool { return !$ticket->status->equals(TicketStatusEnum::archived) && $user->isAdmin(); @@ -181,7 +191,7 @@ class TicketPolicy * @param \App\Models\User $user * @return boolean */ - public function reopen(User $user) + public function reopen(User $user): bool { return $user->role->equals(RoleEnum::client); } @@ -193,7 +203,7 @@ class TicketPolicy * @param \App\Models\Ticket $ticket * @return boolean */ - public function assignTo(User $user, Ticket $ticket) + public function assignTo(User $user, Ticket $ticket): bool { return $user->isAdmin() && !$ticket->status->equals(TicketStatusEnum::archived) @@ -206,7 +216,7 @@ class TicketPolicy * @param \App\Models\User $user * @return boolean */ - public function assignTickets(User $user) + public function assignTickets(User $user): bool { return $user->isAdmin(); } @@ -217,7 +227,7 @@ class TicketPolicy * @param \App\Models\User $user * @return boolean */ - public function assignLabels(User $user) + public function assignLabels(User $user): bool { return $user->isAdmin(); } @@ -229,7 +239,7 @@ class TicketPolicy * @param \App\Models\Ticket $ticket * @return boolean */ - public function estimate(User $user, Ticket $ticket) + public function estimate(User $user, Ticket $ticket): bool { if (!($brand = $ticket->site->brand)) { return false; @@ -248,7 +258,7 @@ class TicketPolicy * @param \App\Models\Ticket $ticket * @return boolean */ - public function validateEstimate(User $user, Ticket $ticket) + public function validateEstimate(User $user, Ticket $ticket): bool { if (!($brand = $ticket->site->brand)) { return false; @@ -268,7 +278,7 @@ class TicketPolicy * @param \App\Models\Ticket $ticket * @return boolean */ - public function cancelEstimate(User $user, Ticket $ticket) + public function cancelEstimate(User $user, Ticket $ticket): bool { return $user->role->equals(RoleEnum::developper) && $ticket->estimation()->exists(); @@ -281,24 +291,13 @@ class TicketPolicy * @param \App\Models\Ticket $ticket * @return boolean */ - public function createGitlabIssue(User $user, Ticket $ticket) + public function createGitlabIssue(User $user, Ticket $ticket): bool { return $user->role->equals(RoleEnum::developper) - && ($ticket->type->equals(TicketTypeEnum::bug) || $ticket->type->equals(TicketTypeEnum::evolution) || $ticket->type->equals(TicketTypeEnum::newsletter)) + && ($ticket->type->equals(TicketTypeEnum::bug) + || $ticket->type->equals(TicketTypeEnum::evolution) + || $ticket->type->equals(TicketTypeEnum::newsletter)) && !\is_null($ticket->site->gitlab_project_id) && \is_null($ticket->gitlab_issue); } - - /** - * Determine if the user can changeOrder - * - * @param User $user - * @return bool - * @throws Error - */ - public function changeOrder(User $user) - { - return $user->role->equals(RoleEnum::developper); - } - } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 9d1fd44..61be6a8 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -13,7 +13,7 @@ class AppServiceProvider extends ServiceProvider * * @return void */ - public function boot() + public function boot(): void { // * HTTPS FIX URL::forceScheme('https'); diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 395c518..229284c 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -12,7 +12,7 @@ class BroadcastServiceProvider extends ServiceProvider * * @return void */ - public function boot() + public function boot(): void { Broadcast::routes(); diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 56b3a6d..4e5e94e 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -19,6 +19,7 @@ use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Http\Request; use Illuminate\Routing\Route as RoutingRoute; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\Route; @@ -50,8 +51,9 @@ class RouteServiceProvider extends ServiceProvider ->group(base_path('routes/web-bo.php')); }); Route::bind('account', function ($value, RoutingRoute $route) { - /** @var \App\Models\User|null */ - if (!($user = \auth()->user())) { + /** @var \App\Models\User|null $user */ + $user = Auth::user(); + if (!$user) { abort(401); } @@ -59,7 +61,8 @@ class RouteServiceProvider extends ServiceProvider // * If route has brand parameter /** @var \App\Models\Brand|null */ - if ($brand = $route->parameter('brand')) { + $brand = $route->parameter('brand'); + if ($brand) { return Account::where('id', \intval($value))->whereHas('brand', function ($q) use ($brand) { $q->where('id', $brand->id); })->firstOrFail(); @@ -67,8 +70,9 @@ class RouteServiceProvider extends ServiceProvider return Account::where('id', \intval($value))->firstOrFail(); }); Route::bind('brand', function ($value) { - /** @var \App\Models\User|null */ - if (!($user = \auth()->user())) { + /** @var \App\Models\User|null $user */ + $user = Auth::user(); + if (!$user) { abort(401); } @@ -76,9 +80,10 @@ class RouteServiceProvider extends ServiceProvider return Account::where('id', \intval($value))->firstOrFail(); }); - Route::model('credit_log', function ($value) { - /** @var \App\Models\User|null */ - if (!($user = \auth()->user())) { + Route::model('credit_log', '', function ($value) { + /** @var \App\Models\User|null $user */ + $user = Auth::user(); + if (!$user) { abort(401); } @@ -88,7 +93,6 @@ class RouteServiceProvider extends ServiceProvider }); Route::model('brand', Brand::class); Route::model('label', Label::class); - Route::model('marker', Marker::class); Route::model('package', Package::class); Route::model('information', Information::class); Route::model('company', Company::class); @@ -122,7 +126,7 @@ class RouteServiceProvider extends ServiceProvider /** * Assert client user has brands - * or return to tickets.index with warning + * or return to tickets.index with warning. * * @param \App\Models\User $user * @return void @@ -131,7 +135,7 @@ class RouteServiceProvider extends ServiceProvider { if (!$user->isAdmin()) { $userBrandsAccounts = $user->brands()->each(function (Brand $brand) { - $brand->load('accounts'); + return $brand->load('accounts'); })->pluck('accounts')->flatten(); if (!$userBrandsAccounts->count()) { @@ -152,7 +156,7 @@ class RouteServiceProvider extends ServiceProvider * * @return void */ - private function cspReportRoute() + private function cspReportRoute(): void { // * CSP REPORT URI, Please add /csp-report to VerifyCsrfToken $except middleware \Illuminate\Support\Facades\Route::post('/csp-report', function () { diff --git a/app/Providers/TranslationServiceProvider.php b/app/Providers/TranslationServiceProvider.php index 7aa3b60..749ce82 100644 --- a/app/Providers/TranslationServiceProvider.php +++ b/app/Providers/TranslationServiceProvider.php @@ -2,7 +2,6 @@ namespace App\Providers; -use Illuminate\Support\Collection; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Cache; use Illuminate\Support\ServiceProvider; @@ -30,11 +29,11 @@ class TranslationServiceProvider extends ServiceProvider } /** - * Gather provided langs checking from files + * Gather provided langs checking from files. * - * @return \Illuminate\Support\Collection + * @return \Illuminate\Support\Collection */ - private function collectLocalesStrings(): Collection + private function collectLocalesStrings(): \Illuminate\Support\Collection { return collect(File::allFiles(resource_path('lang/')))->flatMap(function (SplFileInfo $file) { if ($file->getRelativePath() and \strpos($file->getRelativePath(), 'vendor') !== 0) { @@ -44,7 +43,7 @@ class TranslationServiceProvider extends ServiceProvider } /** - * Gather all php translations + * Gather all php translations. * * @param string $locale * @return array @@ -60,7 +59,7 @@ class TranslationServiceProvider extends ServiceProvider } /** - * Gather json translations + * Gather json translations. * * @param string $locale * @return array @@ -69,7 +68,7 @@ class TranslationServiceProvider extends ServiceProvider { $path = resource_path("lang/$locale.json"); - if (is_string($path) && is_readable($path)) { + if (is_readable($path)) { return json_decode(file_get_contents($path), true) ?? []; } diff --git a/app/Providers/ViewServiceProvider.php b/app/Providers/ViewServiceProvider.php index 5f61265..cff1756 100644 --- a/app/Providers/ViewServiceProvider.php +++ b/app/Providers/ViewServiceProvider.php @@ -16,7 +16,7 @@ class ViewServiceProvider extends ServiceProvider * * @return void */ - public function boot() + public function boot(): void { if (!app()->runningInConsole()) { $appInfos = Cache::remember('composer', 3600, function () { diff --git a/app/Traits/Controllers/ChangesModelOrder.php b/app/Traits/Controllers/ChangesModelOrder.php index f504823..65bb5b4 100644 --- a/app/Traits/Controllers/ChangesModelOrder.php +++ b/app/Traits/Controllers/ChangesModelOrder.php @@ -7,6 +7,7 @@ use Illuminate\Support\Arr; use Illuminate\Support\Facades\DB; use Illuminate\Support\Str; +// @phpstan-ignore trait.unused trait ChangesModelOrder { /** diff --git a/app/Traits/Enums/BaseEnum.php b/app/Traits/Enums/BaseEnum.php index 42058da..5c0fa3d 100644 --- a/app/Traits/Enums/BaseEnum.php +++ b/app/Traits/Enums/BaseEnum.php @@ -7,8 +7,9 @@ use Illuminate\Support\Str; trait BaseEnum { // * GENERIC METHODS + /** - * Get enum value + * Get enum value. * * @return string|integer */ @@ -18,7 +19,7 @@ trait BaseEnum } /** - * Get enum label + * Get enum label. * * @return string */ @@ -28,7 +29,7 @@ trait BaseEnum } /** - * Get enum name + * Get enum name. * * @return string */ @@ -40,7 +41,7 @@ trait BaseEnum // * STATIC FETCH METHODS /** - * Get enum labels + * Get enum labels. * * @return array */ @@ -62,7 +63,7 @@ trait BaseEnum } /** - * Get enum values + * Get enum values. * * @return array */ @@ -70,13 +71,13 @@ trait BaseEnum { if (empty(self::getCache('values'))) { self::setCache('values', \collect(self::cases()) - ->mapWithKeys(fn ($enum) => [$enum->name => $enum->value])->all()); + ->mapWithKeys(fn($enum) => [$enum->name => $enum->value])->all()); } return self::getCache('values'); } /** - * Get enums + * Get enums. * * @return array */ @@ -86,7 +87,7 @@ trait BaseEnum } /** - * Get enums + * Get enums. * * @return array */ @@ -99,7 +100,7 @@ trait BaseEnum $baseArray = [ 'name' => $enum->name, 'label' => $enum->label(), - 'value' => $enum->value ?? null, + 'value' => $enum->value, ]; foreach ($definitions as $index => $elements) { $index = Str::lower(Str::singular($index)); @@ -115,30 +116,35 @@ trait BaseEnum } /** - * Fetch enum using value + * Fetch enum using value. * - * @param \App\Traits\Enums\BaseEnum|integer|string $value - * @return \App\Traits\Enums\BaseEnum|null + * @param self|integer|string $value + * @param string $field + * @return self|null */ - public static function make(self|int|string $value): self|null + public static function make(self|int|string $value, string $field = 'value'): self|null { + if ($field === "label") { + $enumLabels = array_change_key_case(array_flip(self::toLabels()), CASE_LOWER); + $value = (isset($enumLabels[strtolower($value)])) ? $enumLabels[strtolower($value)] : false; + $field = 'name'; + } return !\is_object($value) ? - \collect(self::cases())->keyBy('value')->get($value) : $value; + \collect(self::cases())->keyBy($field)->get($value) : $value; } /** - * Test if 2 enum are equals + * Test if 2 enum are equals. * * @param object ...$others * @return boolean - * @throws \Error If provided element are not enums taht extends BaseEnum. + * @throws \Error If provided element are not enums that extends BaseEnum. */ public function equals(object ...$others): bool { foreach ($others as $other) { if (!\in_array(BaseEnum::class, \class_uses_recursive($other))) { - throw new \Error(__METHOD__ . - ' requires $enum to use ' . BaseEnum::class); + throw new \Error(__METHOD__ . ' requires $enum to use ' . BaseEnum::class); } if ( get_class($this) === get_class($other) @@ -151,7 +157,7 @@ trait BaseEnum } /** - * Serialize to json + * Serialize to json. * * @return mixed */ @@ -164,7 +170,7 @@ trait BaseEnum // * CACHE /** - * Get cache array + * Get cache array. * * @param string $index * @return array @@ -179,7 +185,7 @@ trait BaseEnum } /** - * Set cache array + * Set cache array. * * @param string $index * @param array $items @@ -195,7 +201,7 @@ trait BaseEnum } /** - * Init cache if needed + * Init cache if needed. * * @return void */ @@ -216,7 +222,7 @@ trait BaseEnum // * PRIVATE /** - * Fetch the LABELS constant if exists + * Fetch the LABELS constant if exists. * * @return array|null */ @@ -232,7 +238,7 @@ trait BaseEnum } /** - * Get custom constants + * Get custom constants. * * @return array */ @@ -247,8 +253,7 @@ trait BaseEnum if ($key === 'LABELS' or !\is_array($constant)) { return false; } - return \collect($constant)->keys() - ->filter(fn (string $name) => $names->has($name))->count(); + return \collect($constant)->keys()->filter(fn(string $name) => $names->has($name))->count(); })->all(); } return $GLOBALS[self::class]['customProps']; diff --git a/app/Traits/Enums/SpsConfigTrait.php b/app/Traits/Enums/SpsConfigTrait.php index 1d376cd..616d813 100644 --- a/app/Traits/Enums/SpsConfigTrait.php +++ b/app/Traits/Enums/SpsConfigTrait.php @@ -2,11 +2,12 @@ namespace App\Traits\Enums; +// @phpstan-ignore trait.unused trait SpsConfigTrait { /** * acsBase64 method - * Return destination url base64 encoded + * Return destination url base64 encoded. * * @return string */ @@ -16,7 +17,7 @@ trait SpsConfigTrait } /** * destination method - * Return acs url concatenated with url + * Return acs url concatenated with url. * * @return string */ @@ -26,7 +27,7 @@ trait SpsConfigTrait } /** * logout method - * Return sls url concatenated with url + * Return sls url concatenated with url. * * @return string */ @@ -36,7 +37,7 @@ trait SpsConfigTrait } /** * certificate method - * Return certificate (.pem) file from kebab case of Enum name + * Return certificate (.pem) file from kebab case of Enum name. * * @return string */ diff --git a/app/Traits/Models/IsCachedAsCollection.php b/app/Traits/Models/IsCachedAsCollection.php index f8ede85..056065f 100644 --- a/app/Traits/Models/IsCachedAsCollection.php +++ b/app/Traits/Models/IsCachedAsCollection.php @@ -10,7 +10,7 @@ use Illuminate\Support\Facades\Cache; /** * ! Use this only on limited elements, (not on tags, or products, or posts for ex.) * - * @property private static array $cacheConditions Eloquent condition to cache elements (to be used in where statement). + * @phpstan-ignore trait.unused */ trait IsCachedAsCollection { diff --git a/app/Traits/Models/MiniCrudModel.php b/app/Traits/Models/MiniCrudModel.php index 09109f1..300cc2a 100644 --- a/app/Traits/Models/MiniCrudModel.php +++ b/app/Traits/Models/MiniCrudModel.php @@ -2,10 +2,10 @@ namespace App\Traits\Models; -use App\Enums\InputType; use App\Lib\Helpers\FileStorageHelper; use App\Lib\Helpers\ToolboxHelper; +// @phpstan-ignore trait.unused trait MiniCrudModel { /** diff --git a/composer.json b/composer.json index c29be5d..23a8315 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,7 @@ }, "require-dev": { "fakerphp/faker": "^1.9.1", + "larastan/larastan": "^3.3", "laravel-lang/common": "^4.0", "laravel/pint": "^1.0", "laravel/sail": "^1.18", @@ -37,7 +38,7 @@ "phpunit/phpunit": "^10.0", "slevomat/coding-standard": "^8.10", "spatie/laravel-ignition": "^2.0", - "thedoctor0/laravel-factory-generator": "^1.2" + "thedoctor0/laravel-factory-generator": "^1.4" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 12380b4..655445c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7c22201effe7a464dcc8e3048d370b4f", + "content-hash": "c00fc3dbd14ce48aba9fa405be2c40d9", "packages": [ { "name": "brick/math", @@ -667,26 +667,29 @@ }, { "name": "doctrine/deprecations", - "version": "1.1.4", + "version": "1.1.5", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9" + "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/31610dbb31faa98e6b5447b62340826f54fbc4e9", - "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", + "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, + "conflict": { + "phpunit/phpunit": "<=7.5 || >=13" + }, "require-dev": { - "doctrine/coding-standard": "^9 || ^12", - "phpstan/phpstan": "1.4.10 || 2.0.3", + "doctrine/coding-standard": "^9 || ^12 || ^13", + "phpstan/phpstan": "1.4.10 || 2.1.11", "phpstan/phpstan-phpunit": "^1.0 || ^2", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12", "psr/log": "^1 || ^2 || ^3" }, "suggest": { @@ -706,9 +709,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.4" + "source": "https://github.com/doctrine/deprecations/tree/1.1.5" }, - "time": "2024-12-07T21:18:45+00:00" + "time": "2025-04-07T20:06:18+00:00" }, { "name": "doctrine/event-manager", @@ -1132,16 +1135,16 @@ }, { "name": "egulias/email-validator", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "b115554301161fa21467629f1e1391c1936de517" + "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/b115554301161fa21467629f1e1391c1936de517", - "reference": "b115554301161fa21467629f1e1391c1936de517", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", + "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", "shasum": "" }, "require": { @@ -1187,7 +1190,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/4.0.3" + "source": "https://github.com/egulias/EmailValidator/tree/4.0.4" }, "funding": [ { @@ -1195,7 +1198,7 @@ "type": "github" } ], - "time": "2024-12-27T00:36:43+00:00" + "time": "2025-03-06T22:45:56+00:00" }, { "name": "ezyang/htmlpurifier", @@ -1668,16 +1671,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.9.2", + "version": "7.9.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "d281ed313b989f213357e3be1a179f02196ac99b" + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", - "reference": "d281ed313b989f213357e3be1a179f02196ac99b", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", "shasum": "" }, "require": { @@ -1774,7 +1777,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.9.2" + "source": "https://github.com/guzzle/guzzle/tree/7.9.3" }, "funding": [ { @@ -1790,20 +1793,20 @@ "type": "tidelift" } ], - "time": "2024-07-24T11:22:20+00:00" + "time": "2025-03-27T13:37:11+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.4", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455" + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455", - "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", "shasum": "" }, "require": { @@ -1857,7 +1860,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.4" + "source": "https://github.com/guzzle/promises/tree/2.2.0" }, "funding": [ { @@ -1873,20 +1876,20 @@ "type": "tidelift" } ], - "time": "2024-10-17T10:06:22+00:00" + "time": "2025-03-27T13:27:01+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.7.0", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", - "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", "shasum": "" }, "require": { @@ -1973,7 +1976,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.7.0" + "source": "https://github.com/guzzle/psr7/tree/2.7.1" }, "funding": [ { @@ -1989,7 +1992,7 @@ "type": "tidelift" } ], - "time": "2024-07-18T11:15:46+00:00" + "time": "2025-03-27T12:30:47+00:00" }, { "name": "guzzlehttp/uri-template", @@ -2079,16 +2082,16 @@ }, { "name": "jean85/pretty-package-versions", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "3c4e5f62ba8d7de1734312e4fff32f67a8daaf10" + "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/3c4e5f62ba8d7de1734312e4fff32f67a8daaf10", - "reference": "3c4e5f62ba8d7de1734312e4fff32f67a8daaf10", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/4d7aa5dab42e2a76d99559706022885de0e18e1a", + "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a", "shasum": "" }, "require": { @@ -2098,8 +2101,9 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^3.2", "jean85/composer-provided-replaced-stub-package": "^1.0", - "phpstan/phpstan": "^1.4", + "phpstan/phpstan": "^2.0", "phpunit/phpunit": "^7.5|^8.5|^9.6", + "rector/rector": "^2.0", "vimeo/psalm": "^4.3 || ^5.0" }, "type": "library", @@ -2132,22 +2136,22 @@ ], "support": { "issues": "https://github.com/Jean85/pretty-package-versions/issues", - "source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.0" + "source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.1" }, - "time": "2024-11-18T16:19:46+00:00" + "time": "2025-03-19T14:43:43+00:00" }, { "name": "laravel/framework", - "version": "v11.44.1", + "version": "v11.44.2", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "0883d4175f4e2b5c299e7087ad3c74f2ce195c6d" + "reference": "f85216c82cbd38b66d67ebd20ea762cb3751a4b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/0883d4175f4e2b5c299e7087ad3c74f2ce195c6d", - "reference": "0883d4175f4e2b5c299e7087ad3c74f2ce195c6d", + "url": "https://api.github.com/repos/laravel/framework/zipball/f85216c82cbd38b66d67ebd20ea762cb3751a4b4", + "reference": "f85216c82cbd38b66d67ebd20ea762cb3751a4b4", "shasum": "" }, "require": { @@ -2349,7 +2353,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-03-05T15:34:10+00:00" + "time": "2025-03-12T14:34:30+00:00" }, { "name": "laravel/prompts", @@ -2412,16 +2416,16 @@ }, { "name": "laravel/serializable-closure", - "version": "v2.0.3", + "version": "v2.0.4", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "f379c13663245f7aa4512a7869f62eb14095f23f" + "reference": "b352cf0534aa1ae6b4d825d1e762e35d43f8a841" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/f379c13663245f7aa4512a7869f62eb14095f23f", - "reference": "f379c13663245f7aa4512a7869f62eb14095f23f", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/b352cf0534aa1ae6b4d825d1e762e35d43f8a841", + "reference": "b352cf0534aa1ae6b4d825d1e762e35d43f8a841", "shasum": "" }, "require": { @@ -2469,7 +2473,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2025-02-11T15:03:05+00:00" + "time": "2025-03-19T13:51:03+00:00" }, { "name": "laravel/tinker", @@ -2602,16 +2606,16 @@ }, { "name": "league/commonmark", - "version": "2.6.1", + "version": "2.6.2", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "d990688c91cedfb69753ffc2512727ec646df2ad" + "reference": "06c3b0bf2540338094575612f4a1778d0d2d5e94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d990688c91cedfb69753ffc2512727ec646df2ad", - "reference": "d990688c91cedfb69753ffc2512727ec646df2ad", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/06c3b0bf2540338094575612f4a1778d0d2d5e94", + "reference": "06c3b0bf2540338094575612f4a1778d0d2d5e94", "shasum": "" }, "require": { @@ -2705,7 +2709,7 @@ "type": "tidelift" } ], - "time": "2024-12-29T14:10:59+00:00" + "time": "2025-04-18T21:09:27+00:00" }, { "name": "league/config", @@ -3429,16 +3433,16 @@ }, { "name": "monolog/monolog", - "version": "3.8.1", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4" + "reference": "10d85740180ecba7896c87e06a166e0c95a0e3b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/aef6ee73a77a66e404dd6540934a9ef1b3c855b4", - "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/10d85740180ecba7896c87e06a166e0c95a0e3b6", + "reference": "10d85740180ecba7896c87e06a166e0c95a0e3b6", "shasum": "" }, "require": { @@ -3516,7 +3520,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.8.1" + "source": "https://github.com/Seldaek/monolog/tree/3.9.0" }, "funding": [ { @@ -3528,7 +3532,7 @@ "type": "tidelift" } ], - "time": "2024-12-05T17:15:07+00:00" + "time": "2025-03-24T10:02:05+00:00" }, { "name": "mpdf/mpdf", @@ -3765,16 +3769,16 @@ }, { "name": "nesbot/carbon", - "version": "3.8.6", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/CarbonPHP/carbon.git", - "reference": "ff2f20cf83bd4d503720632ce8a426dc747bf7fd" + "reference": "6d16a8a015166fe54e22c042e0805c5363aef50d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/ff2f20cf83bd4d503720632ce8a426dc747bf7fd", - "reference": "ff2f20cf83bd4d503720632ce8a426dc747bf7fd", + "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/6d16a8a015166fe54e22c042e0805c5363aef50d", + "reference": "6d16a8a015166fe54e22c042e0805c5363aef50d", "shasum": "" }, "require": { @@ -3867,7 +3871,7 @@ "type": "tidelift" } ], - "time": "2025-02-20T17:33:38+00:00" + "time": "2025-03-27T12:57:33+00:00" }, { "name": "nette/schema", @@ -3933,16 +3937,16 @@ }, { "name": "nette/utils", - "version": "v4.0.5", + "version": "v4.0.6", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96" + "reference": "ce708655043c7050eb050df361c5e313cf708309" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", - "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", + "url": "https://api.github.com/repos/nette/utils/zipball/ce708655043c7050eb050df361c5e313cf708309", + "reference": "ce708655043c7050eb050df361c5e313cf708309", "shasum": "" }, "require": { @@ -4013,9 +4017,9 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v4.0.5" + "source": "https://github.com/nette/utils/tree/v4.0.6" }, - "time": "2024-08-07T15:39:19+00:00" + "time": "2025-03-30T21:06:30+00:00" }, { "name": "nikic/php-parser", @@ -5375,16 +5379,16 @@ }, { "name": "psy/psysh", - "version": "v0.12.7", + "version": "v0.12.8", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "d73fa3c74918ef4522bb8a3bf9cab39161c4b57c" + "reference": "85057ceedee50c49d4f6ecaff73ee96adb3b3625" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/d73fa3c74918ef4522bb8a3bf9cab39161c4b57c", - "reference": "d73fa3c74918ef4522bb8a3bf9cab39161c4b57c", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/85057ceedee50c49d4f6ecaff73ee96adb3b3625", + "reference": "85057ceedee50c49d4f6ecaff73ee96adb3b3625", "shasum": "" }, "require": { @@ -5448,9 +5452,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.12.7" + "source": "https://github.com/bobthecow/psysh/tree/v0.12.8" }, - "time": "2024-12-10T01:58:33+00:00" + "time": "2025-03-16T03:05:19+00:00" }, { "name": "ralouphie/getallheaders", @@ -5498,16 +5502,16 @@ }, { "name": "ramsey/collection", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109" + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109", - "reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109", + "url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2", + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2", "shasum": "" }, "require": { @@ -5568,9 +5572,9 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/2.1.0" + "source": "https://github.com/ramsey/collection/tree/2.1.1" }, - "time": "2025-03-02T04:48:29+00:00" + "time": "2025-03-22T05:38:12+00:00" }, { "name": "ramsey/uuid", @@ -5708,16 +5712,16 @@ }, { "name": "sentry/sentry", - "version": "4.10.0", + "version": "4.11.0", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "2af937d47d8aadb8dab0b1d7b9557e495dd12856" + "reference": "ebf67deb9902b6da58a4b3383cbd12fed3f4f555" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/2af937d47d8aadb8dab0b1d7b9557e495dd12856", - "reference": "2af937d47d8aadb8dab0b1d7b9557e495dd12856", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/ebf67deb9902b6da58a4b3383cbd12fed3f4f555", + "reference": "ebf67deb9902b6da58a4b3383cbd12fed3f4f555", "shasum": "" }, "require": { @@ -5781,7 +5785,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-php/issues", - "source": "https://github.com/getsentry/sentry-php/tree/4.10.0" + "source": "https://github.com/getsentry/sentry-php/tree/4.11.0" }, "funding": [ { @@ -5793,7 +5797,7 @@ "type": "custom" } ], - "time": "2024-11-06T07:44:19+00:00" + "time": "2025-04-14T09:04:23+00:00" }, { "name": "sentry/sentry-laravel", @@ -5958,16 +5962,16 @@ }, { "name": "symfony/cache", - "version": "v7.2.4", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "d33cd9e14326e14a4145c21e600602eaf17cc9e7" + "reference": "9131e3018872d2ebb6fe8a9a4d6631273513d42c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/d33cd9e14326e14a4145c21e600602eaf17cc9e7", - "reference": "d33cd9e14326e14a4145c21e600602eaf17cc9e7", + "url": "https://api.github.com/repos/symfony/cache/zipball/9131e3018872d2ebb6fe8a9a4d6631273513d42c", + "reference": "9131e3018872d2ebb6fe8a9a4d6631273513d42c", "shasum": "" }, "require": { @@ -6036,7 +6040,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v7.2.4" + "source": "https://github.com/symfony/cache/tree/v7.2.5" }, "funding": [ { @@ -6052,7 +6056,7 @@ "type": "tidelift" } ], - "time": "2025-02-26T09:57:54+00:00" + "time": "2025-03-25T15:54:33+00:00" }, { "name": "symfony/cache-contracts", @@ -6206,16 +6210,16 @@ }, { "name": "symfony/console", - "version": "v7.2.1", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3" + "reference": "e51498ea18570c062e7df29d05a7003585b19b88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fefcc18c0f5d0efe3ab3152f15857298868dc2c3", - "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3", + "url": "https://api.github.com/repos/symfony/console/zipball/e51498ea18570c062e7df29d05a7003585b19b88", + "reference": "e51498ea18570c062e7df29d05a7003585b19b88", "shasum": "" }, "require": { @@ -6279,7 +6283,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.2.1" + "source": "https://github.com/symfony/console/tree/v7.2.5" }, "funding": [ { @@ -6295,7 +6299,7 @@ "type": "tidelift" } ], - "time": "2024-12-11T03:49:26+00:00" + "time": "2025-03-12T08:11:12+00:00" }, { "name": "symfony/css-selector", @@ -6431,16 +6435,16 @@ }, { "name": "symfony/error-handler", - "version": "v7.2.4", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "aabf79938aa795350c07ce6464dd1985607d95d5" + "reference": "102be5e6a8e4f4f3eb3149bcbfa33a80d1ee374b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/aabf79938aa795350c07ce6464dd1985607d95d5", - "reference": "aabf79938aa795350c07ce6464dd1985607d95d5", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/102be5e6a8e4f4f3eb3149bcbfa33a80d1ee374b", + "reference": "102be5e6a8e4f4f3eb3149bcbfa33a80d1ee374b", "shasum": "" }, "require": { @@ -6486,7 +6490,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v7.2.4" + "source": "https://github.com/symfony/error-handler/tree/v7.2.5" }, "funding": [ { @@ -6502,7 +6506,7 @@ "type": "tidelift" } ], - "time": "2025-02-02T20:27:07+00:00" + "time": "2025-03-03T07:12:39+00:00" }, { "name": "symfony/event-dispatcher", @@ -6726,16 +6730,16 @@ }, { "name": "symfony/http-foundation", - "version": "v7.2.3", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "ee1b504b8926198be89d05e5b6fc4c3810c090f0" + "reference": "371272aeb6286f8135e028ca535f8e4d6f114126" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/ee1b504b8926198be89d05e5b6fc4c3810c090f0", - "reference": "ee1b504b8926198be89d05e5b6fc4c3810c090f0", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/371272aeb6286f8135e028ca535f8e4d6f114126", + "reference": "371272aeb6286f8135e028ca535f8e4d6f114126", "shasum": "" }, "require": { @@ -6784,7 +6788,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.2.3" + "source": "https://github.com/symfony/http-foundation/tree/v7.2.5" }, "funding": [ { @@ -6800,20 +6804,20 @@ "type": "tidelift" } ], - "time": "2025-01-17T10:56:55+00:00" + "time": "2025-03-25T15:54:33+00:00" }, { "name": "symfony/http-kernel", - "version": "v7.2.4", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "9f1103734c5789798fefb90e91de4586039003ed" + "reference": "b1fe91bc1fa454a806d3f98db4ba826eb9941a54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/9f1103734c5789798fefb90e91de4586039003ed", - "reference": "9f1103734c5789798fefb90e91de4586039003ed", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/b1fe91bc1fa454a806d3f98db4ba826eb9941a54", + "reference": "b1fe91bc1fa454a806d3f98db4ba826eb9941a54", "shasum": "" }, "require": { @@ -6898,7 +6902,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.2.4" + "source": "https://github.com/symfony/http-kernel/tree/v7.2.5" }, "funding": [ { @@ -6914,7 +6918,7 @@ "type": "tidelift" } ], - "time": "2025-02-26T11:01:22+00:00" + "time": "2025-03-28T13:32:50+00:00" }, { "name": "symfony/mailer", @@ -7785,16 +7789,16 @@ }, { "name": "symfony/process", - "version": "v7.2.4", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf" + "reference": "87b7c93e57df9d8e39a093d32587702380ff045d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf", - "reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf", + "url": "https://api.github.com/repos/symfony/process/zipball/87b7c93e57df9d8e39a093d32587702380ff045d", + "reference": "87b7c93e57df9d8e39a093d32587702380ff045d", "shasum": "" }, "require": { @@ -7826,7 +7830,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.2.4" + "source": "https://github.com/symfony/process/tree/v7.2.5" }, "funding": [ { @@ -7842,7 +7846,7 @@ "type": "tidelift" } ], - "time": "2025-02-05T08:33:46+00:00" + "time": "2025-03-13T12:21:46+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -8510,16 +8514,16 @@ }, { "name": "symfony/var-exporter", - "version": "v7.2.4", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "4ede73aa7a73d81506002d2caadbbdad1ef5b69a" + "reference": "c37b301818bd7288715d40de634f05781b686ace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/4ede73aa7a73d81506002d2caadbbdad1ef5b69a", - "reference": "4ede73aa7a73d81506002d2caadbbdad1ef5b69a", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/c37b301818bd7288715d40de634f05781b686ace", + "reference": "c37b301818bd7288715d40de634f05781b686ace", "shasum": "" }, "require": { @@ -8566,7 +8570,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v7.2.4" + "source": "https://github.com/symfony/var-exporter/tree/v7.2.5" }, "funding": [ { @@ -8582,7 +8586,7 @@ "type": "tidelift" } ], - "time": "2025-02-13T10:27:23+00:00" + "time": "2025-03-13T12:21:46+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -9486,16 +9490,16 @@ }, { "name": "filp/whoops", - "version": "2.17.0", + "version": "2.18.0", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "075bc0c26631110584175de6523ab3f1652eb28e" + "reference": "a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/075bc0c26631110584175de6523ab3f1652eb28e", - "reference": "075bc0c26631110584175de6523ab3f1652eb28e", + "url": "https://api.github.com/repos/filp/whoops/zipball/a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e", + "reference": "a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e", "shasum": "" }, "require": { @@ -9545,7 +9549,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.17.0" + "source": "https://github.com/filp/whoops/tree/2.18.0" }, "funding": [ { @@ -9553,7 +9557,7 @@ "type": "github" } ], - "time": "2025-01-25T12:00:00+00:00" + "time": "2025-03-15T12:00:00+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -9607,17 +9611,147 @@ "time": "2020-07-09T08:09:16+00:00" }, { - "name": "laravel-lang/attributes", - "version": "2.13.1", + "name": "iamcal/sql-parser", + "version": "v0.6", "source": { "type": "git", - "url": "https://github.com/Laravel-Lang/attributes.git", - "reference": "394329d99eaa990626c194c5eb39648e881ecc35" + "url": "https://github.com/iamcal/SQLParser.git", + "reference": "947083e2dca211a6f12fb1beb67a01e387de9b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Laravel-Lang/attributes/zipball/394329d99eaa990626c194c5eb39648e881ecc35", - "reference": "394329d99eaa990626c194c5eb39648e881ecc35", + "url": "https://api.github.com/repos/iamcal/SQLParser/zipball/947083e2dca211a6f12fb1beb67a01e387de9b62", + "reference": "947083e2dca211a6f12fb1beb67a01e387de9b62", + "shasum": "" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^1.0", + "phpunit/phpunit": "^5|^6|^7|^8|^9" + }, + "type": "library", + "autoload": { + "psr-4": { + "iamcal\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Cal Henderson", + "email": "cal@iamcal.com" + } + ], + "description": "MySQL schema parser", + "support": { + "issues": "https://github.com/iamcal/SQLParser/issues", + "source": "https://github.com/iamcal/SQLParser/tree/v0.6" + }, + "time": "2025-03-17T16:59:46+00:00" + }, + { + "name": "larastan/larastan", + "version": "v3.4.0", + "source": { + "type": "git", + "url": "https://github.com/larastan/larastan.git", + "reference": "1042fa0c2ee490bb6da7381f3323f7292ad68222" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/larastan/larastan/zipball/1042fa0c2ee490bb6da7381f3323f7292ad68222", + "reference": "1042fa0c2ee490bb6da7381f3323f7292ad68222", + "shasum": "" + }, + "require": { + "ext-json": "*", + "iamcal/sql-parser": "^0.6.0", + "illuminate/console": "^11.44.2 || ^12.4.1", + "illuminate/container": "^11.44.2 || ^12.4.1", + "illuminate/contracts": "^11.44.2 || ^12.4.1", + "illuminate/database": "^11.44.2 || ^12.4.1", + "illuminate/http": "^11.44.2 || ^12.4.1", + "illuminate/pipeline": "^11.44.2 || ^12.4.1", + "illuminate/support": "^11.44.2 || ^12.4.1", + "php": "^8.2", + "phpstan/phpstan": "^2.1.11" + }, + "require-dev": { + "doctrine/coding-standard": "^13", + "laravel/framework": "^11.44.2 || ^12.7.2", + "mockery/mockery": "^1.6.12", + "nikic/php-parser": "^5.4", + "orchestra/canvas": "^v9.2.2 || ^10.0.1", + "orchestra/testbench-core": "^9.12.0 || ^10.1", + "phpstan/phpstan-deprecation-rules": "^2.0.1", + "phpunit/phpunit": "^10.5.35 || ^11.5.15" + }, + "suggest": { + "orchestra/testbench": "Using Larastan for analysing a package needs Testbench" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Larastan\\Larastan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Can Vural", + "email": "can9119@gmail.com" + } + ], + "description": "Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel", + "keywords": [ + "PHPStan", + "code analyse", + "code analysis", + "larastan", + "laravel", + "package", + "php", + "static analysis" + ], + "support": { + "issues": "https://github.com/larastan/larastan/issues", + "source": "https://github.com/larastan/larastan/tree/v3.4.0" + }, + "funding": [ + { + "url": "https://github.com/canvural", + "type": "github" + } + ], + "time": "2025-04-22T09:44:59+00:00" + }, + { + "name": "laravel-lang/attributes", + "version": "2.13.4", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/attributes.git", + "reference": "c3671787b92fb83da1f5a4f9b6dcc9f4e3edfafe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/attributes/zipball/c3671787b92fb83da1f5a4f9b6dcc9f4e3edfafe", + "reference": "c3671787b92fb83da1f5a4f9b6dcc9f4e3edfafe", "shasum": "" }, "require": { @@ -9671,9 +9805,9 @@ ], "support": { "issues": "https://github.com/Laravel-Lang/attributes/issues", - "source": "https://github.com/Laravel-Lang/attributes/tree/2.13.1" + "source": "https://github.com/Laravel-Lang/attributes/tree/2.13.4" }, - "time": "2025-03-04T07:28:17+00:00" + "time": "2025-03-14T10:43:34+00:00" }, { "name": "laravel-lang/common", @@ -9758,16 +9892,16 @@ }, { "name": "laravel-lang/http-statuses", - "version": "3.10.1", + "version": "3.10.3", "source": { "type": "git", "url": "https://github.com/Laravel-Lang/http-statuses.git", - "reference": "061870d98bf213bccfdc8e7421a820ee7916922d" + "reference": "32f9c3e9a93179ea6769844eaddfe8ae4cf3df63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Laravel-Lang/http-statuses/zipball/061870d98bf213bccfdc8e7421a820ee7916922d", - "reference": "061870d98bf213bccfdc8e7421a820ee7916922d", + "url": "https://api.github.com/repos/Laravel-Lang/http-statuses/zipball/32f9c3e9a93179ea6769844eaddfe8ae4cf3df63", + "reference": "32f9c3e9a93179ea6769844eaddfe8ae4cf3df63", "shasum": "" }, "require": { @@ -9819,9 +9953,9 @@ ], "support": { "issues": "https://github.com/Laravel-Lang/http-statuses/issues", - "source": "https://github.com/Laravel-Lang/http-statuses/tree/3.10.1" + "source": "https://github.com/Laravel-Lang/http-statuses/tree/3.10.3" }, - "time": "2025-03-02T15:29:55+00:00" + "time": "2025-03-11T20:03:32+00:00" }, { "name": "laravel-lang/lang", @@ -9992,16 +10126,16 @@ }, { "name": "laravel/pint", - "version": "v1.21.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "531fa0871fbde719c51b12afa3a443b8f4e4b425" + "reference": "7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/531fa0871fbde719c51b12afa3a443b8f4e4b425", - "reference": "531fa0871fbde719c51b12afa3a443b8f4e4b425", + "url": "https://api.github.com/repos/laravel/pint/zipball/7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36", + "reference": "7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36", "shasum": "" }, "require": { @@ -10012,9 +10146,9 @@ "php": "^8.2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.68.5", - "illuminate/view": "^11.42.0", - "larastan/larastan": "^3.0.4", + "friendsofphp/php-cs-fixer": "^3.75.0", + "illuminate/view": "^11.44.2", + "larastan/larastan": "^3.3.1", "laravel-zero/framework": "^11.36.1", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^2.3", @@ -10054,20 +10188,20 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2025-02-18T03:18:57+00:00" + "time": "2025-04-08T22:11:45+00:00" }, { "name": "laravel/sail", - "version": "v1.41.0", + "version": "v1.41.1", "source": { "type": "git", "url": "https://github.com/laravel/sail.git", - "reference": "fe1a4ada0abb5e4bd99eb4e4b0d87906c00cdeec" + "reference": "e5692510f1ef8e0f5096cde2b885d558f8d86592" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/sail/zipball/fe1a4ada0abb5e4bd99eb4e4b0d87906c00cdeec", - "reference": "fe1a4ada0abb5e4bd99eb4e4b0d87906c00cdeec", + "url": "https://api.github.com/repos/laravel/sail/zipball/e5692510f1ef8e0f5096cde2b885d558f8d86592", + "reference": "e5692510f1ef8e0f5096cde2b885d558f8d86592", "shasum": "" }, "require": { @@ -10117,7 +10251,7 @@ "issues": "https://github.com/laravel/sail/issues", "source": "https://github.com/laravel/sail" }, - "time": "2025-01-24T15:45:36+00:00" + "time": "2025-04-22T13:39:39+00:00" }, { "name": "mockery/mockery", @@ -10464,6 +10598,64 @@ }, "time": "2025-02-19T13:28:12+00:00" }, + { + "name": "phpstan/phpstan", + "version": "2.1.12", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "96dde49e967c0c22812bcfa7bda4ff82c09f3b0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/96dde49e967c0c22812bcfa7bda4ff82c09f3b0c", + "reference": "96dde49e967c0c22812bcfa7bda4ff82c09f3b0c", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2025-04-16T13:19:18+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "10.1.16", @@ -11804,32 +11996,32 @@ }, { "name": "slevomat/coding-standard", - "version": "8.16.0", + "version": "8.17.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "7748a4282df19daf966fda1d8c60a8aec803c83a" + "reference": "ace04a4e2e20c9bc26ad14d6c4c737cde6056ec0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7748a4282df19daf966fda1d8c60a8aec803c83a", - "reference": "7748a4282df19daf966fda1d8c60a8aec803c83a", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/ace04a4e2e20c9bc26ad14d6c4c737cde6056ec0", + "reference": "ace04a4e2e20c9bc26ad14d6c4c737cde6056ec0", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.4 || ^8.0", "phpstan/phpdoc-parser": "^2.1.0", - "squizlabs/php_codesniffer": "^3.11.3" + "squizlabs/php_codesniffer": "^3.12.1" }, "require-dev": { "phing/phing": "3.0.1", "php-parallel-lint/php-parallel-lint": "1.4.0", - "phpstan/phpstan": "2.1.6", + "phpstan/phpstan": "2.1.11", "phpstan/phpstan-deprecation-rules": "2.0.1", - "phpstan/phpstan-phpunit": "2.0.4", - "phpstan/phpstan-strict-rules": "2.0.3", - "phpunit/phpunit": "9.6.8|10.5.45|11.4.4|11.5.9|12.0.4" + "phpstan/phpstan-phpunit": "2.0.6", + "phpstan/phpstan-strict-rules": "2.0.4", + "phpunit/phpunit": "9.6.8|10.5.45|11.4.4|11.5.17|12.1.2" }, "type": "phpcodesniffer-standard", "extra": { @@ -11853,7 +12045,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.16.0" + "source": "https://github.com/slevomat/coding-standard/tree/8.17.0" }, "funding": [ { @@ -11865,7 +12057,7 @@ "type": "tidelift" } ], - "time": "2025-02-23T18:12:49+00:00" + "time": "2025-04-10T06:06:16+00:00" }, { "name": "spatie/backtrace", @@ -12249,16 +12441,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.11.3", + "version": "3.12.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10" + "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10", - "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", + "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", "shasum": "" }, "require": { @@ -12325,11 +12517,11 @@ "type": "open_collective" }, { - "url": "https://thanks.dev/phpcsstandards", + "url": "https://thanks.dev/u/gh/phpcsstandards", "type": "thanks_dev" } ], - "time": "2025-01-23T17:04:15+00:00" + "time": "2025-04-13T04:10:18+00:00" }, { "name": "symfony/polyfill-php81", @@ -12409,16 +12601,16 @@ }, { "name": "symfony/yaml", - "version": "v7.2.3", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "ac238f173df0c9c1120f862d0f599e17535a87ec" + "reference": "4c4b6f4cfcd7e52053f0c8bfad0f7f30fb924912" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/ac238f173df0c9c1120f862d0f599e17535a87ec", - "reference": "ac238f173df0c9c1120f862d0f599e17535a87ec", + "url": "https://api.github.com/repos/symfony/yaml/zipball/4c4b6f4cfcd7e52053f0c8bfad0f7f30fb924912", + "reference": "4c4b6f4cfcd7e52053f0c8bfad0f7f30fb924912", "shasum": "" }, "require": { @@ -12461,7 +12653,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v7.2.3" + "source": "https://github.com/symfony/yaml/tree/v7.2.5" }, "funding": [ { @@ -12477,7 +12669,7 @@ "type": "tidelift" } ], - "time": "2025-01-07T12:55:42+00:00" + "time": "2025-03-03T07:12:39+00:00" }, { "name": "thedoctor0/laravel-factory-generator", diff --git a/database/factories/CompanyFactory.php b/database/factories/CompanyFactory.php index aefb175..424a2c1 100644 --- a/database/factories/CompanyFactory.php +++ b/database/factories/CompanyFactory.php @@ -19,7 +19,7 @@ class CompanyFactory extends Factory * * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name, diff --git a/database/factories/InvoiceFactory.php b/database/factories/InvoiceFactory.php index cb1f232..75f2768 100644 --- a/database/factories/InvoiceFactory.php +++ b/database/factories/InvoiceFactory.php @@ -110,25 +110,25 @@ class InvoiceFactory extends Factory * * @return array */ - public function definition() + public function definition(): array { $this->customData(); return [ - 'firstname' => $this->faker->firstName, - 'lastname' => $this->faker->lastName, - 'object' => $this->faker->words(3, true), + 'firstname' => $this->faker->firstName, + 'lastname' => $this->faker->lastName, + 'object' => $this->faker->words(3, true), // * constructed object - 'tasks' => $this->tasks, + 'tasks' => $this->tasks, // * constructed object result - 'total' => $this->total, + 'total' => $this->total, // * constructed object result - 'total_days' => $this->totalDays, - 'comment' => $this->faker->text(\rand(20, 40)), - 'show_days' => $this->faker->boolean(75), - 'signed_date' => + 'total_days' => $this->totalDays, + 'comment' => $this->faker->text(\rand(20, 40)), + 'show_days' => $this->faker->boolean(75), + 'signed_date' => $this->signedDateBoolean ? $this->faker->dateTimeBetween('-1 year', '+1 year') : null, - 'sent_client_date' => + 'sent_client_date' => $this->signedDateBoolean && $this->sentClientDateBoolean ? $this->faker->dateTimeBetween('-1 year', '+1 year') : null, 'sent_accounting_date' => diff --git a/database/factories/PackageFactory.php b/database/factories/PackageFactory.php index 85ce43e..e2e32c6 100644 --- a/database/factories/PackageFactory.php +++ b/database/factories/PackageFactory.php @@ -19,10 +19,10 @@ class PackageFactory extends Factory * * @return array */ - public function definition() + public function definition(): array { return [ - 'name' => $this->faker->name, + 'name' => $this->faker->name, 'amount' => $this->faker->unique()->randomFloat(2, 120, 850) ]; } diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 7b01f11..ad11283 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -20,15 +20,15 @@ class UserFactory extends Factory * * @return array */ - public function definition() + public function definition(): array { return [ - 'name' => $this->faker->name, - 'email' => $this->faker->unique()->safeEmail, + 'name' => $this->faker->name, + 'email' => $this->faker->unique()->safeEmail, 'email_verified_at' => now(), // * password - 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', - 'remember_token' => Str::random(10), + 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', + 'remember_token' => Str::random(10), ]; } } diff --git a/database/migrations/2022_05_24_104346_assign_user_to_tickets.php b/database/migrations/2022_05_24_104346_assign_user_to_tickets.php index 542f53b..0fc3357 100644 --- a/database/migrations/2022_05_24_104346_assign_user_to_tickets.php +++ b/database/migrations/2022_05_24_104346_assign_user_to_tickets.php @@ -11,7 +11,7 @@ class AssignUserToTickets extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('tickets', function (Blueprint $table) { $table->foreignId('assigned_to') @@ -28,7 +28,7 @@ class AssignUserToTickets extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('tickets', function (Blueprint $table) { $table->dropForeign(['assigned_to']); diff --git a/database/migrations/2022_05_24_122728_move_images_to_storage.php b/database/migrations/2022_05_24_122728_move_images_to_storage.php index c404e2d..6099f09 100644 --- a/database/migrations/2022_05_24_122728_move_images_to_storage.php +++ b/database/migrations/2022_05_24_122728_move_images_to_storage.php @@ -4,7 +4,6 @@ use App\Models\File as ModelsFile; use App\Models\Message; use App\Models\Ticket; use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Schema; @@ -15,10 +14,9 @@ class MoveImagesToStorage extends Migration * * @return void */ - public function up() + public function up(): void { - // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass - Schema::table('storage', function (Blueprint $table) { + Schema::table('storage', function () { if (File::exists(public_path('fichiers'))) { File::moveDirectory(public_path('fichiers'), public_path('storage/fichiers')); Ticket::all()->map(function (Ticket $ticket) { @@ -45,15 +43,4 @@ class MoveImagesToStorage extends Migration } //end if }); } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('storage', function (Blueprint $table) { - }); - } } diff --git a/database/migrations/2022_05_25_120339_create_labels_table.php b/database/migrations/2022_05_25_120339_create_labels_table.php index 94e75bb..a842b98 100644 --- a/database/migrations/2022_05_25_120339_create_labels_table.php +++ b/database/migrations/2022_05_25_120339_create_labels_table.php @@ -12,7 +12,7 @@ class CreateLabelsTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('labels', function (Blueprint $table) { $table->id(); @@ -37,7 +37,7 @@ class CreateLabelsTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('labels'); } diff --git a/database/migrations/2022_05_25_121407_create_label_ticket_table.php b/database/migrations/2022_05_25_121407_create_label_ticket_table.php index 29bd99d..43d55be 100644 --- a/database/migrations/2022_05_25_121407_create_label_ticket_table.php +++ b/database/migrations/2022_05_25_121407_create_label_ticket_table.php @@ -13,7 +13,7 @@ class CreateLabelTicketTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('label_ticket', function (Blueprint $table) { $table->foreignIdFor(Ticket::class) @@ -28,7 +28,7 @@ class CreateLabelTicketTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('label_ticket'); } diff --git a/database/migrations/2022_05_30_091333_create_brands_table.php b/database/migrations/2022_05_30_091333_create_brands_table.php index 48fa439..8ca770f 100644 --- a/database/migrations/2022_05_30_091333_create_brands_table.php +++ b/database/migrations/2022_05_30_091333_create_brands_table.php @@ -11,13 +11,11 @@ class CreateBrandsTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('brands', function (Blueprint $table) { $table->id()->comment('Doit correspondre aux ids marques de la CRM'); - $table->string('name')->comment('Nom de la marque'); - $table->timestamps(); }); } @@ -27,7 +25,7 @@ class CreateBrandsTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('brands'); } diff --git a/database/migrations/2022_05_30_091340_add_brand_id_to_sites.php b/database/migrations/2022_05_30_091340_add_brand_id_to_sites.php index 8dfd1f2..313a2ef 100644 --- a/database/migrations/2022_05_30_091340_add_brand_id_to_sites.php +++ b/database/migrations/2022_05_30_091340_add_brand_id_to_sites.php @@ -12,7 +12,7 @@ class AddBrandIdToSites extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('sites', function (Blueprint $table) { $table->foreignIdFor(Brand::class) @@ -28,7 +28,7 @@ class AddBrandIdToSites extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('sites', function (Blueprint $table) { $table->dropForeign(['brand_id']); diff --git a/database/migrations/2022_05_30_091401_create_credit_accounts_table.php b/database/migrations/2022_05_30_091401_create_credit_accounts_table.php index eb4e732..ce09a85 100644 --- a/database/migrations/2022_05_30_091401_create_credit_accounts_table.php +++ b/database/migrations/2022_05_30_091401_create_credit_accounts_table.php @@ -12,19 +12,14 @@ class CreateCreditAccountsTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('credit_accounts', function (Blueprint $table) { $table->id(); - $table->unsignedTinyInteger('type')->comment('Enum Credit\\AccountTypeEnum'); - $table->string('label')->comment('Custom account label'); $table->float('balance')->comment('Account balance'); - - $table->foreignIdFor(Brand::class) - ->constrained(); - + $table->foreignIdFor(Brand::class)->constrained(); $table->timestamps(); }); } @@ -34,7 +29,7 @@ class CreateCreditAccountsTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('credit_accounts'); } diff --git a/database/migrations/2022_05_30_091412_create_credit_logs_table.php b/database/migrations/2022_05_30_091412_create_credit_logs_table.php index 3caeb08..154f84f 100644 --- a/database/migrations/2022_05_30_091412_create_credit_logs_table.php +++ b/database/migrations/2022_05_30_091412_create_credit_logs_table.php @@ -11,18 +11,13 @@ class CreateCreditLogsTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('credit_logs', function (Blueprint $table) { $table->id(); - $table->unsignedTinyInteger('type')->comment('Enum Credit\\BalanceOperationEnum'); $table->unsignedFloat('amount')->comment('Montant de l\'opération'); - - $table->foreignId('credit_account_id') - ->constrained('credit_accounts') - ->cascadeOnDelete(); - + $table->foreignId('credit_account_id')->constrained('credit_accounts')->cascadeOnDelete(); $table->timestamp('created_at'); }); } @@ -32,7 +27,7 @@ class CreateCreditLogsTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('credit_logs'); } diff --git a/database/migrations/2022_05_30_091438_create_credit_estimations_table.php b/database/migrations/2022_05_30_091438_create_credit_estimations_table.php index 6100458..df2d08c 100644 --- a/database/migrations/2022_05_30_091438_create_credit_estimations_table.php +++ b/database/migrations/2022_05_30_091438_create_credit_estimations_table.php @@ -13,13 +13,13 @@ class CreateCreditEstimationsTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('credit_estimations', function (Blueprint $table) { $table->id(); $table->unsignedTinyInteger('status')->default(EstimationStatusEnum::pending) - ->comment('Enum Credit\\EstimationStatusEnum'); + ->comment('Enum Credit\\EstimationStatusEnum'); $table->unsignedFloat('amount')->comment('Estimation amount'); @@ -27,15 +27,15 @@ class CreateCreditEstimationsTable extends Migration ->constrained(); $table->foreignId('credit_account_id') - ->comment('The account to debit.') - ->constrained('credit_accounts'); + ->comment('The account to debit.') + ->constrained('credit_accounts'); $table->foreignId('estimator_id') - ->comment('The person who has done the estimate.') - ->constrained('users'); + ->comment('The person who has done the estimate.') + ->constrained('users'); $table->foreignId('validator_id') - ->nullable() - ->comment('The person who has validate the estimate.') - ->constrained('users'); + ->nullable() + ->comment('The person who has validate the estimate.') + ->constrained('users'); $table->timestamps(); }); @@ -46,7 +46,7 @@ class CreateCreditEstimationsTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('credit_estimations'); } diff --git a/database/migrations/2022_05_30_091453_create_credit_estimation_log_table.php b/database/migrations/2022_05_30_091453_create_credit_estimation_log_table.php index b9758b5..f4d3d25 100644 --- a/database/migrations/2022_05_30_091453_create_credit_estimation_log_table.php +++ b/database/migrations/2022_05_30_091453_create_credit_estimation_log_table.php @@ -11,17 +11,17 @@ class CreateCreditEstimationLogTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('credit_estimation_log', function (Blueprint $table) { $table->id(); $table->foreignId('credit_log_id') - ->constrained('credit_logs') + ->constrained('credit_logs') ->cascadeOnDelete(); $table->foreignId('credit_estimation_id') - ->constrained('credit_estimations') + ->constrained('credit_estimations') ->cascadeOnDelete(); $table->timestamps(); @@ -33,7 +33,7 @@ class CreateCreditEstimationLogTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('credit_estimation_log'); } diff --git a/database/migrations/2022_06_15_182442_change_amout_floating_point_on_credit_estimations.php b/database/migrations/2022_06_15_182442_change_amout_floating_point_on_credit_estimations.php index e60f793..7502c1e 100644 --- a/database/migrations/2022_06_15_182442_change_amout_floating_point_on_credit_estimations.php +++ b/database/migrations/2022_06_15_182442_change_amout_floating_point_on_credit_estimations.php @@ -10,7 +10,7 @@ class ChangeAmoutFloatingPointOnCreditEstimations extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('credit_estimations', function ($table) { $table->unsignedFloat('amount', 8, 3) @@ -23,7 +23,7 @@ class ChangeAmoutFloatingPointOnCreditEstimations extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('credit_estimations', function ($table) { $table->unsignedFloat('amount') diff --git a/database/migrations/2022_08_22_154457_create_packages_table.php b/database/migrations/2022_08_22_154457_create_packages_table.php index 65d1bbb..88eef8f 100644 --- a/database/migrations/2022_08_22_154457_create_packages_table.php +++ b/database/migrations/2022_08_22_154457_create_packages_table.php @@ -11,11 +11,10 @@ class CreatePackagesTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('packages', function (Blueprint $table) { $table->id(); - $table->string('name'); $table->unsignedFloat('amount')->comment('The cost per day'); }); @@ -26,7 +25,7 @@ class CreatePackagesTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('packages'); } diff --git a/database/migrations/2022_08_23_085321_create_companies_table.php b/database/migrations/2022_08_23_085321_create_companies_table.php index 1de59aa..82613cc 100644 --- a/database/migrations/2022_08_23_085321_create_companies_table.php +++ b/database/migrations/2022_08_23_085321_create_companies_table.php @@ -11,13 +11,11 @@ class CreateCompaniesTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('companies', function (Blueprint $table) { $table->id(); - $table->string('name'); - $table->timestamps(); }); } @@ -27,7 +25,7 @@ class CreateCompaniesTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('companies'); } diff --git a/database/migrations/2022_08_23_085833_create_invoices_table.php b/database/migrations/2022_08_23_085833_create_invoices_table.php index c079c23..5820d2b 100644 --- a/database/migrations/2022_08_23_085833_create_invoices_table.php +++ b/database/migrations/2022_08_23_085833_create_invoices_table.php @@ -13,7 +13,7 @@ class CreateInvoicesTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('invoices', function (Blueprint $table) { $table->id(); @@ -66,7 +66,7 @@ class CreateInvoicesTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('invoices'); } diff --git a/database/migrations/2022_08_26_112109_change_sites_projets_relation.php b/database/migrations/2022_08_26_112109_change_sites_projets_relation.php index e2b55d2..a19e307 100644 --- a/database/migrations/2022_08_26_112109_change_sites_projets_relation.php +++ b/database/migrations/2022_08_26_112109_change_sites_projets_relation.php @@ -12,7 +12,7 @@ class ChangeSitesProjetsRelation extends Migration * * @return void */ - public function up() + public function up(): void { $project_siteIds = DB::table('project_site')->get(); Schema::table('projects', function (Blueprint $table) { @@ -34,7 +34,7 @@ class ChangeSitesProjetsRelation extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('projects', function (Blueprint $table) { $table->dropForeign('admins_post_id_foreign'); diff --git a/database/migrations/2023_04_06_101917_change_tickets_status.php b/database/migrations/2023_04_06_101917_change_tickets_status.php index 5b2aa0d..21e21b9 100644 --- a/database/migrations/2023_04_06_101917_change_tickets_status.php +++ b/database/migrations/2023_04_06_101917_change_tickets_status.php @@ -10,7 +10,7 @@ class ChangeTicketsStatus extends Migration * * @return void */ - public function up() + public function up(): void { Ticket::whereIn('status', [4, 5, 7, 10]) ->update(['status' => 3]); @@ -31,7 +31,7 @@ class ChangeTicketsStatus extends Migration * * @return void */ - public function down() + public function down(): void { Ticket::where('status', 3) ->update(['status' => 10]); diff --git a/database/migrations/2023_04_06_122125_add_message_type.php b/database/migrations/2023_04_06_122125_add_message_type.php index f7233b5..faf34ca 100644 --- a/database/migrations/2023_04_06_122125_add_message_type.php +++ b/database/migrations/2023_04_06_122125_add_message_type.php @@ -13,7 +13,7 @@ class AddMessageType extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('messages', function (Blueprint $table) { $table->unsignedTinyInteger('type') @@ -33,7 +33,7 @@ class AddMessageType extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('messages', function (Blueprint $table) { $table->dropColumn('type'); diff --git a/database/migrations/2023_04_18_123853_create_dutyhours_table.php b/database/migrations/2023_04_18_123853_create_dutyhours_table.php index 1d8ccb9..77bc597 100644 --- a/database/migrations/2023_04_18_123853_create_dutyhours_table.php +++ b/database/migrations/2023_04_18_123853_create_dutyhours_table.php @@ -11,7 +11,7 @@ class CreateDutyhoursTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('dutyhours', function (Blueprint $table) { $table->id(); @@ -27,7 +27,7 @@ class CreateDutyhoursTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('dutyhours'); } diff --git a/database/migrations/2023_04_18_150623_create_informations_table.php b/database/migrations/2023_04_18_150623_create_informations_table.php index ae4165b..efa2246 100644 --- a/database/migrations/2023_04_18_150623_create_informations_table.php +++ b/database/migrations/2023_04_18_150623_create_informations_table.php @@ -11,7 +11,7 @@ class CreateInformationsTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('informations', function (Blueprint $table) { $table->id(); @@ -27,7 +27,7 @@ class CreateInformationsTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('informations'); } diff --git a/database/migrations/2023_04_19_160127_create_ticket_types_table.php b/database/migrations/2023_04_19_160127_create_ticket_types_table.php index d77f578..8188c4d 100644 --- a/database/migrations/2023_04_19_160127_create_ticket_types_table.php +++ b/database/migrations/2023_04_19_160127_create_ticket_types_table.php @@ -13,7 +13,7 @@ class CreateTicketTypesTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('ticket_types', function (Blueprint $table) { $table->id(); @@ -26,7 +26,7 @@ class CreateTicketTypesTable extends Migration foreach (TicketTypeEnum::cases() as $ticketType) { (new TicketType([ - 'type' => $ticketType, + 'type' => $ticketType, 'template' => "Cordialement.", ]))->saveQuietly(); }; @@ -37,7 +37,7 @@ class CreateTicketTypesTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('ticket_types'); } diff --git a/database/migrations/2023_08_01_125540_drop_macro_activities_table.php b/database/migrations/2023_08_01_125540_drop_macro_activities_table.php index 039d4c9..90b0069 100644 --- a/database/migrations/2023_08_01_125540_drop_macro_activities_table.php +++ b/database/migrations/2023_08_01_125540_drop_macro_activities_table.php @@ -31,7 +31,6 @@ return new class extends Migration $table->unsignedSmallInteger('activity')->comment('Enum MacroSchedule/Activity'); $table->unsignedSmallInteger('load')->comment('Le nombre d\'hommes qui vont être mobilisé pour la tâche'); $table->string('comment')->comment('Commentaire sur la tâche, (255 chars max)'); - $table->foreignIdFor(Project::class)->constrained() ->onUpdate('cascade')->onDelete('cascade'); }); diff --git a/database/migrations/2023_08_18_091917_drop_schedules_table.php b/database/migrations/2023_08_18_091917_drop_schedules_table.php index 1920eba..8b5fee1 100644 --- a/database/migrations/2023_08_18_091917_drop_schedules_table.php +++ b/database/migrations/2023_08_18_091917_drop_schedules_table.php @@ -33,7 +33,6 @@ class DropSchedulesTable extends Migration $table->text('description'); $table->bigInteger('id_lie'); $table->string('model_lie'); - $table->timestamps(); }); } diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index cac798a..a451c76 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -11,7 +11,7 @@ class DatabaseSeeder extends Seeder * * @return void */ - public function run() + public function run(): void { } } diff --git a/database/seeders/InvoicingSeeder.php b/database/seeders/InvoicingSeeder.php index 166c42e..a921293 100644 --- a/database/seeders/InvoicingSeeder.php +++ b/database/seeders/InvoicingSeeder.php @@ -19,7 +19,7 @@ class InvoicingSeeder extends Seeder * * @return void */ - public function run() + public function run(): void { /** Reset all invoices */ DB::table((new Invoice())->getTable())->truncate(); diff --git a/package-lock.json b/package-lock.json index 572ab94..73a6148 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "srcs", + "name": "support-web", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..1fdaadd --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,8 @@ +includes: + - vendor/larastan/larastan/extension.neon + +parameters: + paths: + - app/ + + level: 5 diff --git a/routes/web-bo.php b/routes/web-bo.php index faca415..a0572fb 100644 --- a/routes/web-bo.php +++ b/routes/web-bo.php @@ -41,7 +41,7 @@ Route::middleware('admin-secure') Route::middleware('auth:backend') ->group(function () { // * HOME - Route::get('/', function(){ + Route::get('/', function () { return redirect()->route('bo.ticket.index'); })->name('dashboard'); @@ -156,8 +156,10 @@ Route::middleware('admin-secure') Route::post('/{ticket}/link', [TicketController::class, 'linkTicket']) ->middleware('can:linkTicket,ticket') ->name('link'); - Route::delete('/{ticket}/unlink/{linkedTicket}', [TicketController::class, 'unlinkTicket']) - ->middleware('can:linkTicket,ticket') + Route::delete('/{ticket}/unlink/{linkedTicket}', [ + TicketController::class, + 'unlinkTicket' + ])->middleware('can:linkTicket,ticket') ->name('unlink'); Route::put('/{ticket}/archive', [TicketController::class, 'setToArchive']) ->middleware('can:changeStatus,ticket')