From b845552c37d6bb6870e1dccedfb9df2af9339e15 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:32:56 +0000 Subject: [PATCH 01/16] Apply code style --- app/Enum/CurlErrorCodes.php | 4 +- app/Enum/Enum.php | 6 +-- .../Controllers/Api/AttachmentController.php | 16 ++++---- app/Http/Controllers/Api/OCRController.php | 38 ++++++++++--------- .../Api/SubscriptionController.php | 3 +- app/Models/Permission.php | 1 + tests/Feature/ContactFormTest.php | 2 + 7 files changed, 38 insertions(+), 32 deletions(-) diff --git a/app/Enum/CurlErrorCodes.php b/app/Enum/CurlErrorCodes.php index 64316ee..9429f13 100644 --- a/app/Enum/CurlErrorCodes.php +++ b/app/Enum/CurlErrorCodes.php @@ -80,7 +80,7 @@ class CurlErrorCodes extends Enum public const CURLE_RTSP_SESSION_ERROR = 86; public const CURLE_FTP_BAD_FILE_LIST = 87; public const CURLE_CHUNK_FAILED = 88; - + /** * Curl Error messages @@ -163,7 +163,7 @@ class CurlErrorCodes extends Enum 86 => 'CURLE_RTSP_SESSION_ERROR.', 87 => 'CURLE_FTP_BAD_FILE_LIST.', 88 => 'CURLE_CHUNK_FAILED.', - + ]; } diff --git a/app/Enum/Enum.php b/app/Enum/Enum.php index 6bf900b..5596e01 100644 --- a/app/Enum/Enum.php +++ b/app/Enum/Enum.php @@ -8,7 +8,7 @@ class Enum { /** * Message list - * + * * @var array> */ public static $messages = []; @@ -57,12 +57,12 @@ class Enum /** * Returns a message from the enum subclass - * + * * @return string */ public static function getMessage(int $messageIndex, string $defaultMessage = 'Unknown'): string { - if(array_key_exists($messageIndex, self::$messages) === true) { + if (array_key_exists($messageIndex, self::$messages) === true) { return self::$messages[$messageIndex]; } diff --git a/app/Http/Controllers/Api/AttachmentController.php b/app/Http/Controllers/Api/AttachmentController.php index 36a5acc..6586734 100644 --- a/app/Http/Controllers/Api/AttachmentController.php +++ b/app/Http/Controllers/Api/AttachmentController.php @@ -29,7 +29,7 @@ class AttachmentController extends ApiController /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -40,7 +40,7 @@ class AttachmentController extends ApiController /** * Display the specified resource. * - * @param \App\Models\Attachment $attachment + * @param \App\Models\Attachment $attachment * @return \Illuminate\Http\Response */ public function show(Attachment $attachment) @@ -51,7 +51,7 @@ class AttachmentController extends ApiController /** * Show the form for editing the specified resource. * - * @param \App\Models\Attachment $attachment + * @param \App\Models\Attachment $attachment * @return \Illuminate\Http\Response */ public function edit(Attachment $attachment) @@ -62,11 +62,11 @@ class AttachmentController extends ApiController /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param \App\Models\Attachment $attachment + * @param \Illuminate\Http\Request $request + * @param \App\Models\Attachment $attachment * @return \Illuminate\Http\Response */ - public function update(Request $request, Attachment $attachment) + public function update(Request $request, Attachment $attachment) { // } @@ -74,10 +74,10 @@ class AttachmentController extends ApiController /** * Remove the specified resource from storage. * - * @param \App\Models\Attachment $attachment + * @param \App\Models\Attachment $attachment * @return \Illuminate\Http\Response */ - public function destroy(Attachment $attachment) + public function destroy(Attachment $attachment) { // } diff --git a/app/Http/Controllers/Api/OCRController.php b/app/Http/Controllers/Api/OCRController.php index cc02fd1..045f18d 100644 --- a/app/Http/Controllers/Api/OCRController.php +++ b/app/Http/Controllers/Api/OCRController.php @@ -32,7 +32,7 @@ class OCRController extends ApiController $data = ['ocr' => []]; $filters = $request->get('filters', ['tesseract']); - if(is_array($filters) === false) { + if (is_array($filters) === false) { $filters = explode(',', $filters); } @@ -52,9 +52,12 @@ class OCRController extends ApiController // We need progress updates to break the connection mid-way curl_setopt($ch, CURLOPT_BUFFERSIZE, 128); // more progress info curl_setopt($ch, CURLOPT_NOPROGRESS, false); - curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function( - $downloadSize, $downloaded, $uploadSize, $uploaded - ) use($maxDownloadSize) { + curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function ( + $downloadSize, + $downloaded, + $uploadSize, + $uploaded + ) use ($maxDownloadSize) { return ($downloaded > $maxDownloadSize) ? 1 : 0; }); @@ -62,9 +65,9 @@ class OCRController extends ApiController $curlError = curl_errno($ch); $curlSize = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); curl_close($ch); - if($curlError !== 0) { + if ($curlError !== 0) { $error = 'File size is larger then allowed'; - if($curlError !== CurlErrorCodes::CURLE_ABORTED_BY_CALLBACK) { + if ($curlError !== CurlErrorCodes::CURLE_ABORTED_BY_CALLBACK) { $error = CurlErrorCodes::getMessage($curlError); } @@ -77,8 +80,8 @@ class OCRController extends ApiController // tesseract (overall) $ocr = null; - foreach($filters as $filterItem) { - if(str_starts_with($filterItem, 'tesseract') === true) { + foreach ($filters as $filterItem) { + if (str_starts_with($filterItem, 'tesseract') === true) { $ocr = new TesseractOCR(); $ocr->image($urlDownloadFilePath); if ($tesseractOEM !== null) { @@ -95,11 +98,10 @@ class OCRController extends ApiController } // Image Filter Function - $tesseractImageFilterFunc = function($filter, $options = null) use($curlResult, $curlSize, $ocr) { + $tesseractImageFilterFunc = function ($filter, $options = null) use ($curlResult, $curlSize, $ocr) { $result = ''; $img = imagecreatefromstring($curlResult); if ($img !== false && (($options !== null && imagefilter($img, $filter, $options) === true) || ($options === null && imagefilter($img, $filter) === true))) { - ob_start(); imagepng($img); $imgData = ob_get_contents(); @@ -108,7 +110,7 @@ class OCRController extends ApiController $ocr->imageData($imgData, $imgDataSize); imagedestroy($img); - + $result = $ocr->run(500); } @@ -116,7 +118,7 @@ class OCRController extends ApiController }; // Image Scale Function - $tesseractImageScaleFunc = function($scaleFunc) use ($curlResult, $ocr) { + $tesseractImageScaleFunc = function ($scaleFunc) use ($curlResult, $ocr) { $result = ''; $srcImage = imagecreatefromstring($curlResult); $srcWidth = imagesx($srcImage); @@ -133,7 +135,7 @@ class OCRController extends ApiController $imgData = ob_get_contents(); ob_end_clean(); $imgDataSize = strlen($imgData); - + imagedestroy($srcImage); imagedestroy($dstImage); @@ -143,7 +145,7 @@ class OCRController extends ApiController }; // filter: tesseract - if(in_array('tesseract', $filters) === true) { + if (in_array('tesseract', $filters) === true) { $data['ocr']['tesseract'] = $ocr->run(500); } @@ -154,14 +156,14 @@ class OCRController extends ApiController // filter: tesseract.double_scale if (in_array('tesseract.double_scale', $filters) === true) { - $data['ocr']['tesseract.double_scale'] = $tesseractImageScaleFunc(function($size) { + $data['ocr']['tesseract.double_scale'] = $tesseractImageScaleFunc(function ($size) { return $size * 2; }); } // filter: tesseract.half_scale if (in_array('tesseract.half_scale', $filters) === true) { - $data['ocr']['tesseract.half_scale'] = $tesseractImageScaleFunc(function($size) { + $data['ocr']['tesseract.half_scale'] = $tesseractImageScaleFunc(function ($size) { return $size / 2; }); } @@ -187,12 +189,12 @@ class OCRController extends ApiController } // filter: keras - if(in_array('keras', $filters) === true) { + if (in_array('keras', $filters) === true) { $cmd = '/usr/bin/python3 ' . base_path() . '/scripts/keras_oc.py ' . urlencode($url); $command = escapeshellcmd($cmd); $output = shell_exec($cmd); if ($output !== null && strlen($output) > 0) { - $output = substr($output, strpos($output, '----------START----------') + 25); + $output = substr($output, (strpos($output, '----------START----------') + 25)); } else { $output = ''; } diff --git a/app/Http/Controllers/Api/SubscriptionController.php b/app/Http/Controllers/Api/SubscriptionController.php index 3b5bfc2..4ff80c6 100644 --- a/app/Http/Controllers/Api/SubscriptionController.php +++ b/app/Http/Controllers/Api/SubscriptionController.php @@ -35,7 +35,8 @@ class SubscriptionController extends ApiController return $this->respondAsResource( $collection, ['isCollection' => true, - 'appendData' => ['total' => $total]] + 'appendData' => ['total' => $total] + ] ); } diff --git a/app/Models/Permission.php b/app/Models/Permission.php index 4b392e2..5c35923 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -21,6 +21,7 @@ class Permission extends Model 'user', ]; + /** * Get the User associated with this model * diff --git a/tests/Feature/ContactFormTest.php b/tests/Feature/ContactFormTest.php index 736bcf2..3bb7f94 100644 --- a/tests/Feature/ContactFormTest.php +++ b/tests/Feature/ContactFormTest.php @@ -1,4 +1,5 @@ Date: Wed, 24 May 2023 21:32:58 +0000 Subject: [PATCH 02/16] Convert string references to `::class` PHP 5.5.9 adds the new static `class` property which provides the fully qualified class name. This is preferred over using strings for class names since the `class` property references are checked by PHP. --- app/Conductors/AnalyticsConductor.php | 2 +- app/Conductors/ArticleConductor.php | 2 +- app/Conductors/EventConductor.php | 2 +- app/Conductors/MediaConductor.php | 2 +- app/Conductors/ShortlinkConductor.php | 2 +- app/Conductors/SubscriptionConductor.php | 2 +- app/Conductors/UserConductor.php | 2 +- app/Filters/SubscriptionFilter.php | 2 +- app/Models/Article.php | 2 +- app/Models/Event.php | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/Conductors/AnalyticsConductor.php b/app/Conductors/AnalyticsConductor.php index f957b60..7fecbc3 100644 --- a/app/Conductors/AnalyticsConductor.php +++ b/app/Conductors/AnalyticsConductor.php @@ -19,7 +19,7 @@ class AnalyticsConductor extends Conductor * The Model Class * @var string */ - protected $class = '\App\Models\Analytics'; + protected $class = \App\Models\Analytics::class; /** * The default sorting field diff --git a/app/Conductors/ArticleConductor.php b/app/Conductors/ArticleConductor.php index 437c323..a99d54a 100644 --- a/app/Conductors/ArticleConductor.php +++ b/app/Conductors/ArticleConductor.php @@ -19,7 +19,7 @@ class ArticleConductor extends Conductor * The Model Class * @var string */ - protected $class = '\App\Models\Article'; + protected $class = \App\Models\Article::class; /** * The default sorting field diff --git a/app/Conductors/EventConductor.php b/app/Conductors/EventConductor.php index a2b482a..d20e82c 100644 --- a/app/Conductors/EventConductor.php +++ b/app/Conductors/EventConductor.php @@ -14,7 +14,7 @@ class EventConductor extends Conductor * The Model Class * @var string */ - protected $class = '\App\Models\Event'; + protected $class = \App\Models\Event::class; /** * The default sorting field diff --git a/app/Conductors/MediaConductor.php b/app/Conductors/MediaConductor.php index 16abbee..0b29d06 100644 --- a/app/Conductors/MediaConductor.php +++ b/app/Conductors/MediaConductor.php @@ -12,7 +12,7 @@ class MediaConductor extends Conductor * The Model Class * @var string */ - protected $class = '\App\Models\Media'; + protected $class = \App\Models\Media::class; /** * The default sorting field diff --git a/app/Conductors/ShortlinkConductor.php b/app/Conductors/ShortlinkConductor.php index 9a32bcf..578d81f 100644 --- a/app/Conductors/ShortlinkConductor.php +++ b/app/Conductors/ShortlinkConductor.php @@ -12,7 +12,7 @@ class ShortlinkConductor extends Conductor * The Model Class * @var string */ - protected $class = '\App\Models\Shortlink'; + protected $class = \App\Models\Shortlink::class; /** * The default sorting field diff --git a/app/Conductors/SubscriptionConductor.php b/app/Conductors/SubscriptionConductor.php index 191eed6..54a0c95 100644 --- a/app/Conductors/SubscriptionConductor.php +++ b/app/Conductors/SubscriptionConductor.php @@ -10,7 +10,7 @@ class SubscriptionConductor extends Conductor * The Model Class * @var string */ - protected $class = '\App\Models\Subscription'; + protected $class = \App\Models\Subscription::class; /** diff --git a/app/Conductors/UserConductor.php b/app/Conductors/UserConductor.php index 4c21e69..2881993 100644 --- a/app/Conductors/UserConductor.php +++ b/app/Conductors/UserConductor.php @@ -10,7 +10,7 @@ class UserConductor extends Conductor * The Model Class * @var string */ - protected $class = '\App\Models\User'; + protected $class = \App\Models\User::class; /** diff --git a/app/Filters/SubscriptionFilter.php b/app/Filters/SubscriptionFilter.php index 04d0d8d..8e210d2 100644 --- a/app/Filters/SubscriptionFilter.php +++ b/app/Filters/SubscriptionFilter.php @@ -11,7 +11,7 @@ class SubscriptionFilter extends FilterAbstract * * @var mixed */ - protected $class = '\App\Models\Subscription'; + protected $class = \App\Models\Subscription::class; /** diff --git a/app/Models/Article.php b/app/Models/Article.php index 4df85b3..34066c7 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -44,6 +44,6 @@ class Article extends Model */ public function attachments() { - return $this->morphMany('App\Models\Attachment', 'attachable'); + return $this->morphMany(\App\Models\Attachment::class, 'attachable'); } } diff --git a/app/Models/Event.php b/app/Models/Event.php index ebd791c..b2dca8d 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -43,7 +43,7 @@ class Event extends Model */ public function attachments() { - return $this->morphMany('App\Models\Attachment', 'attachable'); + return $this->morphMany(\App\Models\Attachment::class, 'attachable'); } /** -- 2.49.1 From 8a52c4529f92a57cf9714431c7c5617166aa06db Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:32:59 +0000 Subject: [PATCH 03/16] Use Faker methods Accessing Faker properties was deprecated in Faker 1.14. --- database/factories/ArticleFactory.php | 4 ++-- database/factories/EventFactory.php | 4 ++-- database/factories/MediaFactory.php | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/database/factories/ArticleFactory.php b/database/factories/ArticleFactory.php index 56ee276..d6e656e 100644 --- a/database/factories/ArticleFactory.php +++ b/database/factories/ArticleFactory.php @@ -24,8 +24,8 @@ class ArticleFactory extends Factory 'slug' => $this->faker->slug(), 'publish_at' => $publishDate, 'content' => $this->faker->paragraphs(3, true), - 'user_id' => $this->faker->uuid, - 'hero' => $this->faker->uuid, + 'user_id' => $this->faker->uuid(), + 'hero' => $this->faker->uuid(), ]; } } diff --git a/database/factories/EventFactory.php b/database/factories/EventFactory.php index d4b1976..19e4d39 100644 --- a/database/factories/EventFactory.php +++ b/database/factories/EventFactory.php @@ -24,14 +24,14 @@ class EventFactory extends Factory return [ 'title' => $this->faker->sentence(), 'location' => $this->faker->randomElement(['online', 'physical']), - 'address' => $this->faker->address, + 'address' => $this->faker->address(), 'start_at' => $startDate, 'end_at' => $endDate, 'publish_at' => $publishDate, 'status' => $this->faker->randomElement(['draft', 'soon', 'open', 'closed', 'cancelled']), 'registration_type' => $this->faker->randomElement(['none', 'email', 'link', 'message']), 'registration_data' => $this->faker->sentence(), - 'hero' => $this->faker->uuid, + 'hero' => $this->faker->uuid(), 'content' => $this->faker->paragraphs(3, true), 'price' => $this->faker->numberBetween(0, 150), 'ages' => $this->faker->regexify('\d+(\+|\-\d+)?'), diff --git a/database/factories/MediaFactory.php b/database/factories/MediaFactory.php index 05244ae..e1b52d0 100644 --- a/database/factories/MediaFactory.php +++ b/database/factories/MediaFactory.php @@ -19,9 +19,9 @@ class MediaFactory extends Factory { return [ 'title' => $this->faker->sentence(), - 'name' => storage_path('app/public/') . $this->faker->slug() . '.' . $this->faker->fileExtension, - 'mime_type' => $this->faker->mimeType, - 'user_id' => $this->faker->uuid, + 'name' => storage_path('app/public/') . $this->faker->slug() . '.' . $this->faker->fileExtension(), + 'mime_type' => $this->faker->mimeType(), + 'user_id' => $this->faker->uuid(), 'size' => $this->faker->numberBetween(1000, 1000000), ]; } -- 2.49.1 From c4f3eb9a4ed94cc7ec3c8c6402f89c04b86d2174 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:32:59 +0000 Subject: [PATCH 04/16] Remove default `lang` files --- lang/en/auth.php | 20 ----- lang/en/pagination.php | 19 ----- lang/en/passwords.php | 22 ----- lang/en/validation.php | 179 ----------------------------------------- 4 files changed, 240 deletions(-) delete mode 100644 lang/en/auth.php delete mode 100644 lang/en/pagination.php delete mode 100644 lang/en/passwords.php delete mode 100644 lang/en/validation.php diff --git a/lang/en/auth.php b/lang/en/auth.php deleted file mode 100644 index 6598e2c..0000000 --- a/lang/en/auth.php +++ /dev/null @@ -1,20 +0,0 @@ - 'These credentials do not match our records.', - 'password' => 'The provided password is incorrect.', - 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', - -]; diff --git a/lang/en/pagination.php b/lang/en/pagination.php deleted file mode 100644 index d481411..0000000 --- a/lang/en/pagination.php +++ /dev/null @@ -1,19 +0,0 @@ - '« Previous', - 'next' => 'Next »', - -]; diff --git a/lang/en/passwords.php b/lang/en/passwords.php deleted file mode 100644 index 2345a56..0000000 --- a/lang/en/passwords.php +++ /dev/null @@ -1,22 +0,0 @@ - 'Your password has been reset!', - 'sent' => 'We have emailed your password reset link!', - 'throttled' => 'Please wait before retrying.', - 'token' => 'This password reset token is invalid.', - 'user' => "We can't find a user with that email address.", - -]; diff --git a/lang/en/validation.php b/lang/en/validation.php deleted file mode 100644 index af94bd4..0000000 --- a/lang/en/validation.php +++ /dev/null @@ -1,179 +0,0 @@ - 'The :attribute must be accepted.', - 'accepted_if' => 'The :attribute must be accepted when :other is :value.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute must only contain letters.', - 'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.', - 'alpha_num' => 'The :attribute must only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'ascii' => 'The :attribute must only contain single-byte alphanumeric characters and symbols.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ - 'array' => 'The :attribute must have between :min and :max items.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'numeric' => 'The :attribute must be between :min and :max.', - 'string' => 'The :attribute must be between :min and :max characters.', - ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'current_password' => 'The password is incorrect.', - 'date' => 'The :attribute is not a valid date.', - 'date_equals' => 'The :attribute must be a date equal to :date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'decimal' => 'The :attribute must have :decimal decimal places.', - 'declined' => 'The :attribute must be declined.', - 'declined_if' => 'The :attribute must be declined when :other is :value.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'doesnt_end_with' => 'The :attribute may not end with one of the following: :values.', - 'doesnt_start_with' => 'The :attribute may not start with one of the following: :values.', - 'email' => 'The :attribute must be a valid email address.', - 'ends_with' => 'The :attribute must end with one of the following: :values.', - 'enum' => 'The selected :attribute is invalid.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field must have a value.', - 'gt' => [ - 'array' => 'The :attribute must have more than :value items.', - 'file' => 'The :attribute must be greater than :value kilobytes.', - 'numeric' => 'The :attribute must be greater than :value.', - 'string' => 'The :attribute must be greater than :value characters.', - ], - 'gte' => [ - 'array' => 'The :attribute must have :value items or more.', - 'file' => 'The :attribute must be greater than or equal to :value kilobytes.', - 'numeric' => 'The :attribute must be greater than or equal to :value.', - 'string' => 'The :attribute must be greater than or equal to :value characters.', - ], - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'ipv4' => 'The :attribute must be a valid IPv4 address.', - 'ipv6' => 'The :attribute must be a valid IPv6 address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'lowercase' => 'The :attribute must be lowercase.', - 'lt' => [ - 'array' => 'The :attribute must have less than :value items.', - 'file' => 'The :attribute must be less than :value kilobytes.', - 'numeric' => 'The :attribute must be less than :value.', - 'string' => 'The :attribute must be less than :value characters.', - ], - 'lte' => [ - 'array' => 'The :attribute must not have more than :value items.', - 'file' => 'The :attribute must be less than or equal to :value kilobytes.', - 'numeric' => 'The :attribute must be less than or equal to :value.', - 'string' => 'The :attribute must be less than or equal to :value characters.', - ], - 'mac_address' => 'The :attribute must be a valid MAC address.', - 'max' => [ - 'array' => 'The :attribute must not have more than :max items.', - 'file' => 'The :attribute must not be greater than :max kilobytes.', - 'numeric' => 'The :attribute must not be greater than :max.', - 'string' => 'The :attribute must not be greater than :max characters.', - ], - 'max_digits' => 'The :attribute must not have more than :max digits.', - 'mimes' => 'The :attribute must be a file of type: :values.', - 'mimetypes' => 'The :attribute must be a file of type: :values.', - 'min' => [ - 'array' => 'The :attribute must have at least :min items.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'numeric' => 'The :attribute must be at least :min.', - 'string' => 'The :attribute must be at least :min characters.', - ], - 'min_digits' => 'The :attribute must have at least :min digits.', - 'multiple_of' => 'The :attribute must be a multiple of :value.', - 'not_in' => 'The selected :attribute is invalid.', - 'not_regex' => 'The :attribute format is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'password' => [ - 'letters' => 'The :attribute must contain at least one letter.', - 'mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.', - 'numbers' => 'The :attribute must contain at least one number.', - 'symbols' => 'The :attribute must contain at least one symbol.', - 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', - ], - 'present' => 'The :attribute field must be present.', - 'prohibited' => 'The :attribute field is prohibited.', - 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', - 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', - 'prohibits' => 'The :attribute field prohibits :other from being present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_array_keys' => 'The :attribute field must contain entries for: :values.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_if_accepted' => 'The :attribute field is required when :other is accepted.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values are present.', - 'required_without' => 'The :attribute field is required when :values is not present.', - 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size' => [ - 'array' => 'The :attribute must contain :size items.', - 'file' => 'The :attribute must be :size kilobytes.', - 'numeric' => 'The :attribute must be :size.', - 'string' => 'The :attribute must be :size characters.', - ], - 'starts_with' => 'The :attribute must start with one of the following: :values.', - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid timezone.', - 'unique' => 'The :attribute has already been taken.', - 'uploaded' => 'The :attribute failed to upload.', - 'uppercase' => 'The :attribute must be uppercase.', - 'url' => 'The :attribute must be a valid URL.', - 'ulid' => 'The :attribute must be a valid ULID.', - 'uuid' => 'The :attribute must be a valid UUID.', - - /* - |-------------------------------------------------------------------------- - | Custom Validation Language Lines - |-------------------------------------------------------------------------- - | - | Here you may specify custom validation messages for attributes using the - | convention "attribute.rule" to name the lines. This makes it quick to - | specify a specific custom language line for a given attribute rule. - | - */ - - 'custom' => [ - 'attribute-name' => [ - 'rule-name' => 'custom-message', - ], - ], - - /* - |-------------------------------------------------------------------------- - | Custom Validation Attributes - |-------------------------------------------------------------------------- - | - | The following language lines are used to swap our attribute placeholder - | with something more reader friendly such as "E-Mail Address" instead - | of "email". This simply helps us make our message more expressive. - | - */ - - 'attributes' => [], - -]; -- 2.49.1 From a133f829977524f6f5edd224d98ba904104a3925 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:33:00 +0000 Subject: [PATCH 05/16] Remove explicit call to register policies --- app/Providers/AuthServiceProvider.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 024a84c..da2295b 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -24,8 +24,6 @@ class AuthServiceProvider extends ServiceProvider */ public function boot() { - $this->registerPolicies(); - // } } -- 2.49.1 From 028e1a191e1d0615cfba34c324e861d2607079e5 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:33:08 +0000 Subject: [PATCH 06/16] Shift core files --- app/Exceptions/Handler.php | 18 ------- app/Http/Controllers/Controller.php | 2 - app/Http/Kernel.php | 8 ++-- app/Http/Middleware/TrustHosts.php | 2 +- app/Providers/BroadcastServiceProvider.php | 4 +- app/Providers/RouteServiceProvider.php | 56 +++++++++------------- tests/CreatesApplication.php | 7 ++- 7 files changed, 32 insertions(+), 65 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index de89608..487dcc8 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -12,24 +12,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException; class Handler extends ExceptionHandler { - /** - * A list of exception types with their corresponding custom log levels. - * - * @var array, \Psr\Log\LogLevel::*> - */ - protected $levels = [ - // - ]; - - /** - * A list of the exception types that are not reported. - * - * @var array> - */ - protected $dontReport = [ - // - ]; - /** * A list of the inputs that are never flashed to the session on validation exceptions. * diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index ce1176d..f1406be 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -3,13 +3,11 @@ namespace App\Http\Controllers; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; -use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; class Controller extends BaseController { use AuthorizesRequests; - use DispatchesJobs; use ValidatesRequests; } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index b63ff09..ca0a07b 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -40,7 +40,7 @@ class Kernel extends HttpKernel 'api' => [ // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, - 'throttle:api', + \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', \Illuminate\Routing\Middleware\SubstituteBindings::class, // \App\Http\Middleware\ForceJsonResponse::class, 'useSanctumGuard', @@ -49,13 +49,13 @@ class Kernel extends HttpKernel ]; /** - * The application's route middleware. + * The application's middleware aliases. * - * These middleware may be assigned to groups or used individually. + * Aliases may be used to conveniently assign middleware to routes and groups. * * @var array */ - protected $routeMiddleware = [ + protected $middlewareAliases = [ 'auth' => \App\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 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/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 395c518..2be04f5 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -9,10 +9,8 @@ class BroadcastServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { Broadcast::routes(); diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index de4213d..85b20a8 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -28,7 +28,29 @@ class RouteServiceProvider extends ServiceProvider */ public function boot() { - $this->configureRateLimiting(); + // RateLimiter::for('api', function (Request $request) { + // return Limit::perMinute(60)->by($request->user()?->id !== null ?: $request->ip()); + // }); + + $rateLimitEnabled = true; + $user = auth()->user(); + + if (app()->environment('testing')) { + $rateLimitEnabled = false; + } elseif ($user !== null && $user->hasPermission('admin/ratelimit') === true) { + // Admin users with the "admin/ratelimit" permission are not rate limited + $rateLimitEnabled = false; + } + + if ($rateLimitEnabled === true) { + RateLimiter::for('api', function (Request $request) { + return Limit::perMinute(180)->by($request->user()?->id ?: $request->ip()); + }); + } else { + RateLimiter::for('api', function () { + return Limit::none(); + }); + } $this->routes(function () { Route::middleware('api') @@ -55,36 +77,4 @@ class RouteServiceProvider extends ServiceProvider ->name("{{$singularUri}}.attachments.destroy"); }); } - - /** - * Configure the rate limiters for the application. - * - * @return void - */ - protected function configureRateLimiting() - { - // RateLimiter::for('api', function (Request $request) { - // return Limit::perMinute(60)->by($request->user()?->id !== null ?: $request->ip()); - // }); - - $rateLimitEnabled = true; - $user = auth()->user(); - - if (app()->environment('testing')) { - $rateLimitEnabled = false; - } elseif ($user !== null && $user->hasPermission('admin/ratelimit') === true) { - // Admin users with the "admin/ratelimit" permission are not rate limited - $rateLimitEnabled = false; - } - - if ($rateLimitEnabled === true) { - RateLimiter::for('api', function (Request $request) { - return Limit::perMinute(180)->by($request->user()?->id ?: $request->ip()); - }); - } else { - RateLimiter::for('api', function () { - return Limit::none(); - }); - } - } } diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index ab92402..cc68301 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -3,17 +3,16 @@ namespace Tests; use Illuminate\Contracts\Console\Kernel; +use Illuminate\Foundation\Application; trait CreatesApplication { /** * Creates the application. - * - * @return \Illuminate\Foundation\Application */ - public function createApplication() + public function createApplication(): Application { - $app = require __DIR__ . '/../bootstrap/app.php'; + $app = require __DIR__.'/../bootstrap/app.php'; $app->make(Kernel::class)->bootstrap(); -- 2.49.1 From 8b671065e9968498af3a05be73d9eea12d547bad Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:33:11 +0000 Subject: [PATCH 07/16] Shift config files --- config/cache.php | 2 +- config/logging.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config/cache.php b/config/cache.php index daf5e68..33bb295 100644 --- a/config/cache.php +++ b/config/cache.php @@ -105,6 +105,6 @@ return [ | */ - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'), + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), ]; diff --git a/config/logging.php b/config/logging.php index 752af71..c44d276 100644 --- a/config/logging.php +++ b/config/logging.php @@ -3,6 +3,7 @@ use Monolog\Handler\NullHandler; use Monolog\Handler\StreamHandler; use Monolog\Handler\SyslogUdpHandler; +use Monolog\Processor\PsrLogMessageProcessor; return [ @@ -61,6 +62,7 @@ return [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), + 'replace_placeholders' => true, ], 'daily' => [ @@ -68,6 +70,7 @@ return [ 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), 'days' => 14, + 'replace_placeholders' => true, ], 'slack' => [ @@ -76,6 +79,7 @@ return [ 'username' => 'Laravel Log', 'emoji' => ':boom:', 'level' => env('LOG_LEVEL', 'critical'), + 'replace_placeholders' => true, ], 'papertrail' => [ @@ -85,8 +89,9 @@ return [ 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), - 'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'), + 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), ], + 'processors' => [PsrLogMessageProcessor::class], ], 'stderr' => [ @@ -97,16 +102,20 @@ return [ 'with' => [ 'stream' => 'php://stderr', ], + 'processors' => [PsrLogMessageProcessor::class], ], 'syslog' => [ 'driver' => 'syslog', 'level' => env('LOG_LEVEL', 'debug'), + 'facility' => LOG_USER, + 'replace_placeholders' => true, ], 'errorlog' => [ 'driver' => 'errorlog', 'level' => env('LOG_LEVEL', 'debug'), + 'replace_placeholders' => true, ], 'null' => [ -- 2.49.1 From 3ad2b2fb8e2500643a8dcc53364dae349b3e99e0 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:33:11 +0000 Subject: [PATCH 08/16] Default config files In an effort to make upgrading the constantly changing config files easier, Shift defaulted them and merged your true customizations - where ENV variables may not be used. --- config/app.php | 33 +++------------------------------ config/auth.php | 6 +++++- config/broadcasting.php | 2 +- config/database.php | 5 ++--- config/filesystems.php | 22 ++++++++++++++++++++++ config/mail.php | 8 +++++++- config/services.php | 1 + 7 files changed, 41 insertions(+), 36 deletions(-) diff --git a/config/app.php b/config/app.php index 030f356..ddfaa03 100644 --- a/config/app.php +++ b/config/app.php @@ -1,5 +1,6 @@ [ - - /* - * Laravel Framework Service Providers... - */ - Illuminate\Auth\AuthServiceProvider::class, - Illuminate\Broadcasting\BroadcastServiceProvider::class, - Illuminate\Bus\BusServiceProvider::class, - Illuminate\Cache\CacheServiceProvider::class, - Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, - Illuminate\Cookie\CookieServiceProvider::class, - Illuminate\Database\DatabaseServiceProvider::class, - Illuminate\Encryption\EncryptionServiceProvider::class, - Illuminate\Filesystem\FilesystemServiceProvider::class, - Illuminate\Foundation\Providers\FoundationServiceProvider::class, - Illuminate\Hashing\HashServiceProvider::class, - Illuminate\Mail\MailServiceProvider::class, - Illuminate\Notifications\NotificationServiceProvider::class, - Illuminate\Pagination\PaginationServiceProvider::class, - Illuminate\Pipeline\PipelineServiceProvider::class, - Illuminate\Queue\QueueServiceProvider::class, - Illuminate\Redis\RedisServiceProvider::class, - Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, - Illuminate\Session\SessionServiceProvider::class, - Illuminate\Translation\TranslationServiceProvider::class, - Illuminate\Validation\ValidationServiceProvider::class, - Illuminate\View\ViewServiceProvider::class, - + 'providers' => ServiceProvider::defaultProviders()->merge([ /* * Package Service Providers... */ @@ -196,8 +170,7 @@ return [ // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, - - ], + ])->toArray(), /* |-------------------------------------------------------------------------- diff --git a/config/auth.php b/config/auth.php index d8c6cee..d74d56a 100644 --- a/config/auth.php +++ b/config/auth.php @@ -80,10 +80,14 @@ return [ | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | - | The expire time is the number of minutes that each reset token will be + | The expiry time is the number of minutes that each reset token will be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | + | The throttle setting is the number of seconds a user must wait before + | generating more password reset tokens. This prevents the user from + | quickly generating a very large amount of password reset tokens. + | */ 'passwords' => [ diff --git a/config/broadcasting.php b/config/broadcasting.php index ca1c67e..9e4d4aa 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -36,7 +36,7 @@ return [ 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ - 'host' => env('PUSHER_HOST') === true ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com', + 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 'port' => env('PUSHER_PORT', 443), 'scheme' => env('PUSHER_SCHEME', 'https'), 'encrypted' => true, diff --git a/config/database.php b/config/database.php index 8400a85..137ad18 100644 --- a/config/database.php +++ b/config/database.php @@ -58,9 +58,8 @@ return [ 'prefix_indexes' => true, 'strict' => true, 'engine' => null, - 'options' => extension_loaded('pdo_mysql') === true ? array_filter([ + 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), - PDO::ATTR_TIMEOUT => env('DB_TIMEOUT', 30), ]) : [], ], @@ -126,7 +125,7 @@ return [ 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), ], 'default' => [ diff --git a/config/filesystems.php b/config/filesystems.php index 80a6bff..ca2df13 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -29,11 +29,13 @@ return [ */ 'disks' => [ + 'local' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL') . "/storage", 'public' => true, + 'throw' => false, ], 'cdn' => [ @@ -68,6 +70,26 @@ return [ ] ], + 'public' => [ + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL').'/storage', + 'visibility' => 'public', + 'throw' => false, + ], + + 's3' => [ + 'driver' => 's3', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION'), + 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), + 'endpoint' => env('AWS_ENDPOINT'), + 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), + 'throw' => false, + ], + ], /* diff --git a/config/mail.php b/config/mail.php index 492c953..566f0c1 100644 --- a/config/mail.php +++ b/config/mail.php @@ -28,7 +28,7 @@ return [ | sending an e-mail. You will specify which one you are using for your | mailers below. You are free to add additional mailers as required. | - | Supported: "smtp", "sendmail", "mailgun", "ses", + | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", | "postmark", "log", "array", "failover" | */ @@ -51,10 +51,16 @@ return [ 'mailgun' => [ 'transport' => 'mailgun', + // 'client' => [ + // 'timeout' => 5, + // ], ], 'postmark' => [ 'transport' => 'postmark', + // 'client' => [ + // 'timeout' => 5, + // ], ], 'sendmail' => [ diff --git a/config/services.php b/config/services.php index dc231b9..126d810 100644 --- a/config/services.php +++ b/config/services.php @@ -36,4 +36,5 @@ return [ 'site_key' => env('GOOGLE_RECAPTCHA_SITE_KEY'), 'secret_key' => env('GOOGLE_RECAPTCHA_SECRET_SITE_KEY'), ], + ]; -- 2.49.1 From 40b265e1455ba78b6e3ca11604a6786f2b3babc5 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:33:11 +0000 Subject: [PATCH 09/16] Bump Laravel dependencies --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index fb07772..25f621e 100644 --- a/composer.json +++ b/composer.json @@ -8,15 +8,15 @@ ], "license": "MIT", "require": { - "php": "^8.0.2", + "php": "^8.1", "doctrine/dbal": "^3.5", "guzzlehttp/guzzle": "^7.2", "intervention/image": "^2.7", - "laravel/framework": "^9.19", - "laravel/sanctum": "^3.0", - "laravel/tinker": "^2.7", + "laravel/framework": "^10.12", + "laravel/sanctum": "^3.2", + "laravel/tinker": "^2.8", "league/flysystem-aws-s3-v3": "^3.12", - "owen-it/laravel-auditing": "^13.0", + "owen-it/laravel-auditing": "^13.1", "php-ffmpeg/php-ffmpeg": "^1.1", "sunspikes/clamav-validator": "*", "thiagoalessio/tesseract_ocr": "^2.12", @@ -25,11 +25,11 @@ "require-dev": { "fakerphp/faker": "^1.9.1", "laravel/pint": "^1.0", - "laravel/sail": "^1.0.1", + "laravel/sail": "^1.18", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^7.1", "phpunit/phpunit": "^10.1.3", - "spatie/laravel-ignition": "^1.0" + "spatie/laravel-ignition": "^2.0" }, "autoload": { "files": [ @@ -77,6 +77,6 @@ "pestphp/pest-plugin": true } }, - "minimum-stability": "dev", + "minimum-stability": "stable", "prefer-stable": true } -- 2.49.1 From c88630e9afcacc444074761cb104cba78aaa4f2b Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:33:12 +0000 Subject: [PATCH 10/16] Adopt anonymous migrations --- database/migrations/2023_01_08_045958_create_audits_table.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2023_01_08_045958_create_audits_table.php b/database/migrations/2023_01_08_045958_create_audits_table.php index 7016272..597a958 100644 --- a/database/migrations/2023_01_08_045958_create_audits_table.php +++ b/database/migrations/2023_01_08_045958_create_audits_table.php @@ -5,7 +5,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Schema; -class CreateAuditsTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -44,4 +44,4 @@ class CreateAuditsTable extends Migration { Schema::connection(config('audit.drivers.database.connection', config('database.default')))->drop('audits'); } -} +}; -- 2.49.1 From c83e21d588d7fb22e41aa99abb1e59507f75ca85 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:33:13 +0000 Subject: [PATCH 11/16] Rename `password_resets` table --- config/auth.php | 2 +- ...24_000000_rename_password_resets_table.php | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2023_05_24_000000_rename_password_resets_table.php diff --git a/config/auth.php b/config/auth.php index d74d56a..9548c15 100644 --- a/config/auth.php +++ b/config/auth.php @@ -93,7 +93,7 @@ return [ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', + 'table' => 'password_reset_tokens', 'expire' => 60, 'throttle' => 60, ], diff --git a/database/migrations/2023_05_24_000000_rename_password_resets_table.php b/database/migrations/2023_05_24_000000_rename_password_resets_table.php new file mode 100644 index 0000000..7ea51ce --- /dev/null +++ b/database/migrations/2023_05_24_000000_rename_password_resets_table.php @@ -0,0 +1,28 @@ + Date: Wed, 24 May 2023 21:33:13 +0000 Subject: [PATCH 12/16] Set return type of base TestCase methods From the [PHPUnit 8 release notes][1], the `TestCase` methods below now declare a `void` return type: - `setUpBeforeClass()` - `setUp()` - `assertPreConditions()` - `assertPostConditions()` - `tearDown()` - `tearDownAfterClass()` - `onNotSuccessfulTest()` [1]: https://phpunit.de/announcements/phpunit-8.html --- tests/Feature/ArticlesApiTest.php | 2 +- tests/Feature/EventsApiTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Feature/ArticlesApiTest.php b/tests/Feature/ArticlesApiTest.php index 4ee0b7f..938da9a 100644 --- a/tests/Feature/ArticlesApiTest.php +++ b/tests/Feature/ArticlesApiTest.php @@ -14,7 +14,7 @@ class ArticlesApiTest extends TestCase protected $faker; - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->faker = FakerFactory::create(); diff --git a/tests/Feature/EventsApiTest.php b/tests/Feature/EventsApiTest.php index 066c283..4fb2e21 100644 --- a/tests/Feature/EventsApiTest.php +++ b/tests/Feature/EventsApiTest.php @@ -15,7 +15,7 @@ class EventsApiTest extends TestCase protected $faker; - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->faker = FakerFactory::create(); -- 2.49.1 From 979b9f704c347e18fcc53e684d354df8fe8a2f93 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:33:15 +0000 Subject: [PATCH 13/16] Add type hints for Laravel 10 --- app/Console/Commands/MediaMigrate.php | 2 +- app/Console/Commands/MediaRebuild.php | 2 +- app/Console/Kernel.php | 4 ++-- app/Exceptions/Handler.php | 2 +- app/Http/Middleware/Authenticate.php | 2 +- app/Http/Middleware/ForceJsonResponse.php | 3 ++- app/Http/Middleware/LogRequest.php | 3 ++- app/Http/Middleware/RedirectIfAuthenticated.php | 3 ++- app/Http/Middleware/UseSanctumGuard.php | 3 ++- app/Http/Requests/AuthLoginRequest.php | 2 +- app/Http/Requests/BaseRequest.php | 4 ++-- app/Http/Requests/ContactSendRequest.php | 2 +- app/Http/Requests/SubscriptionRequest.php | 2 +- app/Http/Requests/UserForgotPasswordRequest.php | 2 +- app/Http/Requests/UserRegisterRequest.php | 2 +- .../Requests/UserResendVerifyEmailRequest.php | 2 +- app/Http/Requests/UserResetPasswordRequest.php | 2 +- app/Http/Requests/UserVerifyEmailRequest.php | 2 +- app/Jobs/MoveMediaJob.php | 2 +- app/Jobs/SendEmailJob.php | 2 +- app/Jobs/StoreUploadedFileJob.php | 2 +- app/Providers/AppServiceProvider.php | 4 ++-- app/Providers/AuthServiceProvider.php | 2 +- app/Providers/EventServiceProvider.php | 4 ++-- app/Providers/RouteServiceProvider.php | 2 +- database/factories/ArticleFactory.php | 2 +- database/factories/EventFactory.php | 2 +- database/factories/MediaFactory.php | 2 +- database/factories/UserFactory.php | 2 +- .../2014_10_12_000000_create_users_table.php | 4 ++-- ...10_12_100000_create_password_resets_table.php | 4 ++-- ...019_08_19_000000_create_failed_jobs_table.php | 4 ++-- ...00001_create_personal_access_tokens_table.php | 4 ++-- .../2022_12_28_113117_create_posts_table.php | 4 ++-- .../2022_12_30_105153_create_media_table.php | 4 ++-- ...022_12_30_110049_create_permissions_table.php | 4 ++-- .../2023_01_01_103251_create_events_table.php | 4 ++-- ..._01_021_050482_create_subscriptions_table.php | 4 ++-- .../2023_01_05_043106_create_jobs_table.php | 4 ++-- ...2023_01_05_112154_create_user_codes_table.php | 4 ++-- .../2023_01_08_045958_create_audits_table.php | 4 ++-- ...023_01_08_050847_create_user_logins_table.php | 4 ++-- .../2023_01_24_080416_create_analytics_table.php | 4 ++-- ...023_02_24_023054_create_attachments_table.php | 4 ++-- ...23_02_28_090609_add_price_to_events_table.php | 4 ++-- ...023_03_01_075334_add_ages_to_events_table.php | 4 ++-- .../2023_04_05_222458_update_media_table.php | 4 ++-- ...3_update_no_nullable_phone_on_users_table.php | 4 ++-- ...18_113354_add_display_name_to_users_table.php | 4 ++-- ...023_04_19_122711_drop_subscriptions_table.php | 4 ++-- .../2023_04_25_235615_update_posts_table.php | 4 ++-- .../2023_05_01_045630_update_analytics_table.php | 4 ++-- ...4_071954_remove_username_from_users_table.php | 4 ++-- ...2023_05_06_080418_create_shortlinks_table.php | 4 ++-- ...06_082705_add_counter_to_shortlinks_table.php | 4 ++-- .../2023_05_08_021929_update_users_table.php | 4 ++-- ...3_05_09_003156_add_location_url_to_events.php | 4 ++-- ...1_032859_add_private_to_attachments_table.php | 4 ++-- ...023_05_11_033621_create_event_users_table.php | 4 ++-- ...05_24_000000_rename_password_resets_table.php | 4 ++-- database/seeders/DatabaseSeeder.php | 2 +- tests/Feature/ArticlesApiTest.php | 6 +++--- tests/Feature/AuthApiTest.php | 2 +- tests/Feature/ContactFormTest.php | 2 +- tests/Feature/EventsApiTest.php | 8 ++++---- tests/Feature/UsersApiTest.php | 16 ++++++++-------- tests/Unit/ExampleTest.php | 2 +- 67 files changed, 118 insertions(+), 114 deletions(-) diff --git a/app/Console/Commands/MediaMigrate.php b/app/Console/Commands/MediaMigrate.php index 2df0e40..3e8abe2 100644 --- a/app/Console/Commands/MediaMigrate.php +++ b/app/Console/Commands/MediaMigrate.php @@ -45,7 +45,7 @@ class MediaMigrate extends Command * * @return void */ - public function handle() + public function handle(): void { $replace = $this->option('replace'); diff --git a/app/Console/Commands/MediaRebuild.php b/app/Console/Commands/MediaRebuild.php index a60d64a..fdc0d8a 100644 --- a/app/Console/Commands/MediaRebuild.php +++ b/app/Console/Commands/MediaRebuild.php @@ -51,7 +51,7 @@ class MediaRebuild extends Command * * @return void */ - public function handle() + public function handle(): void { $replace = $this->option('replace'); $all = $this->option('replace'); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index c040de1..9169768 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel * @param \Illuminate\Console\Scheduling\Schedule $schedule The schedule. * @return void */ - protected function schedule(Schedule $schedule) + protected function schedule(Schedule $schedule): void { // $schedule->command('inspire')->hourly(); } @@ -23,7 +23,7 @@ class Kernel extends ConsoleKernel * * @return void */ - protected function commands() + protected function commands(): void { $this->load(__DIR__ . '/Commands'); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 487dcc8..72e8d38 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -29,7 +29,7 @@ class Handler extends ExceptionHandler * * @return void */ - public function register() + public function register(): void { // $this->renderable(function (HttpException $e, $request) { // if ($request->is('api/*')) { diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 3bb5a9e..ce91e84 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -12,7 +12,7 @@ class Authenticate extends Middleware * @param mixed $request Request. * @return string|null */ - protected function redirectTo(mixed $request) + protected function redirectTo(mixed $request): ?string { if ($request->expectsJson() === false) { return route('login'); diff --git a/app/Http/Middleware/ForceJsonResponse.php b/app/Http/Middleware/ForceJsonResponse.php index 3311198..efec056 100644 --- a/app/Http/Middleware/ForceJsonResponse.php +++ b/app/Http/Middleware/ForceJsonResponse.php @@ -2,6 +2,7 @@ namespace App\Http\Middleware; +use Symfony\Component\HttpFoundation\Response; use Closure; use Illuminate\Http\Request; @@ -14,7 +15,7 @@ class ForceJsonResponse * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): Response { $request->headers->set('Accept', 'application/json'); return $next($request); diff --git a/app/Http/Middleware/LogRequest.php b/app/Http/Middleware/LogRequest.php index 1ecc38f..6bce316 100644 --- a/app/Http/Middleware/LogRequest.php +++ b/app/Http/Middleware/LogRequest.php @@ -2,6 +2,7 @@ namespace App\Http\Middleware; +use Symfony\Component\HttpFoundation\Response; use Closure; use Illuminate\Http\Request; use App\Models\Analytics; @@ -15,7 +16,7 @@ class LogRequest * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): Response { // Make it an after middleware $response = $next($request); diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index e51f28c..34029f7 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -2,6 +2,7 @@ namespace App\Http\Middleware; +use Symfony\Component\HttpFoundation\Response; use App\Providers\RouteServiceProvider; use Closure; use Illuminate\Http\Request; @@ -17,7 +18,7 @@ class RedirectIfAuthenticated * @param string|null ...$guards Guards. * @return Response|RedirectResponse */ - public function handle(Request $request, Closure $next, ...$guards) + public function handle(Request $request, Closure $next, string ...$guards): Response { $guards = empty($guards) === true ? [null] : $guards; diff --git a/app/Http/Middleware/UseSanctumGuard.php b/app/Http/Middleware/UseSanctumGuard.php index 4e4e62d..3b00b9b 100644 --- a/app/Http/Middleware/UseSanctumGuard.php +++ b/app/Http/Middleware/UseSanctumGuard.php @@ -2,6 +2,7 @@ namespace App\Http\Middleware; +use Symfony\Component\HttpFoundation\Response; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -15,7 +16,7 @@ class UseSanctumGuard * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): Response { Auth::shouldUse('sanctum'); return $next($request); diff --git a/app/Http/Requests/AuthLoginRequest.php b/app/Http/Requests/AuthLoginRequest.php index 12baa20..f450276 100644 --- a/app/Http/Requests/AuthLoginRequest.php +++ b/app/Http/Requests/AuthLoginRequest.php @@ -11,7 +11,7 @@ class AuthLoginRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'email' => 'required|string|min:6|max:255', diff --git a/app/Http/Requests/BaseRequest.php b/app/Http/Requests/BaseRequest.php index 8f0ab5d..3934a1b 100644 --- a/app/Http/Requests/BaseRequest.php +++ b/app/Http/Requests/BaseRequest.php @@ -12,7 +12,7 @@ class BaseRequest extends FormRequest * * @return boolean */ - public function authorize() + public function authorize(): bool { if (request()->isMethod('post') === true && method_exists($this, 'postAuthorize') === true) { return $this->postAuthorize(); @@ -30,7 +30,7 @@ class BaseRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { $rules = []; diff --git a/app/Http/Requests/ContactSendRequest.php b/app/Http/Requests/ContactSendRequest.php index 5e24452..fc9881e 100644 --- a/app/Http/Requests/ContactSendRequest.php +++ b/app/Http/Requests/ContactSendRequest.php @@ -12,7 +12,7 @@ class ContactSendRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|max:255', diff --git a/app/Http/Requests/SubscriptionRequest.php b/app/Http/Requests/SubscriptionRequest.php index 8a02433..88a5a3d 100644 --- a/app/Http/Requests/SubscriptionRequest.php +++ b/app/Http/Requests/SubscriptionRequest.php @@ -37,7 +37,7 @@ class SubscriptionRequest extends BaseRequest * * @return array */ - public function messages() + public function messages(): array { return [ 'email.unique' => 'This email address has already subscribed', diff --git a/app/Http/Requests/UserForgotPasswordRequest.php b/app/Http/Requests/UserForgotPasswordRequest.php index eaf6ccf..c45d56f 100644 --- a/app/Http/Requests/UserForgotPasswordRequest.php +++ b/app/Http/Requests/UserForgotPasswordRequest.php @@ -12,7 +12,7 @@ class UserForgotPasswordRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'email' => 'required|exists:users,email', diff --git a/app/Http/Requests/UserRegisterRequest.php b/app/Http/Requests/UserRegisterRequest.php index 73148fc..5557663 100644 --- a/app/Http/Requests/UserRegisterRequest.php +++ b/app/Http/Requests/UserRegisterRequest.php @@ -12,7 +12,7 @@ class UserRegisterRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'display_name' => ['required','string','max:255', new Uniqueish('users')], diff --git a/app/Http/Requests/UserResendVerifyEmailRequest.php b/app/Http/Requests/UserResendVerifyEmailRequest.php index 92d34b2..09e6442 100644 --- a/app/Http/Requests/UserResendVerifyEmailRequest.php +++ b/app/Http/Requests/UserResendVerifyEmailRequest.php @@ -12,7 +12,7 @@ class UserResendVerifyEmailRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'email' => 'required|exists:users,email', diff --git a/app/Http/Requests/UserResetPasswordRequest.php b/app/Http/Requests/UserResetPasswordRequest.php index 99ed434..55141e5 100644 --- a/app/Http/Requests/UserResetPasswordRequest.php +++ b/app/Http/Requests/UserResetPasswordRequest.php @@ -12,7 +12,7 @@ class UserResetPasswordRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'code' => 'required|digits:6', diff --git a/app/Http/Requests/UserVerifyEmailRequest.php b/app/Http/Requests/UserVerifyEmailRequest.php index e2473e7..29c017e 100644 --- a/app/Http/Requests/UserVerifyEmailRequest.php +++ b/app/Http/Requests/UserVerifyEmailRequest.php @@ -12,7 +12,7 @@ class UserVerifyEmailRequest extends FormRequest * * @return array */ - public function rules() + public function rules(): array { return [ 'code' => 'required|digits:6', diff --git a/app/Jobs/MoveMediaJob.php b/app/Jobs/MoveMediaJob.php index afb4c04..9221cd7 100644 --- a/app/Jobs/MoveMediaJob.php +++ b/app/Jobs/MoveMediaJob.php @@ -51,7 +51,7 @@ class MoveMediaJob implements ShouldQueue * * @return void */ - public function handle() + public function handle(): void { // Don't continue if the media is already on the new storage disk if ($this->media->storage === $this->newStorage) { diff --git a/app/Jobs/SendEmailJob.php b/app/Jobs/SendEmailJob.php index 8b045f8..89d7d1f 100644 --- a/app/Jobs/SendEmailJob.php +++ b/app/Jobs/SendEmailJob.php @@ -50,7 +50,7 @@ class SendEmailJob implements ShouldQueue * * @return void */ - public function handle() + public function handle(): void { Mail::to($this->to)->send($this->mailable); } diff --git a/app/Jobs/StoreUploadedFileJob.php b/app/Jobs/StoreUploadedFileJob.php index b6ffa26..632bab9 100644 --- a/app/Jobs/StoreUploadedFileJob.php +++ b/app/Jobs/StoreUploadedFileJob.php @@ -65,7 +65,7 @@ class StoreUploadedFileJob implements ShouldQueue * * @return void */ - public function handle() + public function handle(): void { $storageDisk = $this->media->storage; $fileName = $this->media->name; diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 62c01a6..6478350 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -19,7 +19,7 @@ class AppServiceProvider extends ServiceProvider * * @return void */ - public function register() + public function register(): void { // } @@ -29,7 +29,7 @@ class AppServiceProvider extends ServiceProvider * * @return void */ - public function boot() + public function boot(): void { Storage::macro('public', function ($diskName) { $public = config("filesystems.disks.{$diskName}.public", false); diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index da2295b..1f84312 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -22,7 +22,7 @@ class AuthServiceProvider extends ServiceProvider * * @return void */ - public function boot() + public function boot(): void { // } diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 85a5b87..95217e4 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -29,7 +29,7 @@ class EventServiceProvider extends ServiceProvider * * @return void */ - public function boot() + public function boot(): void { // } @@ -39,7 +39,7 @@ class EventServiceProvider extends ServiceProvider * * @return boolean */ - public function shouldDiscoverEvents() + public function shouldDiscoverEvents(): bool { return false; } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 85b20a8..8c77119 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -26,7 +26,7 @@ class RouteServiceProvider extends ServiceProvider * * @return void */ - public function boot() + public function boot(): void { // RateLimiter::for('api', function (Request $request) { // return Limit::perMinute(60)->by($request->user()?->id !== null ?: $request->ip()); diff --git a/database/factories/ArticleFactory.php b/database/factories/ArticleFactory.php index d6e656e..3fc95a9 100644 --- a/database/factories/ArticleFactory.php +++ b/database/factories/ArticleFactory.php @@ -15,7 +15,7 @@ class ArticleFactory extends Factory * * @return array */ - public function definition() + public function definition(): array { $publishDate = Carbon::parse($this->faker->dateTimeBetween('-1 month', '+1 month')); diff --git a/database/factories/EventFactory.php b/database/factories/EventFactory.php index 19e4d39..285ca45 100644 --- a/database/factories/EventFactory.php +++ b/database/factories/EventFactory.php @@ -15,7 +15,7 @@ class EventFactory extends Factory * * @return array */ - public function definition() + public function definition(): array { $startDate = Carbon::parse($this->faker->dateTimeBetween('now', '+1 year')); $endDate = Carbon::parse($this->faker->dateTimeBetween($startDate, '+1 year')); diff --git a/database/factories/MediaFactory.php b/database/factories/MediaFactory.php index e1b52d0..e896c4a 100644 --- a/database/factories/MediaFactory.php +++ b/database/factories/MediaFactory.php @@ -15,7 +15,7 @@ class MediaFactory extends Factory * * @return array */ - public function definition() + public function definition(): array { return [ 'title' => $this->faker->sentence(), diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index c4e7f11..4d016d1 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -15,7 +15,7 @@ class UserFactory extends Factory * * @return array */ - public function definition() + public function definition(): array { $faker = \Faker\Factory::create(); $faker->addProvider(new \Faker\Provider\CustomInternetProvider($faker)); diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 03d1d84..2701125 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('users', function (Blueprint $table) { $table->uuid('id')->primary(); @@ -33,7 +33,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('users'); } diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index fcacb80..b4d45de 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('password_resets', function (Blueprint $table) { $table->string('email')->index(); @@ -25,7 +25,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('password_resets'); } diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 1719198..db96e7d 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('failed_jobs', function (Blueprint $table) { $table->id(); @@ -29,7 +29,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('failed_jobs'); } diff --git a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php index 9207c18..c134bc5 100644 --- a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('personal_access_tokens', function (Blueprint $table) { $table->id(); @@ -30,7 +30,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('personal_access_tokens'); } diff --git a/database/migrations/2022_12_28_113117_create_posts_table.php b/database/migrations/2022_12_28_113117_create_posts_table.php index 1890220..f4fbc61 100644 --- a/database/migrations/2022_12_28_113117_create_posts_table.php +++ b/database/migrations/2022_12_28_113117_create_posts_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('posts', function (Blueprint $table) { $table->uuid('id')->primary(); @@ -30,7 +30,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('posts'); } diff --git a/database/migrations/2022_12_30_105153_create_media_table.php b/database/migrations/2022_12_30_105153_create_media_table.php index 3873828..711cf66 100644 --- a/database/migrations/2022_12_30_105153_create_media_table.php +++ b/database/migrations/2022_12_30_105153_create_media_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('media', function (Blueprint $table) { $table->uuid('id')->primary(); @@ -30,7 +30,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('media'); } diff --git a/database/migrations/2022_12_30_110049_create_permissions_table.php b/database/migrations/2022_12_30_110049_create_permissions_table.php index 2142080..e074e4d 100644 --- a/database/migrations/2022_12_30_110049_create_permissions_table.php +++ b/database/migrations/2022_12_30_110049_create_permissions_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('permissions', function (Blueprint $table) { $table->uuid('id')->primary(); @@ -28,7 +28,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('permissions'); } diff --git a/database/migrations/2023_01_01_103251_create_events_table.php b/database/migrations/2023_01_01_103251_create_events_table.php index 7e9cde3..467874d 100644 --- a/database/migrations/2023_01_01_103251_create_events_table.php +++ b/database/migrations/2023_01_01_103251_create_events_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('events', function (Blueprint $table) { $table->uuid('id')->primary(); @@ -35,7 +35,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('events'); } diff --git a/database/migrations/2023_01_021_050482_create_subscriptions_table.php b/database/migrations/2023_01_021_050482_create_subscriptions_table.php index b47f416..656e15f 100644 --- a/database/migrations/2023_01_021_050482_create_subscriptions_table.php +++ b/database/migrations/2023_01_021_050482_create_subscriptions_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('subscriptions', function (Blueprint $table) { $table->uuid('id')->primary(); @@ -26,7 +26,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('subscriptions'); } diff --git a/database/migrations/2023_01_05_043106_create_jobs_table.php b/database/migrations/2023_01_05_043106_create_jobs_table.php index a786a89..560ae54 100644 --- a/database/migrations/2023_01_05_043106_create_jobs_table.php +++ b/database/migrations/2023_01_05_043106_create_jobs_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('jobs', function (Blueprint $table) { $table->bigIncrements('id'); @@ -29,7 +29,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('jobs'); } diff --git a/database/migrations/2023_01_05_112154_create_user_codes_table.php b/database/migrations/2023_01_05_112154_create_user_codes_table.php index 1d98f9c..d130b2f 100644 --- a/database/migrations/2023_01_05_112154_create_user_codes_table.php +++ b/database/migrations/2023_01_05_112154_create_user_codes_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('user_codes', function (Blueprint $table) { $table->id(); @@ -30,7 +30,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('user_codes'); } diff --git a/database/migrations/2023_01_08_045958_create_audits_table.php b/database/migrations/2023_01_08_045958_create_audits_table.php index 597a958..e363a3c 100644 --- a/database/migrations/2023_01_08_045958_create_audits_table.php +++ b/database/migrations/2023_01_08_045958_create_audits_table.php @@ -12,7 +12,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::connection(config('audit.drivers.database.connection', config('database.default')))->create('audits', function (Blueprint $table) { @@ -40,7 +40,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::connection(config('audit.drivers.database.connection', config('database.default')))->drop('audits'); } diff --git a/database/migrations/2023_01_08_050847_create_user_logins_table.php b/database/migrations/2023_01_08_050847_create_user_logins_table.php index b2200df..e97f025 100644 --- a/database/migrations/2023_01_08_050847_create_user_logins_table.php +++ b/database/migrations/2023_01_08_050847_create_user_logins_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('user_logins', function (Blueprint $table) { $table->uuid('id')->primary(); @@ -32,7 +32,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('user_logins'); } diff --git a/database/migrations/2023_01_24_080416_create_analytics_table.php b/database/migrations/2023_01_24_080416_create_analytics_table.php index 18db1cd..df4d332 100644 --- a/database/migrations/2023_01_24_080416_create_analytics_table.php +++ b/database/migrations/2023_01_24_080416_create_analytics_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('analytics', function (Blueprint $table) { $table->id(); @@ -28,7 +28,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('analytics'); } diff --git a/database/migrations/2023_02_24_023054_create_attachments_table.php b/database/migrations/2023_02_24_023054_create_attachments_table.php index dbf3f88..9bd6648 100644 --- a/database/migrations/2023_02_24_023054_create_attachments_table.php +++ b/database/migrations/2023_02_24_023054_create_attachments_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('attachments', function (Blueprint $table) { $table->id(); @@ -28,7 +28,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('attachments'); } diff --git a/database/migrations/2023_02_28_090609_add_price_to_events_table.php b/database/migrations/2023_02_28_090609_add_price_to_events_table.php index bee4565..31df4e7 100644 --- a/database/migrations/2023_02_28_090609_add_price_to_events_table.php +++ b/database/migrations/2023_02_28_090609_add_price_to_events_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('events', function (Blueprint $table) { $table->string('price')->default(""); @@ -23,7 +23,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('events', function (Blueprint $table) { $table->dropColumn('price'); diff --git a/database/migrations/2023_03_01_075334_add_ages_to_events_table.php b/database/migrations/2023_03_01_075334_add_ages_to_events_table.php index b3543fb..133a5dd 100644 --- a/database/migrations/2023_03_01_075334_add_ages_to_events_table.php +++ b/database/migrations/2023_03_01_075334_add_ages_to_events_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('events', function (Blueprint $table) { $table->string('ages')->default(""); @@ -23,7 +23,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('events', function (Blueprint $table) { $table->dropColumn('ages'); diff --git a/database/migrations/2023_04_05_222458_update_media_table.php b/database/migrations/2023_04_05_222458_update_media_table.php index 6df5d64..a836d2a 100644 --- a/database/migrations/2023_04_05_222458_update_media_table.php +++ b/database/migrations/2023_04_05_222458_update_media_table.php @@ -12,7 +12,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { DB::table('media')->whereNull('mime')->update(['mime' => '']); DB::table('media')->whereNull('permission')->update(['permission' => '']); @@ -40,7 +40,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('media', function (Blueprint $table) { $table->bigInteger('size')->change(); diff --git a/database/migrations/2023_04_18_111723_update_no_nullable_phone_on_users_table.php b/database/migrations/2023_04_18_111723_update_no_nullable_phone_on_users_table.php index 558c4f2..bd2c47c 100644 --- a/database/migrations/2023_04_18_111723_update_no_nullable_phone_on_users_table.php +++ b/database/migrations/2023_04_18_111723_update_no_nullable_phone_on_users_table.php @@ -12,7 +12,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { DB::table('users')->whereNull('phone')->update(['phone' => '']); @@ -26,7 +26,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('users', function (Blueprint $table) { $table->string('phone')->nullable(true)->change(); diff --git a/database/migrations/2023_04_18_113354_add_display_name_to_users_table.php b/database/migrations/2023_04_18_113354_add_display_name_to_users_table.php index 023c9b4..4fcb54d 100644 --- a/database/migrations/2023_04_18_113354_add_display_name_to_users_table.php +++ b/database/migrations/2023_04_18_113354_add_display_name_to_users_table.php @@ -12,7 +12,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('users', function (Blueprint $table) { $table->string('display_name')->default(""); @@ -31,7 +31,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('users', function (Blueprint $table) { $table->dropColumn('display_name'); diff --git a/database/migrations/2023_04_19_122711_drop_subscriptions_table.php b/database/migrations/2023_04_19_122711_drop_subscriptions_table.php index 61b90a2..118dcd6 100644 --- a/database/migrations/2023_04_19_122711_drop_subscriptions_table.php +++ b/database/migrations/2023_04_19_122711_drop_subscriptions_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::dropIfExists('subscriptions'); } @@ -21,7 +21,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::create('subscriptions', function (Blueprint $table) { $table->uuid('id')->primary(); diff --git a/database/migrations/2023_04_25_235615_update_posts_table.php b/database/migrations/2023_04_25_235615_update_posts_table.php index 228561d..7effe66 100644 --- a/database/migrations/2023_04_25_235615_update_posts_table.php +++ b/database/migrations/2023_04_25_235615_update_posts_table.php @@ -12,7 +12,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::rename('posts', 'articles'); @@ -25,7 +25,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::rename('articles', 'posts'); diff --git a/database/migrations/2023_05_01_045630_update_analytics_table.php b/database/migrations/2023_05_01_045630_update_analytics_table.php index 5ad2eee..d8a012d 100644 --- a/database/migrations/2023_05_01_045630_update_analytics_table.php +++ b/database/migrations/2023_05_01_045630_update_analytics_table.php @@ -12,7 +12,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('analytics', function (Blueprint $table) { $table->bigInteger('session')->nullable(false); @@ -100,7 +100,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('analytics', function (Blueprint $table) { $table->dropColumn('session'); diff --git a/database/migrations/2023_05_04_071954_remove_username_from_users_table.php b/database/migrations/2023_05_04_071954_remove_username_from_users_table.php index 05bde34..1381580 100644 --- a/database/migrations/2023_05_04_071954_remove_username_from_users_table.php +++ b/database/migrations/2023_05_04_071954_remove_username_from_users_table.php @@ -12,7 +12,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('users', function (Blueprint $table) { $table->dropColumn('username'); @@ -24,7 +24,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('users', function (Blueprint $table) { $table->string('username')->unique(); diff --git a/database/migrations/2023_05_06_080418_create_shortlinks_table.php b/database/migrations/2023_05_06_080418_create_shortlinks_table.php index 3220cb9..d101e1b 100644 --- a/database/migrations/2023_05_06_080418_create_shortlinks_table.php +++ b/database/migrations/2023_05_06_080418_create_shortlinks_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('shortlinks', function (Blueprint $table) { $table->id(); @@ -26,7 +26,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('shortlinks'); } diff --git a/database/migrations/2023_05_06_082705_add_counter_to_shortlinks_table.php b/database/migrations/2023_05_06_082705_add_counter_to_shortlinks_table.php index d0a2cd1..28f0f0f 100644 --- a/database/migrations/2023_05_06_082705_add_counter_to_shortlinks_table.php +++ b/database/migrations/2023_05_06_082705_add_counter_to_shortlinks_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('shortlinks', function (Blueprint $table) { $table->bigInteger('used')->default(0); @@ -23,7 +23,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('shortlinks', function (Blueprint $table) { // diff --git a/database/migrations/2023_05_08_021929_update_users_table.php b/database/migrations/2023_05_08_021929_update_users_table.php index 744ca60..f21cca7 100644 --- a/database/migrations/2023_05_08_021929_update_users_table.php +++ b/database/migrations/2023_05_08_021929_update_users_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('users', function (Blueprint $table) { $table->string('first_name')->default('')->change(); @@ -24,7 +24,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('users', function (Blueprint $table) { $table->string('first_name')->nullable(false)->change(); diff --git a/database/migrations/2023_05_09_003156_add_location_url_to_events.php b/database/migrations/2023_05_09_003156_add_location_url_to_events.php index b8c5289..af93923 100644 --- a/database/migrations/2023_05_09_003156_add_location_url_to_events.php +++ b/database/migrations/2023_05_09_003156_add_location_url_to_events.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('events', function (Blueprint $table) { $table->string('location_url')->default(''); @@ -23,7 +23,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('events', function (Blueprint $table) { $table->dropColumn('location_url'); diff --git a/database/migrations/2023_05_11_032859_add_private_to_attachments_table.php b/database/migrations/2023_05_11_032859_add_private_to_attachments_table.php index f150b3e..aa24e77 100644 --- a/database/migrations/2023_05_11_032859_add_private_to_attachments_table.php +++ b/database/migrations/2023_05_11_032859_add_private_to_attachments_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::table('attachments', function (Blueprint $table) { $table->boolean('private')->default(false); @@ -23,7 +23,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::table('attachments', function (Blueprint $table) { $table->dropColumn('private'); diff --git a/database/migrations/2023_05_11_033621_create_event_users_table.php b/database/migrations/2023_05_11_033621_create_event_users_table.php index d1895ec..e4a4702 100644 --- a/database/migrations/2023_05_11_033621_create_event_users_table.php +++ b/database/migrations/2023_05_11_033621_create_event_users_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('event_users', function (Blueprint $table) { $table->id(); @@ -29,7 +29,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('event_users'); } diff --git a/database/migrations/2023_05_24_000000_rename_password_resets_table.php b/database/migrations/2023_05_24_000000_rename_password_resets_table.php index 7ea51ce..ab300e6 100644 --- a/database/migrations/2023_05_24_000000_rename_password_resets_table.php +++ b/database/migrations/2023_05_24_000000_rename_password_resets_table.php @@ -11,7 +11,7 @@ return new class extends Migration * * @return void */ - public function up() + public function up(): void { Schema::rename('password_resets', 'password_reset_tokens'); } @@ -21,7 +21,7 @@ return new class extends Migration * * @return void */ - public function down() + public function down(): void { Schema::rename('password_reset_tokens', 'password_resets'); } diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 1080a0f..230545b 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -15,7 +15,7 @@ class DatabaseSeeder extends Seeder * * @return void */ - public function run() + public function run(): void { \App\Models\User::factory(40)->create(); diff --git a/tests/Feature/ArticlesApiTest.php b/tests/Feature/ArticlesApiTest.php index 938da9a..b0925d2 100644 --- a/tests/Feature/ArticlesApiTest.php +++ b/tests/Feature/ArticlesApiTest.php @@ -20,7 +20,7 @@ class ArticlesApiTest extends TestCase $this->faker = FakerFactory::create(); } - public function testAnyUserCanViewArticle() + public function testAnyUserCanViewArticle(): void { // Create an event $article = Article::factory()->create([ @@ -51,7 +51,7 @@ class ArticlesApiTest extends TestCase ]); } - public function testAdminCanCreateUpdateDeleteArticle() + public function testAdminCanCreateUpdateDeleteArticle(): void { // Create a user with the admin/events permission $adminUser = User::factory()->create(); @@ -102,7 +102,7 @@ class ArticlesApiTest extends TestCase ]); } - public function testNonAdminCannotCreateUpdateDeleteArticle() + public function testNonAdminCannotCreateUpdateDeleteArticle(): void { // Create a user without admin/events permission $user = User::factory()->create(); diff --git a/tests/Feature/AuthApiTest.php b/tests/Feature/AuthApiTest.php index c35a1a4..4df3c7f 100644 --- a/tests/Feature/AuthApiTest.php +++ b/tests/Feature/AuthApiTest.php @@ -9,7 +9,7 @@ class AuthApiTest extends TestCase use RefreshDatabase; - public function testLogin() + public function testLogin(): void { $user = User::factory()->create([ 'password' => bcrypt('password'), diff --git a/tests/Feature/ContactFormTest.php b/tests/Feature/ContactFormTest.php index 3bb7f94..72e8464 100644 --- a/tests/Feature/ContactFormTest.php +++ b/tests/Feature/ContactFormTest.php @@ -8,7 +8,7 @@ class ContactFormTest extends TestCase use RefreshDatabase; - public function testContactForm() + public function testContactForm(): void { $formData = [ 'name' => 'John Doe', diff --git a/tests/Feature/EventsApiTest.php b/tests/Feature/EventsApiTest.php index 4fb2e21..6c80c54 100644 --- a/tests/Feature/EventsApiTest.php +++ b/tests/Feature/EventsApiTest.php @@ -21,7 +21,7 @@ class EventsApiTest extends TestCase $this->faker = FakerFactory::create(); } - public function testAnyUserCanViewEvent() + public function testAnyUserCanViewEvent(): void { // Create an event $event = Event::factory()->create([ @@ -52,7 +52,7 @@ class EventsApiTest extends TestCase ]); } - public function testAnyUserCannotSeeDraftEvent() + public function testAnyUserCannotSeeDraftEvent(): void { // Create a draft event $draftEvent = Event::factory()->create([ @@ -85,7 +85,7 @@ class EventsApiTest extends TestCase ]); } - public function testAdminCanCreateUpdateDeleteEvent() + public function testAdminCanCreateUpdateDeleteEvent(): void { // Create a user with the admin/events permission $adminUser = User::factory()->create(); @@ -139,7 +139,7 @@ class EventsApiTest extends TestCase ]); } - public function testNonAdminCannotCreateUpdateDeleteEvent() + public function testNonAdminCannotCreateUpdateDeleteEvent(): void { // Create a user without admin/events permission $user = User::factory()->create(); diff --git a/tests/Feature/UsersApiTest.php b/tests/Feature/UsersApiTest.php index 5633e90..0d7b2c1 100644 --- a/tests/Feature/UsersApiTest.php +++ b/tests/Feature/UsersApiTest.php @@ -10,7 +10,7 @@ class UsersApiTest extends TestCase use RefreshDatabase; - public function testNonAdminUsersCanOnlyViewBasicUserInfo() + public function testNonAdminUsersCanOnlyViewBasicUserInfo(): void { // create a non-admin user $nonAdminUser = User::factory()->create(); @@ -71,7 +71,7 @@ class UsersApiTest extends TestCase ]); } - public function testGuestCannotCreateUser() + public function testGuestCannotCreateUser(): void { $userData = [ 'email' => 'johndoe@example.com', @@ -85,7 +85,7 @@ class UsersApiTest extends TestCase ]); } - public function testGuestCanRegisterUser() + public function testGuestCanRegisterUser(): void { $userData = [ 'first_name' => 'John', @@ -102,7 +102,7 @@ class UsersApiTest extends TestCase ]); } - public function testCannotCreateDuplicateEmailOrDisplayName() + public function testCannotCreateDuplicateEmailOrDisplayName(): void { $userData = [ 'display_name' => 'JackDoe', @@ -125,7 +125,7 @@ class UsersApiTest extends TestCase $response->assertJsonValidationErrors(['display_name', 'email']); } - public function testUserCanOnlyUpdateOwnUser() + public function testUserCanOnlyUpdateOwnUser(): void { $user = User::factory()->create(); @@ -153,7 +153,7 @@ class UsersApiTest extends TestCase $response->assertStatus(403); } - public function testUserCannotDeleteUsers() + public function testUserCannotDeleteUsers(): void { $user = User::factory()->create(); @@ -169,7 +169,7 @@ class UsersApiTest extends TestCase $this->assertDatabaseHas('users', ['id' => $otherUser->id]); } - public function testAdminCanUpdateAnyUser() + public function testAdminCanUpdateAnyUser(): void { $admin = User::factory()->create(); $admin->givePermission('admin/users'); @@ -204,7 +204,7 @@ class UsersApiTest extends TestCase ]); } - public function testAdminCanDeleteAnyUser() + public function testAdminCanDeleteAnyUser(): void { $admin = User::factory()->create(); $admin->givePermission('admin/users'); diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index e5c5fef..d809638 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -11,7 +11,7 @@ class ExampleTest extends TestCase * * @return void */ - public function test_that_true_is_true() + public function test_that_true_is_true(): void { $this->assertTrue(true); } -- 2.49.1 From 4d7d0ed74d9864d9f0bd7e7158f7d171604005ef Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:33:16 +0000 Subject: [PATCH 14/16] Add type hints from DocBlocks --- app/Conductors/AnalyticsConductor.php | 8 +-- app/Conductors/ArticleConductor.php | 14 +++--- app/Conductors/Conductor.php | 46 ++++++++--------- app/Conductors/EventConductor.php | 12 ++--- app/Conductors/MediaConductor.php | 14 +++--- app/Conductors/ShortlinkConductor.php | 6 +-- app/Conductors/SubscriptionConductor.php | 4 +- app/Conductors/UserConductor.php | 8 +-- app/Console/Commands/MediaMigrate.php | 2 +- app/Console/Commands/MediaRebuild.php | 2 +- app/Http/Controllers/Api/ApiController.php | 21 ++++---- .../Controllers/Api/ArticleController.php | 8 +-- app/Http/Controllers/Api/AuthController.php | 4 +- app/Http/Controllers/Api/EventController.php | 8 +-- app/Http/Controllers/Api/UserController.php | 6 +-- app/Http/Requests/AnalyticsRequest.php | 4 +- app/Http/Requests/ArticleRequest.php | 4 +- app/Http/Requests/BaseRequest.php | 2 +- app/Http/Requests/EventRequest.php | 4 +- app/Http/Requests/ShortlinkRequest.php | 4 +- app/Http/Requests/SubscriptionRequest.php | 4 +- app/Http/Requests/UserRequest.php | 4 +- app/Mail/ChangeEmailVerify.php | 4 +- app/Mail/ChangedEmail.php | 4 +- app/Mail/ChangedPassword.php | 4 +- app/Mail/Contact.php | 4 +- app/Mail/EmailVerify.php | 4 +- app/Mail/ForgotPassword.php | 4 +- app/Mail/SubscriptionConfirm.php | 4 +- app/Mail/SubscriptionUnsubscribed.php | 4 +- app/Models/Analytics.php | 2 +- app/Models/Article.php | 4 +- app/Models/Attachment.php | 4 +- app/Models/Event.php | 4 +- app/Models/EventUsers.php | 4 +- app/Models/Media.php | 38 +++++++------- app/Models/Permission.php | 2 +- app/Models/User.php | 20 ++++---- app/Models/UserCode.php | 8 +-- app/Models/UserLogins.php | 2 +- app/Rules/Recaptcha.php | 4 +- app/Rules/UniqueFileName.php | 4 +- app/Rules/Uniqueish.php | 6 +-- app/Services/AnimatedGifService.php | 50 +++++++++---------- app/Traits/Uuids.php | 6 +-- database/factories/UserFactory.php | 2 +- 46 files changed, 191 insertions(+), 190 deletions(-) diff --git a/app/Conductors/AnalyticsConductor.php b/app/Conductors/AnalyticsConductor.php index 7fecbc3..19ed4d6 100644 --- a/app/Conductors/AnalyticsConductor.php +++ b/app/Conductors/AnalyticsConductor.php @@ -41,7 +41,7 @@ class AnalyticsConductor extends Conductor * @param Model $model The model. * @return boolean Allow model to be visible. */ - public static function viewable(Model $model) + public static function viewable(Model $model): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/analytics') === true); @@ -52,7 +52,7 @@ class AnalyticsConductor extends Conductor * * @return boolean Allow creating model. */ - public static function creatable() + public static function creatable(): bool { return true; } @@ -63,7 +63,7 @@ class AnalyticsConductor extends Conductor * @param Model $model The model. * @return boolean Allow updating model. */ - public static function updatable(Model $model) + public static function updatable(Model $model): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/analytics') === true); @@ -75,7 +75,7 @@ class AnalyticsConductor extends Conductor * @param Model $model The model. * @return boolean Allow deleting model. */ - public static function destroyable(Model $model) + public static function destroyable(Model $model): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/analytics') === true); diff --git a/app/Conductors/ArticleConductor.php b/app/Conductors/ArticleConductor.php index a99d54a..217786c 100644 --- a/app/Conductors/ArticleConductor.php +++ b/app/Conductors/ArticleConductor.php @@ -41,7 +41,7 @@ class ArticleConductor extends Conductor * @param Builder $builder The builder in use. * @return void */ - public function scope(Builder $builder) + public function scope(Builder $builder): void { $user = auth()->user(); if ($user === null || $user->hasPermission('admin/articles') === false) { @@ -56,7 +56,7 @@ class ArticleConductor extends Conductor * @param Model $model The model. * @return boolean Allow model to be visible. */ - public static function viewable(Model $model) + public static function viewable(Model $model): bool { if (Carbon::parse($model->publish_at)->isFuture() === true) { $user = auth()->user(); @@ -73,7 +73,7 @@ class ArticleConductor extends Conductor * * @return boolean Allow creating model. */ - public static function creatable() + public static function creatable(): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/articles') === true); @@ -85,7 +85,7 @@ class ArticleConductor extends Conductor * @param Model $model The model. * @return boolean Allow updating model. */ - public static function updatable(Model $model) + public static function updatable(Model $model): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/articles') === true); @@ -97,7 +97,7 @@ class ArticleConductor extends Conductor * @param Model $model The model. * @return boolean Allow deleting model. */ - public static function destroyable(Model $model) + public static function destroyable(Model $model): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/articles') === true); @@ -109,7 +109,7 @@ class ArticleConductor extends Conductor * @param array $data The model data to transform. * @return array The transformed model. */ - public function transformFinal(array $data) + public function transformFinal(array $data): array { unset($data['user_id']); return $data; @@ -145,7 +145,7 @@ class ArticleConductor extends Conductor * @param mixed $value The current value. * @return array The new value. */ - public function transformHero(mixed $value) + public function transformHero(mixed $value): array { return MediaConductor::includeModel(request(), 'hero', Media::find($value)); } diff --git a/app/Conductors/Conductor.php b/app/Conductors/Conductor.php index 02fb11e..cf46d61 100644 --- a/app/Conductors/Conductor.php +++ b/app/Conductors/Conductor.php @@ -81,7 +81,7 @@ class Conductor * @param string $string The string to split. * @return array The split string. */ - private function splitString(string $string) + private function splitString(string $string): array { $parts = []; $start = 0; @@ -145,7 +145,7 @@ class Conductor * @param array|null $limitFields A list of fields to limit the filter request to. * @return void */ - private function filter(Request $request, array|null $limitFields = null) + private function filter(Request $request, array|null $limitFields = null): void { if (is_array($limitFields) === true && count($limitFields) === 0) { $limitFields = null; @@ -213,7 +213,7 @@ class Conductor * * @return void */ - final public function applyFilters() + final public function applyFilters(): void { $parseFunc = function ($filterArray, $query) use (&$parseFunc) { $item = null; @@ -365,7 +365,7 @@ class Conductor * @param Request $request The request data. * @return array The processed and transformed collection | the total rows found. */ - final public static function request(Request $request) + final public static function request(Request $request): array { $conductor_class = get_called_class(); $conductor = new $conductor_class(); @@ -457,7 +457,7 @@ class Conductor * @param Collection $collection The collection. * @return array The processed and transformed model data. */ - final public static function collection(Request $request, Collection $collection) + final public static function collection(Request $request, Collection $collection): array { $conductor_class = get_called_class(); $conductor = new $conductor_class(); @@ -505,7 +505,7 @@ class Conductor * @param array|null $limitFields Limit the request to these fields. * @return Builder */ - public static function filterQuery(Builder $query, Request $request, array|null $limitFields = null) + public static function filterQuery(Builder $query, Request $request, array|null $limitFields = null): Builder { $conductor_class = get_called_class(); $conductor = new $conductor_class(); @@ -525,7 +525,7 @@ class Conductor * @param Model|null $model The model. * @return array The processed and transformed model data. */ - final public static function includeModel(Request $request, string $key, mixed $model) + final public static function includeModel(Request $request, string $key, mixed $model): array { $fields = []; @@ -553,7 +553,7 @@ class Conductor * @param Model|null $model The model. * @return array The processed and transformed model data. */ - final public static function model(mixed $fields, mixed $model) + final public static function model(mixed $fields, mixed $model): array { if ($model === null) { return null; @@ -606,7 +606,7 @@ class Conductor * * @return integer The current collection count. */ - final public function count() + final public function count(): int { if ($this->query !== null) { return $this->query->count(); @@ -621,7 +621,7 @@ class Conductor * @param mixed $fields A field name or array of field names to sort. Supports prefix of +/- to change direction. * @return void */ - final public function sort(mixed $fields = null) + final public function sort(mixed $fields = null): void { $collectionSort = []; @@ -700,7 +700,7 @@ class Conductor * @param array $includes The list of includes to include. * @return void */ - final public function applyIncludes(Model $model, array $includes) + final public function applyIncludes(Model $model, array $includes): void { foreach ($includes as $include) { $includeMethodName = 'include' . Str::studly($include); @@ -720,7 +720,7 @@ class Conductor * @param array $fields An array of field names. * @return void */ - final public function limitFields(array $fields) + final public function limitFields(array $fields): void { if (empty($fields) !== true) { $this->query->select(array_diff($fields, $this->includes)); @@ -735,7 +735,7 @@ class Conductor * @param string $outerJoin The join for this filter group. * @return void */ - final public function appendFilterString(string $rawFilter, array|null $limitFields = null, string $outerJoin = 'OR') + final public function appendFilterString(string $rawFilter, array|null $limitFields = null, string $outerJoin = 'OR'): void { if ($rawFilter === '') { return; @@ -849,7 +849,7 @@ class Conductor * @param string $join The join to append. * @return void */ - final public function appendFilter(string $field, string $operator, string $value, string $join = 'OR') + final public function appendFilter(string $field, string $operator, string $value, string $join = 'OR'): void { if (count($this->filterArray) !== 0) { $this->filterArray[] = $join; @@ -863,7 +863,7 @@ class Conductor * @param Builder $builder The builder in use. * @return void */ - public function scope(Builder $builder) + public function scope(Builder $builder): void { } @@ -873,7 +873,7 @@ class Conductor * @param Model $model The model in question. * @return array The array of field names. */ - public function fields(Model $model) + public function fields(Model $model): array { $visibleFields = $model->getVisible(); if (empty($visibleFields) === true) { @@ -900,7 +900,7 @@ class Conductor * @param Model $model The model to transform. * @return array The transformed model. */ - protected function transformModel(Model $model) + protected function transformModel(Model $model): array { $result = $this->transform($model); foreach ($result as $key => $value) { @@ -920,7 +920,7 @@ class Conductor * @param Model $model The model to transform. * @return array The transformed model. */ - public function transform(Model $model) + public function transform(Model $model): array { $result = $model->toArray(); @@ -939,7 +939,7 @@ class Conductor * @param array $data The model array to transform. * @return array The transformed model. */ - public function transformFinal(array $data) + public function transformFinal(array $data): array { return $data; } @@ -950,7 +950,7 @@ class Conductor * @param Model $model The model in question. * @return boolean Is the model viewable. */ - public static function viewable(Model $model) + public static function viewable(Model $model): bool { return true; } @@ -960,7 +960,7 @@ class Conductor * * @return boolean Is the model creatable. */ - public static function creatable() + public static function creatable(): bool { return true; } @@ -971,7 +971,7 @@ class Conductor * @param Model $model The model in question. * @return boolean Is the model updatable. */ - public static function updatable(Model $model) + public static function updatable(Model $model): bool { return true; } @@ -982,7 +982,7 @@ class Conductor * @param Model $model The model in question. * @return boolean Is the model destroyable. */ - public static function destroyable(Model $model) + public static function destroyable(Model $model): bool { return true; } diff --git a/app/Conductors/EventConductor.php b/app/Conductors/EventConductor.php index d20e82c..8c1ceaa 100644 --- a/app/Conductors/EventConductor.php +++ b/app/Conductors/EventConductor.php @@ -35,7 +35,7 @@ class EventConductor extends Conductor * @param Builder $builder The builder in use. * @return void */ - public function scope(Builder $builder) + public function scope(Builder $builder): void { $user = auth()->user(); if ($user === null || $user->hasPermission('admin/events') === false) { @@ -51,7 +51,7 @@ class EventConductor extends Conductor * @param Model $model The model. * @return boolean Allow model to be visible. */ - public static function viewable(Model $model) + public static function viewable(Model $model): bool { if (strtolower($model->status) === 'draft' || Carbon::parse($model->publish_at)->isFuture() === true) { $user = auth()->user(); @@ -68,7 +68,7 @@ class EventConductor extends Conductor * * @return boolean Allow creating model. */ - public static function creatable() + public static function creatable(): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/events') === true); @@ -80,7 +80,7 @@ class EventConductor extends Conductor * @param Model $model The model. * @return boolean Allow updating model. */ - public static function updatable(Model $model) + public static function updatable(Model $model): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/events') === true); @@ -92,7 +92,7 @@ class EventConductor extends Conductor * @param Model $model The model. * @return boolean Allow deleting model. */ - public static function destroyable(Model $model) + public static function destroyable(Model $model): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/events') === true); @@ -121,7 +121,7 @@ class EventConductor extends Conductor * @param mixed $value The current value. * @return array The new value. */ - public function transformHero(mixed $value) + public function transformHero(mixed $value): array { return MediaConductor::includeModel(request(), 'hero', Media::find($value)); } diff --git a/app/Conductors/MediaConductor.php b/app/Conductors/MediaConductor.php index 0b29d06..15d48cb 100644 --- a/app/Conductors/MediaConductor.php +++ b/app/Conductors/MediaConductor.php @@ -43,7 +43,7 @@ class MediaConductor extends Conductor * @param Model $model The model in question. * @return array The array of field names. */ - public function fields(Model $model) + public function fields(Model $model): array { $fields = parent::fields($model); @@ -61,7 +61,7 @@ class MediaConductor extends Conductor * @param Builder $builder The builder in use. * @return void */ - public function scope(Builder $builder) + public function scope(Builder $builder): void { $user = auth()->user(); if ($user === null) { @@ -77,7 +77,7 @@ class MediaConductor extends Conductor * @param Model $model The model. * @return boolean Allow model to be visible. */ - public static function viewable(Model $model) + public static function viewable(Model $model): bool { if ($model->permission !== '') { $user = auth()->user(); @@ -94,7 +94,7 @@ class MediaConductor extends Conductor * * @return boolean Allow creating model. */ - public static function creatable() + public static function creatable(): bool { $user = auth()->user(); return ($user !== null); @@ -106,7 +106,7 @@ class MediaConductor extends Conductor * @param Model $model The model. * @return boolean Allow updating model. */ - public static function updatable(Model $model) + public static function updatable(Model $model): bool { $user = auth()->user(); return ($user !== null && (strcasecmp($model->user_id, $user->id) === 0 || $user->hasPermission('admin/media') === true)); @@ -118,7 +118,7 @@ class MediaConductor extends Conductor * @param Model $model The model. * @return boolean Allow deleting model. */ - public static function destroyable(Model $model) + public static function destroyable(Model $model): bool { $user = auth()->user(); return ($user !== null && ($model->user_id === $user->id || $user->hasPermission('admin/media') === true)); @@ -130,7 +130,7 @@ class MediaConductor extends Conductor * @param array $data The model data to transform. * @return array The transformed model. */ - public function transformFinal(array $data) + public function transformFinal(array $data): array { unset($data['user_id']); return $data; diff --git a/app/Conductors/ShortlinkConductor.php b/app/Conductors/ShortlinkConductor.php index 578d81f..457bdde 100644 --- a/app/Conductors/ShortlinkConductor.php +++ b/app/Conductors/ShortlinkConductor.php @@ -26,7 +26,7 @@ class ShortlinkConductor extends Conductor * * @return boolean Allow creating model. */ - public static function creatable() + public static function creatable(): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/shortlinks') === true); @@ -38,7 +38,7 @@ class ShortlinkConductor extends Conductor * @param Model $model The model. * @return boolean Allow updating model. */ - public static function updatable(Model $model) + public static function updatable(Model $model): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/shortlinks') === true); @@ -50,7 +50,7 @@ class ShortlinkConductor extends Conductor * @param Model $model The model. * @return boolean Allow deleting model. */ - public static function destroyable(Model $model) + public static function destroyable(Model $model): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/shortlinks') === true); diff --git a/app/Conductors/SubscriptionConductor.php b/app/Conductors/SubscriptionConductor.php index 54a0c95..fe4e35c 100644 --- a/app/Conductors/SubscriptionConductor.php +++ b/app/Conductors/SubscriptionConductor.php @@ -19,7 +19,7 @@ class SubscriptionConductor extends Conductor * @param Model $model The model. * @return boolean Allow updating model. */ - public static function updatable(Model $model) + public static function updatable(Model $model): bool { $user = auth()->user(); return ($user !== null && ((strcasecmp($model->email, $user->email) === 0 && $user->email_verified_at !== null) || $user->hasPermission('admin/subscriptions') === true)); @@ -31,7 +31,7 @@ class SubscriptionConductor extends Conductor * @param Model $model The model. * @return boolean Allow deleting model. */ - public static function destroyable(Model $model) + public static function destroyable(Model $model): bool { $user = auth()->user(); return ($user !== null && ((strcasecmp($model->email, $user->email) === 0 && $user->email_verified_at !== null) || $user->hasPermission('admin/subscriptions') === true)); diff --git a/app/Conductors/UserConductor.php b/app/Conductors/UserConductor.php index 2881993..a756a48 100644 --- a/app/Conductors/UserConductor.php +++ b/app/Conductors/UserConductor.php @@ -19,7 +19,7 @@ class UserConductor extends Conductor * @param Model $model The model. * @return string[] The fields visible. */ - public function fields(Model $model) + public function fields(Model $model): array { $user = auth()->user(); if ($user === null || $user->hasPermission('admin/users') === false) { @@ -35,7 +35,7 @@ class UserConductor extends Conductor * @param Model $model The model to transform. * @return array The transformed model. */ - public function transform(Model $model) + public function transform(Model $model): array { $user = auth()->user(); $data = $model->toArray(); @@ -56,7 +56,7 @@ class UserConductor extends Conductor * @param Model $model The model. * @return boolean Allow updating model. */ - public static function updatable(Model $model) + public static function updatable(Model $model): bool { $user = auth()->user(); if ($user !== null) { @@ -72,7 +72,7 @@ class UserConductor extends Conductor * @param Model $model The model. * @return boolean Allow deleting model. */ - public static function destroyable(Model $model) + public static function destroyable(Model $model): bool { $user = auth()->user(); return ($user !== null && $user->hasPermission('admin/users') === true); diff --git a/app/Console/Commands/MediaMigrate.php b/app/Console/Commands/MediaMigrate.php index 3e8abe2..32156e6 100644 --- a/app/Console/Commands/MediaMigrate.php +++ b/app/Console/Commands/MediaMigrate.php @@ -30,7 +30,7 @@ class MediaMigrate extends Command * * @return void */ - protected function configure() + protected function configure(): void { $this->addOption( 'replace', diff --git a/app/Console/Commands/MediaRebuild.php b/app/Console/Commands/MediaRebuild.php index fdc0d8a..f37a755 100644 --- a/app/Console/Commands/MediaRebuild.php +++ b/app/Console/Commands/MediaRebuild.php @@ -29,7 +29,7 @@ class MediaRebuild extends Command * * @return void */ - protected function configure() + protected function configure(): void { $this->addOption( 'replace', diff --git a/app/Http/Controllers/Api/ApiController.php b/app/Http/Controllers/Api/ApiController.php index f34909b..307864c 100644 --- a/app/Http/Controllers/Api/ApiController.php +++ b/app/Http/Controllers/Api/ApiController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Api; +use Illuminate\Http\JsonResponse; use App\Enum\HttpResponseCodes; use App\Http\Controllers\Controller; use Illuminate\Database\Eloquent\Model; @@ -25,7 +26,7 @@ class ApiController extends Controller * @param array $headers Response headers. * @return \Illuminate\Http\JsonResponse */ - public function respondJson(array $data, int $respondCode = HttpResponseCodes::HTTP_OK, array $headers = []) + public function respondJson(array $data, int $respondCode = HttpResponseCodes::HTTP_OK, array $headers = []): JsonResponse { return response()->json($data, $respondCode, $headers); } @@ -36,7 +37,7 @@ class ApiController extends Controller * @param string $message Response message. * @return \Illuminate\Http\JsonResponse */ - public function respondForbidden(string $message = 'You do not have permission to access the resource.') + public function respondForbidden(string $message = 'You do not have permission to access the resource.'): JsonResponse { return response()->json(['message' => $message], HttpResponseCodes::HTTP_FORBIDDEN); } @@ -47,7 +48,7 @@ class ApiController extends Controller * @param string $message Response message. * @return \Illuminate\Http\JsonResponse */ - public function respondNotFound(string $message = 'The resource was not found.') + public function respondNotFound(string $message = 'The resource was not found.'): JsonResponse { return response()->json(['message' => $message], HttpResponseCodes::HTTP_NOT_FOUND); } @@ -58,7 +59,7 @@ class ApiController extends Controller * @param string $message Response message. * @return \Illuminate\Http\JsonResponse */ - public function respondTooLarge(string $message = 'The request entity is too large.') + public function respondTooLarge(string $message = 'The request entity is too large.'): JsonResponse { return response()->json(['message' => $message], HttpResponseCodes::HTTP_REQUEST_ENTITY_TOO_LARGE); } @@ -67,7 +68,7 @@ class ApiController extends Controller * Return no content * @return \Illuminate\Http\JsonResponse */ - public function respondNoContent() + public function respondNoContent(): JsonResponse { return response()->json([], HttpResponseCodes::HTTP_NO_CONTENT); } @@ -76,7 +77,7 @@ class ApiController extends Controller * Return created * @return \Illuminate\Http\JsonResponse */ - public function respondCreated() + public function respondCreated(): JsonResponse { return response()->json([], HttpResponseCodes::HTTP_CREATED); } @@ -85,7 +86,7 @@ class ApiController extends Controller * Return accepted * @return \Illuminate\Http\JsonResponse */ - public function respondAccepted() + public function respondAccepted(): JsonResponse { return response()->json([], HttpResponseCodes::HTTP_ACCEPTED); } @@ -97,7 +98,7 @@ class ApiController extends Controller * @param integer $responseCode Resource code. * @return \Illuminate\Http\JsonResponse */ - public function respondError(string $message, int $responseCode = HttpResponseCodes::HTTP_UNPROCESSABLE_ENTITY) + public function respondError(string $message, int $responseCode = HttpResponseCodes::HTTP_UNPROCESSABLE_ENTITY): JsonResponse { return response()->json([ 'message' => $message @@ -111,7 +112,7 @@ class ApiController extends Controller * @param integer $responseCode Resource code. * @return \Illuminate\Http\JsonResponse */ - public function respondWithErrors(array $errors, int $responseCode = HttpResponseCodes::HTTP_UNPROCESSABLE_ENTITY) + public function respondWithErrors(array $errors, int $responseCode = HttpResponseCodes::HTTP_UNPROCESSABLE_ENTITY): JsonResponse { $keys = array_keys($errors); $error = $errors[$keys[0]]; @@ -138,7 +139,7 @@ class ApiController extends Controller mixed $data, array $options = [], $validationFn = null - ) { + ): JsonResponse { $isCollection = $options['isCollection'] ?? false; $appendData = $options['appendData'] ?? null; $resourceName = $options['resourceName'] ?? null; diff --git a/app/Http/Controllers/Api/ArticleController.php b/app/Http/Controllers/Api/ArticleController.php index 5562936..b93c5a6 100644 --- a/app/Http/Controllers/Api/ArticleController.php +++ b/app/Http/Controllers/Api/ArticleController.php @@ -126,7 +126,7 @@ class ArticleController extends ApiController * @throws BindingResolutionException * @throws InvalidCastException */ - public function getAttachments(Request $request, Article $article) + public function getAttachments(Request $request, Article $article): JsonResponse { if (ArticleConductor::viewable($article) === true) { $medium = $article->attachments->map(function ($attachment) { @@ -148,7 +148,7 @@ class ArticleController extends ApiController * @throws BindingResolutionException * @throws MassAssignmentException */ - public function storeAttachment(Request $request, Article $article) + public function storeAttachment(Request $request, Article $article): JsonResponse { if (ArticleConductor::updatable($article) === true) { if ($request->has("medium") && Media::find($request->medium)) { @@ -171,7 +171,7 @@ class ArticleController extends ApiController * @throws BindingResolutionException * @throws MassAssignmentException */ - public function updateAttachments(Request $request, Article $article) + public function updateAttachments(Request $request, Article $article): JsonResponse { if (ArticleConductor::updatable($article) === true) { $mediaIds = $request->attachments; @@ -219,7 +219,7 @@ class ArticleController extends ApiController * @return JsonResponse * @throws BindingResolutionException */ - public function deleteAttachment(Request $request, Article $article, Media $medium) + public function deleteAttachment(Request $request, Article $article, Media $medium): JsonResponse { if (ArticleConductor::updatable($article) === true) { $attachments = $article->attachments; diff --git a/app/Http/Controllers/Api/AuthController.php b/app/Http/Controllers/Api/AuthController.php index f14a647..e6c60ab 100644 --- a/app/Http/Controllers/Api/AuthController.php +++ b/app/Http/Controllers/Api/AuthController.php @@ -33,7 +33,7 @@ class AuthController extends ApiController * @param Request $request Current request data. * @return JsonResponse */ - public function me(Request $request) + public function me(Request $request): JsonResponse { $user = $request->user()->makeVisible(['permissions']); return $this->respondAsResource($user); @@ -89,7 +89,7 @@ class AuthController extends ApiController * @param Request $request Current request data. * @return JsonResponse */ - public function logout(Request $request) + public function logout(Request $request): JsonResponse { $user = $request->user(); diff --git a/app/Http/Controllers/Api/EventController.php b/app/Http/Controllers/Api/EventController.php index 52be0b2..523b63c 100644 --- a/app/Http/Controllers/Api/EventController.php +++ b/app/Http/Controllers/Api/EventController.php @@ -116,7 +116,7 @@ class EventController extends ApiController * @param Event $event The event model. * @return JsonResponse Returns the event attachments. */ - public function getAttachments(Request $request, Event $event) + public function getAttachments(Request $request, Event $event): JsonResponse { if (EventConductor::viewable($event) === true) { $medium = $event->attachments->map(function ($attachment) { @@ -136,7 +136,7 @@ class EventController extends ApiController * @param Event $event The event model. * @return JsonResponse The response. */ - public function storeAttachment(Request $request, Event $event) + public function storeAttachment(Request $request, Event $event): JsonResponse { if (EventConductor::updatable($event) === true) { if ($request->has("medium") === true && Media::find($request->medium) !== null) { @@ -157,7 +157,7 @@ class EventController extends ApiController * @param Event $event The related model. * @return JsonResponse */ - public function updateAttachments(Request $request, Event $event) + public function updateAttachments(Request $request, Event $event): JsonResponse { if (EventConductor::updatable($event) === true) { $mediaIds = $request->attachments; @@ -205,7 +205,7 @@ class EventController extends ApiController * @param Media $medium The attachment medium. * @return JsonResponse */ - public function deleteAttachment(Request $request, Event $event, Media $medium) + public function deleteAttachment(Request $request, Event $event, Media $medium): JsonResponse { if (EventConductor::updatable($event) === true) { $attachments = $event->attachments; diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index 4b30169..e46a079 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -147,7 +147,7 @@ class UserController extends ApiController * @param \App\Http\Requests\UserRegisterRequest $request The register user request. * @return \Illuminate\Http\Response */ - public function register(UserRegisterRequest $request) + public function register(UserRegisterRequest $request): JsonResponse { try { $userData = $request->only([ @@ -288,7 +288,7 @@ class UserController extends ApiController * @param \App\Http\Requests\UserResendVerifyEmailRequest $request The resend verify email request. * @return \Illuminate\Http\Response */ - public function resendVerifyEmail(UserResendVerifyEmailRequest $request) + public function resendVerifyEmail(UserResendVerifyEmailRequest $request): JsonResponse { UserCode::clearExpired(); @@ -342,7 +342,7 @@ class UserController extends ApiController * @param User $user The specified user. * @return JsonResponse */ - public function eventList(Request $request, User $user) + public function eventList(Request $request, User $user): JsonResponse { if ($request->user() !== null && ($request->user() === $user || $request->user()->hasPermission('admin/events') === true)) { $collection = $user->events; diff --git a/app/Http/Requests/AnalyticsRequest.php b/app/Http/Requests/AnalyticsRequest.php index bc90a99..25ee6eb 100644 --- a/app/Http/Requests/AnalyticsRequest.php +++ b/app/Http/Requests/AnalyticsRequest.php @@ -11,7 +11,7 @@ class AnalyticsRequest extends BaseRequest * * @return array */ - public function postRules() + public function postRules(): array { return [ 'type' => 'required|string', @@ -23,7 +23,7 @@ class AnalyticsRequest extends BaseRequest * * @return array */ - public function putRules() + public function putRules(): array { return [ 'type' => 'string', diff --git a/app/Http/Requests/ArticleRequest.php b/app/Http/Requests/ArticleRequest.php index fb2ac4b..2ad76d7 100644 --- a/app/Http/Requests/ArticleRequest.php +++ b/app/Http/Requests/ArticleRequest.php @@ -11,7 +11,7 @@ class ArticleRequest extends BaseRequest * * @return array */ - public function postRules() + public function postRules(): array { return [ 'slug' => 'required|string|min:6|unique:articles', @@ -28,7 +28,7 @@ class ArticleRequest extends BaseRequest * * @return array */ - public function putRules() + public function putRules(): array { return [ 'slug' => [ diff --git a/app/Http/Requests/BaseRequest.php b/app/Http/Requests/BaseRequest.php index 3934a1b..30f5992 100644 --- a/app/Http/Requests/BaseRequest.php +++ b/app/Http/Requests/BaseRequest.php @@ -56,7 +56,7 @@ class BaseRequest extends FormRequest * @param array $collection2 The second collection of rules to merge. * @return array */ - private function mergeRules(array $collection1, array $collection2) + private function mergeRules(array $collection1, array $collection2): array { $rules = []; diff --git a/app/Http/Requests/EventRequest.php b/app/Http/Requests/EventRequest.php index f1bd1f1..5c152d1 100644 --- a/app/Http/Requests/EventRequest.php +++ b/app/Http/Requests/EventRequest.php @@ -11,7 +11,7 @@ class EventRequest extends BaseRequest * * @return array */ - public function baseRules() + public function baseRules(): array { return [ 'title' => 'min:6', @@ -42,7 +42,7 @@ class EventRequest extends BaseRequest * * @return array */ - protected function postRules() + protected function postRules(): array { return [ 'title' => 'required', diff --git a/app/Http/Requests/ShortlinkRequest.php b/app/Http/Requests/ShortlinkRequest.php index 6c62c68..2a3b67c 100644 --- a/app/Http/Requests/ShortlinkRequest.php +++ b/app/Http/Requests/ShortlinkRequest.php @@ -11,7 +11,7 @@ class ShortlinkRequest extends BaseRequest * * @return array */ - public function postRules() + public function postRules(): array { return [ 'code' => 'required|string|max:255|min:2|unique:shortlinks', @@ -24,7 +24,7 @@ class ShortlinkRequest extends BaseRequest * * @return array */ - public function putRules() + public function putRules(): array { $shortlink = $this->route('shortlink'); diff --git a/app/Http/Requests/SubscriptionRequest.php b/app/Http/Requests/SubscriptionRequest.php index 88a5a3d..7395fe8 100644 --- a/app/Http/Requests/SubscriptionRequest.php +++ b/app/Http/Requests/SubscriptionRequest.php @@ -11,7 +11,7 @@ class SubscriptionRequest extends BaseRequest * * @return array */ - public function postRules() + public function postRules(): array { return [ 'email' => 'required|email|unique:subscriptions', @@ -24,7 +24,7 @@ class SubscriptionRequest extends BaseRequest * * @return array */ - public function destroyRules() + public function destroyRules(): array { return [ 'email' => 'required|email', diff --git a/app/Http/Requests/UserRequest.php b/app/Http/Requests/UserRequest.php index 322e098..95e32f0 100644 --- a/app/Http/Requests/UserRequest.php +++ b/app/Http/Requests/UserRequest.php @@ -15,7 +15,7 @@ class UserRequest extends BaseRequest * * @return array */ - public function postRules() + public function postRules(): array { $user = auth()->user(); $isAdminUser = $user->hasPermission('admin/users'); @@ -40,7 +40,7 @@ class UserRequest extends BaseRequest * * @return array */ - public function putRules() + public function putRules(): array { $user = auth()->user(); $ruleUser = $this->route('user'); diff --git a/app/Mail/ChangeEmailVerify.php b/app/Mail/ChangeEmailVerify.php index c055bde..c56da17 100644 --- a/app/Mail/ChangeEmailVerify.php +++ b/app/Mail/ChangeEmailVerify.php @@ -57,7 +57,7 @@ class ChangeEmailVerify extends Mailable * * @return \Illuminate\Mail\Mailables\Envelope */ - public function envelope() + public function envelope(): Envelope { return new Envelope( subject: '👋🏻 Lets change your email!', @@ -69,7 +69,7 @@ class ChangeEmailVerify extends Mailable * * @return \Illuminate\Mail\Mailables\Content */ - public function content() + public function content(): Content { return new Content( view: 'emails.user.change_email_verify', diff --git a/app/Mail/ChangedEmail.php b/app/Mail/ChangedEmail.php index d767b85..7ef44fe 100644 --- a/app/Mail/ChangedEmail.php +++ b/app/Mail/ChangedEmail.php @@ -57,7 +57,7 @@ class ChangedEmail extends Mailable * * @return \Illuminate\Mail\Mailables\Envelope */ - public function envelope() + public function envelope(): Envelope { return new Envelope( subject: '👍 Your email has been changed!', @@ -69,7 +69,7 @@ class ChangedEmail extends Mailable * * @return \Illuminate\Mail\Mailables\Content */ - public function content() + public function content(): Content { return new Content( view: 'emails.user.changed_email', diff --git a/app/Mail/ChangedPassword.php b/app/Mail/ChangedPassword.php index 8c62937..40ce216 100644 --- a/app/Mail/ChangedPassword.php +++ b/app/Mail/ChangedPassword.php @@ -39,7 +39,7 @@ class ChangedPassword extends Mailable * * @return \Illuminate\Mail\Mailables\Envelope */ - public function envelope() + public function envelope(): Envelope { return new Envelope( subject: '👍 Your password has been changed!', @@ -51,7 +51,7 @@ class ChangedPassword extends Mailable * * @return \Illuminate\Mail\Mailables\Content */ - public function content() + public function content(): Content { return new Content( view: 'emails.user.changed_password', diff --git a/app/Mail/Contact.php b/app/Mail/Contact.php index d676fb3..4c2f1da 100644 --- a/app/Mail/Contact.php +++ b/app/Mail/Contact.php @@ -56,7 +56,7 @@ class Contact extends Mailable * * @return \Illuminate\Mail\Mailables\Envelope */ - public function envelope() + public function envelope(): Envelope { return new Envelope( subject: config('contact.contact_subject'), @@ -68,7 +68,7 @@ class Contact extends Mailable * * @return \Illuminate\Mail\Mailables\Content */ - public function content() + public function content(): Content { return new Content( view: 'emails.user.contact', diff --git a/app/Mail/EmailVerify.php b/app/Mail/EmailVerify.php index 32f0dcb..8683405 100644 --- a/app/Mail/EmailVerify.php +++ b/app/Mail/EmailVerify.php @@ -48,7 +48,7 @@ class EmailVerify extends Mailable * * @return \Illuminate\Mail\Mailables\Envelope */ - public function envelope() + public function envelope(): Envelope { return new Envelope( subject: '👋🏻 Welcome to STEMMechanics!', @@ -60,7 +60,7 @@ class EmailVerify extends Mailable * * @return \Illuminate\Mail\Mailables\Content */ - public function content() + public function content(): Content { return new Content( view: 'emails.user.email_verify', diff --git a/app/Mail/ForgotPassword.php b/app/Mail/ForgotPassword.php index e48af31..43dbe45 100644 --- a/app/Mail/ForgotPassword.php +++ b/app/Mail/ForgotPassword.php @@ -48,7 +48,7 @@ class ForgotPassword extends Mailable * * @return \Illuminate\Mail\Mailables\Envelope */ - public function envelope() + public function envelope(): Envelope { return new Envelope( subject: '🤦 Forgot your password?', @@ -60,7 +60,7 @@ class ForgotPassword extends Mailable * * @return \Illuminate\Mail\Mailables\Content */ - public function content() + public function content(): Content { return new Content( view: 'emails.user.forgot_password', diff --git a/app/Mail/SubscriptionConfirm.php b/app/Mail/SubscriptionConfirm.php index c896049..c4aaf50 100644 --- a/app/Mail/SubscriptionConfirm.php +++ b/app/Mail/SubscriptionConfirm.php @@ -39,7 +39,7 @@ class SubscriptionConfirm extends Mailable * * @return \Illuminate\Mail\Mailables\Envelope */ - public function envelope() + public function envelope(): Envelope { return new Envelope( subject: '🗞️ You\'re on the mailing list!', @@ -51,7 +51,7 @@ class SubscriptionConfirm extends Mailable * * @return \Illuminate\Mail\Mailables\Content */ - public function content() + public function content(): Content { return new Content( view: 'emails.user.subscription_confirm', diff --git a/app/Mail/SubscriptionUnsubscribed.php b/app/Mail/SubscriptionUnsubscribed.php index ce8fdaf..faa865c 100644 --- a/app/Mail/SubscriptionUnsubscribed.php +++ b/app/Mail/SubscriptionUnsubscribed.php @@ -39,7 +39,7 @@ class SubscriptionUnsubscribed extends Mailable * * @return \Illuminate\Mail\Mailables\Envelope */ - public function envelope() + public function envelope(): Envelope { return new Envelope( subject: 'You have been unsubscribed', @@ -51,7 +51,7 @@ class SubscriptionUnsubscribed extends Mailable * * @return \Illuminate\Mail\Mailables\Content */ - public function content() + public function content(): Content { return new Content( view: 'emails.user.subscription_unsubscribed', diff --git a/app/Models/Analytics.php b/app/Models/Analytics.php index f5c400f..ff1dc26 100644 --- a/app/Models/Analytics.php +++ b/app/Models/Analytics.php @@ -24,7 +24,7 @@ class Analytics extends Model * @param array $attributes Model attributes. * @return static */ - public static function createWithSession(array $attributes) + public static function createWithSession(array $attributes): static { $previousRow = self::where('useragent', $attributes['useragent']) ->where('ip', $attributes['ip']) diff --git a/app/Models/Article.php b/app/Models/Article.php index 34066c7..13b1eba 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -32,7 +32,7 @@ class Article extends Model * * @return BelongsTo */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } @@ -42,7 +42,7 @@ class Article extends Model * * @return MorphMany */ - public function attachments() + public function attachments(): MorphMany { return $this->morphMany(\App\Models\Attachment::class, 'attachable'); } diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php index 0728633..52a9369 100644 --- a/app/Models/Attachment.php +++ b/app/Models/Attachment.php @@ -36,7 +36,7 @@ class Attachment extends Model * * @return MorphTo */ - public function attachable() + public function attachable(): MorphTo { return $this->morphTo(); } @@ -46,7 +46,7 @@ class Attachment extends Model * * @return BelongsTo */ - public function media() + public function media(): BelongsTo { return $this->belongsTo(Media::class); } diff --git a/app/Models/Event.php b/app/Models/Event.php index b2dca8d..62e8c65 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -41,7 +41,7 @@ class Event extends Model * * @return MorphMany */ - public function attachments() + public function attachments(): MorphMany { return $this->morphMany(\App\Models\Attachment::class, 'attachable'); } @@ -51,7 +51,7 @@ class Event extends Model * * @return BelongsToMany */ - public function users() + public function users(): BelongsToMany { return $this->belongsToMany(User::class, 'event_user', 'event_id', 'user_id'); } diff --git a/app/Models/EventUsers.php b/app/Models/EventUsers.php index f1ea84b..cc2a740 100644 --- a/app/Models/EventUsers.php +++ b/app/Models/EventUsers.php @@ -27,7 +27,7 @@ class EventUser extends Model * * @return BelongsTo */ - public function event() + public function event(): BelongsTo { return $this->belongsTo(Event::class); } @@ -37,7 +37,7 @@ class EventUser extends Model * * @return BelongsTo */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/app/Models/Media.php b/app/Models/Media.php index 46524a7..33fc445 100644 --- a/app/Models/Media.php +++ b/app/Models/Media.php @@ -103,7 +103,7 @@ class Media extends Model * * @return void */ - protected static function boot() + protected static function boot(): void { parent::boot(); @@ -136,7 +136,7 @@ class Media extends Model * @param string $type The variant type to get. * @return array The variant data. */ - public static function getTypeVariants(string $type) + public static function getTypeVariants(string $type): array { if (isset(self::$variantTypes[$type]) === true) { return self::$variantTypes[$type]; @@ -151,7 +151,7 @@ class Media extends Model * @param mixed $value The value to mutate. * @return array The mutated value. */ - public function getVariantsAttribute(mixed $value) + public function getVariantsAttribute(mixed $value): array { if (is_string($value) === true) { return json_decode($value, true); @@ -166,7 +166,7 @@ class Media extends Model * @param mixed $value The value to mutate. * @return void */ - public function setVariantsAttribute(mixed $value) + public function setVariantsAttribute(mixed $value): void { if (is_array($value) !== true) { $value = []; @@ -182,7 +182,7 @@ class Media extends Model * @param string $variant The initial variant. * @return string The previous variant name (or ''). */ - public function getPreviousVariant(string $type, string $variant) + public function getPreviousVariant(string $type, string $variant): string { if (isset(self::$variantTypes[$type]) === false) { return ''; @@ -206,7 +206,7 @@ class Media extends Model * @param string $variant The initial variant. * @return string The next variant name (or ''). */ - public function getNextVariant(string $type, string $variant) + public function getNextVariant(string $type, string $variant): string { if (isset(self::$variantTypes[$type]) === false) { return ''; @@ -230,7 +230,7 @@ class Media extends Model * @param boolean $returnNearest Return the nearest variant if request is not found. * @return string The URL. */ - public function getVariantURL(string $variant, bool $returnNearest = true) + public function getVariantURL(string $variant, bool $returnNearest = true): string { $variants = $this->variants; if (isset($variants[$variant]) === true) { @@ -259,7 +259,7 @@ class Media extends Model * * @return void */ - public function deleteFile() + public function deleteFile(): void { $fileName = $this->name; $baseName = pathinfo($fileName, PATHINFO_FILENAME); @@ -282,7 +282,7 @@ class Media extends Model * @return void * @throws InvalidArgumentException Exception. */ - private function invalidateCFCache() + private function invalidateCFCache(): void { $zone_id = env("CLOUDFLARE_ZONE_ID"); $api_key = env("CLOUDFLARE_API_KEY"); @@ -314,7 +314,7 @@ class Media extends Model * * @return string */ - public function getUrlPath() + public function getUrlPath(): string { $url = config("filesystems.disks.$this->storage.url"); return "$url/"; @@ -325,7 +325,7 @@ class Media extends Model * * @return string */ - public function getUrlAttribute() + public function getUrlAttribute(): string { if (isset($this->attributes['name']) === true) { return self::getUrlPath() . $this->name; @@ -339,7 +339,7 @@ class Media extends Model * * @return BelongsTo */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } @@ -350,7 +350,7 @@ class Media extends Model * @param string $storage The storage ID to move to. * @return void */ - public function moveToStorage(string $storage) + public function moveToStorage(string $storage): void { if ($storage !== $this->storage && Config::has("filesystems.disks.$storage") === true) { $this->status = "Processing media"; @@ -366,7 +366,7 @@ class Media extends Model * @param Illuminate\Http\UploadedFile $file The file. * @return null|Media The result or null if not successful. */ - public static function createFromUploadedFile(Request $request, UploadedFile $file) + public static function createFromUploadedFile(Request $request, UploadedFile $file): ?Media { $request->merge([ 'title' => $request->get('title', ''), @@ -401,7 +401,7 @@ class Media extends Model * @param Illuminate\Http\UploadedFile $file The file. * @return null|Media The media item. */ - public function updateWithUploadedFile(UploadedFile $file) + public function updateWithUploadedFile(UploadedFile $file): ?Media { if ($file === null || $file->isValid() !== true) { throw new \Exception('The file is invalid.', self::INVALID_FILE_ERROR); @@ -497,7 +497,7 @@ class Media extends Model * * @return integer */ - public static function getMaxUploadSize() + public static function getMaxUploadSize(): int { $sizes = [ ini_get('upload_max_filesize'), @@ -561,7 +561,7 @@ class Media extends Model * @param boolean $ignoreCache Ignore the file list cache. * @return boolean If the file exists on any storage disks. */ - public static function fileExistsInStorage(string $fileName, bool $ignoreCache = false) + public static function fileExistsInStorage(string $fileName, bool $ignoreCache = false): bool { $disks = array_keys(Config::get('filesystems.disks')); @@ -608,7 +608,7 @@ class Media extends Model * @param string $fileName The file name to test. * @return boolean If the file name contains the special suffix. */ - public static function fileNameHasSuffix(string $fileName) + public static function fileNameHasSuffix(string $fileName): bool { $suffix = '/(-\d+x\d+|-scaled)$/i'; $fileNameWithoutExtension = pathinfo($fileName, PATHINFO_FILENAME); @@ -622,7 +622,7 @@ class Media extends Model * @param string $fileName Filename to sanitize. * @return string */ - private static function sanitizeFilename(string $fileName) + private static function sanitizeFilename(string $fileName): string { /* # file system reserved https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words diff --git a/app/Models/Permission.php b/app/Models/Permission.php index 5c35923..ef1c791 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -27,7 +27,7 @@ class Permission extends Model * * @return BelongsTo */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/app/Models/User.php b/app/Models/User.php index e915254..ae029b3 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -82,7 +82,7 @@ class User extends Authenticatable implements Auditable * * @return HasMany */ - public function permissions() + public function permissions(): HasMany { return $this->hasMany(Permission::class); } @@ -92,7 +92,7 @@ class User extends Authenticatable implements Auditable * * @return array */ - public function getPermissionsAttribute() + public function getPermissionsAttribute(): array { return $this->permissions()->pluck('permission')->toArray(); } @@ -103,7 +103,7 @@ class User extends Authenticatable implements Auditable * @param string $permission Permission to test. * @return boolean */ - public function hasPermission(string $permission) + public function hasPermission(string $permission): bool { return ($this->permissions()->where('permission', $permission)->first() !== null); } @@ -114,7 +114,7 @@ class User extends Authenticatable implements Auditable * @param string|array $permissions The permission(s) to give. * @return Collection */ - public function givePermission($permissions) + public function givePermission($permissions): Collection { if (is_array($permissions) === false) { $permissions = [$permissions]; @@ -139,7 +139,7 @@ class User extends Authenticatable implements Auditable * @param string|array $permissions The permission(s) to revoke. * @return integer */ - public function revokePermission($permissions) + public function revokePermission($permissions): int { if (is_array($permissions) === false) { $permissions = [$permissions]; @@ -155,7 +155,7 @@ class User extends Authenticatable implements Auditable * * @return HasMany */ - public function media() + public function media(): HasMany { return $this->hasMany(Media::class); } @@ -165,7 +165,7 @@ class User extends Authenticatable implements Auditable * * @return HasMany */ - public function articles() + public function articles(): HasMany { return $this->hasMany(Article::class); } @@ -175,7 +175,7 @@ class User extends Authenticatable implements Auditable * * @return HasMany */ - public function codes() + public function codes(): HasMany { return $this->hasMany(UserCode::class); } @@ -185,7 +185,7 @@ class User extends Authenticatable implements Auditable * * @return HasMany */ - public function logins() + public function logins(): HasMany { return $this->hasMany(UserLogins::class); } @@ -195,7 +195,7 @@ class User extends Authenticatable implements Auditable * * @return BelongsToMany */ - public function events() + public function events(): BelongsToMany { return $this->belongsToMany(Event::class, 'event_user', 'user_id', 'event_id'); } diff --git a/app/Models/UserCode.php b/app/Models/UserCode.php index dcc0f58..e9b8599 100644 --- a/app/Models/UserCode.php +++ b/app/Models/UserCode.php @@ -26,7 +26,7 @@ class UserCode extends Model * * @return void */ - protected static function boot() + protected static function boot(): void { parent::boot(); static::creating(function ($model) { @@ -49,7 +49,7 @@ class UserCode extends Model * * @return void */ - public function regenerate() + public function regenerate(): void { while (true) { $code = random_int(100000, 999999); @@ -65,7 +65,7 @@ class UserCode extends Model * * @return void */ - public static function clearExpired() + public static function clearExpired(): void { UserCode::where('updated_at', '<=', now()->subDays(5))->delete(); } @@ -75,7 +75,7 @@ class UserCode extends Model * * @return BelongsTo */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/app/Models/UserLogins.php b/app/Models/UserLogins.php index 09c0f4b..29fef9c 100644 --- a/app/Models/UserLogins.php +++ b/app/Models/UserLogins.php @@ -31,7 +31,7 @@ class UserLogins extends Model * * @return BelongsTo */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/app/Rules/Recaptcha.php b/app/Rules/Recaptcha.php index 5f9fe1b..eb0f865 100644 --- a/app/Rules/Recaptcha.php +++ b/app/Rules/Recaptcha.php @@ -24,7 +24,7 @@ class Recaptcha implements Rule * @param mixed $value Attribute value. * @return boolean */ - public function passes(mixed $attribute, mixed $value) + public function passes(mixed $attribute, mixed $value): bool { $endpoint = config('services.google_recaptcha'); @@ -45,7 +45,7 @@ class Recaptcha implements Rule * * @return string */ - public function message() + public function message(): string { return 'Captcha failed. Refresh the page and try again'; } diff --git a/app/Rules/UniqueFileName.php b/app/Rules/UniqueFileName.php index 70e06ff..94785bf 100644 --- a/app/Rules/UniqueFileName.php +++ b/app/Rules/UniqueFileName.php @@ -24,7 +24,7 @@ class UniqueFileName implements Rule * @param mixed $value * @return boolean */ - public function passes($attribute, $value) + public function passes(string $attribute, $value): bool { return (Media::fileExists($value) === false); } @@ -34,7 +34,7 @@ class UniqueFileName implements Rule * * @return string */ - public function message() + public function message(): string { return 'The file name already exists.'; } diff --git a/app/Rules/Uniqueish.php b/app/Rules/Uniqueish.php index f6fb8a3..81c12ea 100644 --- a/app/Rules/Uniqueish.php +++ b/app/Rules/Uniqueish.php @@ -49,7 +49,7 @@ class Uniqueish implements Rule * @param mixed $id The ID to ignore. * @return $this */ - public function ignore(mixed $id) + public function ignore(mixed $id): static { $this->ignoreId = $id; return $this; @@ -62,7 +62,7 @@ class Uniqueish implements Rule * @param mixed $value The value to compare. * @return boolean */ - public function passes(mixed $attribute, mixed $value) + public function passes(mixed $attribute, mixed $value): bool { $columnName = ($this->column ?? $attribute); $similarValue = preg_replace('/[^A-Za-z]/', '', strtolower($value)); @@ -100,7 +100,7 @@ class Uniqueish implements Rule * * @return string */ - public function message() + public function message(): string { return 'The :attribute is similar to one that already exists. Please choose another.'; } diff --git a/app/Services/AnimatedGifService.php b/app/Services/AnimatedGifService.php index e446e15..fecea69 100644 --- a/app/Services/AnimatedGifService.php +++ b/app/Services/AnimatedGifService.php @@ -11,7 +11,7 @@ class AnimatedGifService * @param integer $dataSize GIF blob size. * @return boolean GIF file/blob is animated. */ - public static function isAnimatedGif(string $filenameOrBlob, int $dataSize = 0) + public static function isAnimatedGif(string $filenameOrBlob, int $dataSize = 0): bool { $regex = '#\x00\x21\xF9\x04.{4}\x00(\x2C|\x21)#s'; $count = 0; @@ -44,7 +44,7 @@ class AnimatedGifService * * @return array */ - public function extract(string $filenameOrBlob, int $dataSize = 0, $originalFrames = false) + public function extract(string $filenameOrBlob, int $dataSize = 0, bool $originalFrames = false): array { if (self::isAnimatedGif($filenameOrBlob) === false) { return []; @@ -198,7 +198,7 @@ class GifFrameExtractor * * @param string $filename GIF filename path */ - private function parseFramesInfo($filename) + private function parseFramesInfo(string $filename) { $this->openFile($filename); $this->parseGifHeader(); @@ -278,7 +278,7 @@ class GifFrameExtractor * * @param integer $type */ - private function parseGraphicsExtension($type) + private function parseGraphicsExtension(int $type) { $startdata = $this->readByte(2); @@ -306,7 +306,7 @@ class GifFrameExtractor * * @param integer $type */ - private function getFrameString($type) + private function getFrameString(int $type) { if ($this->checkByte(0x2c)) { $start = $this->pointer; @@ -407,7 +407,7 @@ class GifFrameExtractor * * @return string */ - private function getImageDataByte($type, $start, $length) + private function getImageDataByte(string $type, int $start, int $length): string { if ($type == "ext") { return substr($this->frameSources[$this->frameNumber]["graphicsextension"], $start, $length); @@ -427,7 +427,7 @@ class GifFrameExtractor * * @return number */ - private function getImageDataBit($type, $byteIndex, $bitStart, $bitLength) + private function getImageDataBit(string $type, int $byteIndex, int $bitStart, int $bitLength): number { if ($type == "ext") { return $this->readBits(ord(substr($this->frameSources[$this->frameNumber]["graphicsextension"], $byteIndex, 1)), $bitStart, $bitLength); @@ -444,7 +444,7 @@ class GifFrameExtractor * * @return integer */ - private function dualByteVal($s) + private function dualByteVal(string $s): int { $i = (ord($s[1]) * 256 + ord($s[0])); @@ -456,7 +456,7 @@ class GifFrameExtractor * * @param integer $firstLength */ - private function readDataStream($firstLength) + private function readDataStream(int $firstLength) { $this->pointerForward($firstLength); $length = $this->readByteInt(); @@ -474,7 +474,7 @@ class GifFrameExtractor * * @param string $filename */ - private function openFile($filename) + private function openFile(string $filename) { $this->handle = fopen($filename, "rb"); $this->pointer = 0; @@ -500,7 +500,7 @@ class GifFrameExtractor * * @return string */ - private function readByte($byteCount) + private function readByte(int $byteCount): string { $data = fread($this->handle, $byteCount); $this->pointer += $byteCount; @@ -513,7 +513,7 @@ class GifFrameExtractor * * @return integer */ - private function readByteInt() + private function readByteInt(): int { $data = fread($this->handle, 1); $this->pointer++; @@ -530,7 +530,7 @@ class GifFrameExtractor * * @return number */ - private function readBits($byte, $start, $length) + private function readBits(string $byte, int $start, int $length): number { $bin = str_pad(decbin($byte), 8, "0", STR_PAD_LEFT); $data = substr($bin, $start, $length); @@ -543,7 +543,7 @@ class GifFrameExtractor * * @param integer $length */ - private function pointerRewind($length) + private function pointerRewind(int $length) { $this->pointer -= $length; fseek($this->handle, $this->pointer); @@ -554,7 +554,7 @@ class GifFrameExtractor * * @param integer $length */ - private function pointerForward($length) + private function pointerForward(int $length) { $this->pointer += $length; fseek($this->handle, $this->pointer); @@ -568,7 +568,7 @@ class GifFrameExtractor * * @return string */ - private function dataPart($start, $length) + private function dataPart(int $start, int $length): string { fseek($this->handle, $start); $data = fread($this->handle, $length); @@ -584,7 +584,7 @@ class GifFrameExtractor * * @return boolean */ - private function checkByte($byte) + private function checkByte(int $byte): bool { if (fgetc($this->handle) == chr($byte)) { fseek($this->handle, $this->pointer); @@ -601,7 +601,7 @@ class GifFrameExtractor * * @return boolean */ - private function checkEOF() + private function checkEOF(): bool { if (fgetc($this->handle) === false) { return true; @@ -631,7 +631,7 @@ class GifFrameExtractor * * @return integer */ - public function getTotalDuration() + public function getTotalDuration(): int { return $this->totalDuration; } @@ -641,7 +641,7 @@ class GifFrameExtractor * * @return integer */ - public function getFrameNumber() + public function getFrameNumber(): int { return $this->frameNumber; } @@ -651,7 +651,7 @@ class GifFrameExtractor * * @return array */ - public function getFrames() + public function getFrames(): array { return $this->frames; } @@ -661,7 +661,7 @@ class GifFrameExtractor * * @return array */ - public function getFramePositions() + public function getFramePositions(): array { return $this->framePositions; } @@ -671,7 +671,7 @@ class GifFrameExtractor * * @return array */ - public function getFrameDimensions() + public function getFrameDimensions(): array { return $this->frameDimensions; } @@ -681,7 +681,7 @@ class GifFrameExtractor * * @return array */ - public function getFrameImages() + public function getFrameImages(): array { return $this->frameImages; } @@ -691,7 +691,7 @@ class GifFrameExtractor * * @return array */ - public function getFrameDurations() + public function getFrameDurations(): array { return $this->frameDurations; } diff --git a/app/Traits/Uuids.php b/app/Traits/Uuids.php index 4e9cf81..a5053ee 100644 --- a/app/Traits/Uuids.php +++ b/app/Traits/Uuids.php @@ -11,7 +11,7 @@ trait Uuids * * @return void */ - protected static function bootUuids() + protected static function bootUuids(): void { static::creating(function ($model) { if (empty($model->{$model->getKeyName()}) === true) { @@ -25,7 +25,7 @@ trait Uuids * * @return boolean */ - public function getIncrementing() + public function getIncrementing(): bool { return false; } @@ -35,7 +35,7 @@ trait Uuids * * @return string */ - public function getKeyType() + public function getKeyType(): string { return 'string'; } diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 4d016d1..9c0da55 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -42,7 +42,7 @@ class UserFactory extends Factory * * @return static */ - public function unverified() + public function unverified(): static { return $this->state(fn (array $attributes) => [ 'email_verified_at' => null, -- 2.49.1 From 5faf49688dbb82e621432c33282b7dc134b6391f Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:33:17 +0000 Subject: [PATCH 15/16] Remove redundant typing from DocBlocks --- app/Conductors/ArticleConductor.php | 1 - app/Conductors/Conductor.php | 10 --- app/Conductors/EventConductor.php | 1 - app/Conductors/MediaConductor.php | 1 - app/Console/Commands/MediaMigrate.php | 4 -- app/Console/Commands/MediaRebuild.php | 4 -- app/Console/Kernel.php | 3 - app/Enum/Enum.php | 2 - app/Exceptions/Handler.php | 2 - app/Http/Controllers/Api/ApiController.php | 10 --- .../Controllers/Api/ArticleController.php | 2 - .../Controllers/Api/AttachmentController.php | 6 -- app/Http/Controllers/Api/AuthController.php | 2 - app/Http/Controllers/Api/EventController.php | 2 - app/Http/Controllers/Api/UserController.php | 3 - app/Http/Middleware/Authenticate.php | 1 - app/Http/Middleware/ForceJsonResponse.php | 2 - app/Http/Middleware/LogRequest.php | 4 +- .../Middleware/RedirectIfAuthenticated.php | 3 +- app/Http/Middleware/UseSanctumGuard.php | 4 +- app/Http/Requests/BaseRequest.php | 3 - app/Http/Requests/SubscriptionRequest.php | 2 - app/Jobs/MoveMediaJob.php | 2 - app/Jobs/SendEmailJob.php | 2 - app/Jobs/StoreUploadedFileJob.php | 2 - app/Mail/ChangeEmailVerify.php | 4 -- app/Mail/ChangedEmail.php | 4 -- app/Mail/ChangedPassword.php | 4 -- app/Mail/Contact.php | 4 -- app/Mail/EmailVerify.php | 4 -- app/Mail/ForgotPassword.php | 4 -- app/Mail/SubscriptionConfirm.php | 4 -- app/Mail/SubscriptionUnsubscribed.php | 4 -- app/Models/Analytics.php | 1 - app/Models/Article.php | 4 -- app/Models/Attachment.php | 4 -- app/Models/Event.php | 4 -- app/Models/EventUsers.php | 4 -- app/Models/Media.php | 16 ----- app/Models/Permission.php | 2 - app/Models/User.php | 17 ----- app/Models/UserCode.php | 8 --- app/Models/UserLogins.php | 2 - app/Providers/AppServiceProvider.php | 4 -- app/Providers/AuthServiceProvider.php | 2 - app/Providers/EventServiceProvider.php | 4 -- app/Providers/RouteServiceProvider.php | 2 - app/Rules/Recaptcha.php | 3 - app/Rules/UniqueFileName.php | 4 -- app/Rules/Uniqueish.php | 4 -- app/Services/AnimatedGifService.php | 68 ------------------- app/Traits/Uuids.php | 6 -- database/factories/UserFactory.php | 2 - .../2014_10_12_000000_create_users_table.php | 4 -- ...12_100000_create_password_resets_table.php | 4 -- ..._08_19_000000_create_failed_jobs_table.php | 4 -- ...01_create_personal_access_tokens_table.php | 4 -- .../2022_12_28_113117_create_posts_table.php | 4 -- .../2022_12_30_105153_create_media_table.php | 4 -- ..._12_30_110049_create_permissions_table.php | 4 -- .../2023_01_01_103251_create_events_table.php | 4 -- ..._021_050482_create_subscriptions_table.php | 4 -- .../2023_01_05_043106_create_jobs_table.php | 4 -- ...3_01_05_112154_create_user_codes_table.php | 4 -- .../2023_01_08_045958_create_audits_table.php | 4 -- ..._01_08_050847_create_user_logins_table.php | 4 -- ...23_01_24_080416_create_analytics_table.php | 4 -- ..._02_24_023054_create_attachments_table.php | 4 -- ...02_28_090609_add_price_to_events_table.php | 4 -- ..._03_01_075334_add_ages_to_events_table.php | 4 -- .../2023_04_05_222458_update_media_table.php | 4 -- ...pdate_no_nullable_phone_on_users_table.php | 4 -- ...113354_add_display_name_to_users_table.php | 4 -- ..._04_19_122711_drop_subscriptions_table.php | 4 -- .../2023_04_25_235615_update_posts_table.php | 4 -- ...23_05_01_045630_update_analytics_table.php | 4 -- ...71954_remove_username_from_users_table.php | 4 -- ...3_05_06_080418_create_shortlinks_table.php | 4 -- ...082705_add_counter_to_shortlinks_table.php | 4 -- .../2023_05_08_021929_update_users_table.php | 4 -- ...5_09_003156_add_location_url_to_events.php | 4 -- ...32859_add_private_to_attachments_table.php | 4 -- ..._05_11_033621_create_event_users_table.php | 4 -- ...24_000000_rename_password_resets_table.php | 4 -- database/seeders/DatabaseSeeder.php | 2 - tests/Unit/ExampleTest.php | 2 - 86 files changed, 3 insertions(+), 396 deletions(-) diff --git a/app/Conductors/ArticleConductor.php b/app/Conductors/ArticleConductor.php index 217786c..2a1a0b5 100644 --- a/app/Conductors/ArticleConductor.php +++ b/app/Conductors/ArticleConductor.php @@ -39,7 +39,6 @@ class ArticleConductor extends Conductor * Run a scope query on the collection before anything else. * * @param Builder $builder The builder in use. - * @return void */ public function scope(Builder $builder): void { diff --git a/app/Conductors/Conductor.php b/app/Conductors/Conductor.php index cf46d61..f25d0a2 100644 --- a/app/Conductors/Conductor.php +++ b/app/Conductors/Conductor.php @@ -143,7 +143,6 @@ class Conductor * * @param Request $request The user request. * @param array|null $limitFields A list of fields to limit the filter request to. - * @return void */ private function filter(Request $request, array|null $limitFields = null): void { @@ -210,8 +209,6 @@ class Conductor /** * Apple the filter array to the collection. - * - * @return void */ final public function applyFilters(): void { @@ -503,7 +500,6 @@ class Conductor * @param Builder $query The custom query. * @param Request $request The request. * @param array|null $limitFields Limit the request to these fields. - * @return Builder */ public static function filterQuery(Builder $query, Request $request, array|null $limitFields = null): Builder { @@ -619,7 +615,6 @@ class Conductor * Sort the conductor collection. * * @param mixed $fields A field name or array of field names to sort. Supports prefix of +/- to change direction. - * @return void */ final public function sort(mixed $fields = null): void { @@ -698,7 +693,6 @@ class Conductor * * @param Model $model The model to append. * @param array $includes The list of includes to include. - * @return void */ final public function applyIncludes(Model $model, array $includes): void { @@ -718,7 +712,6 @@ class Conductor * Limit the returned fields in the conductor collection. * * @param array $fields An array of field names. - * @return void */ final public function limitFields(array $fields): void { @@ -733,7 +726,6 @@ class Conductor * @param string $rawFilter The raw filter string to parse. * @param array|null $limitFields The fields to allow in the filter string. * @param string $outerJoin The join for this filter group. - * @return void */ final public function appendFilterString(string $rawFilter, array|null $limitFields = null, string $outerJoin = 'OR'): void { @@ -847,7 +839,6 @@ class Conductor * @param string $operator The operator to append. * @param string $value The value to append. * @param string $join The join to append. - * @return void */ final public function appendFilter(string $field, string $operator, string $value, string $join = 'OR'): void { @@ -861,7 +852,6 @@ class Conductor * Run a scope query on the collection before anything else. * * @param Builder $builder The builder in use. - * @return void */ public function scope(Builder $builder): void { diff --git a/app/Conductors/EventConductor.php b/app/Conductors/EventConductor.php index 8c1ceaa..260b547 100644 --- a/app/Conductors/EventConductor.php +++ b/app/Conductors/EventConductor.php @@ -33,7 +33,6 @@ class EventConductor extends Conductor * Run a scope query on the collection before anything else. * * @param Builder $builder The builder in use. - * @return void */ public function scope(Builder $builder): void { diff --git a/app/Conductors/MediaConductor.php b/app/Conductors/MediaConductor.php index 15d48cb..25fd9ee 100644 --- a/app/Conductors/MediaConductor.php +++ b/app/Conductors/MediaConductor.php @@ -59,7 +59,6 @@ class MediaConductor extends Conductor * Run a scope query on the collection before anything else. * * @param Builder $builder The builder in use. - * @return void */ public function scope(Builder $builder): void { diff --git a/app/Console/Commands/MediaMigrate.php b/app/Console/Commands/MediaMigrate.php index 32156e6..99103b1 100644 --- a/app/Console/Commands/MediaMigrate.php +++ b/app/Console/Commands/MediaMigrate.php @@ -27,8 +27,6 @@ class MediaMigrate extends Command /** * Configure the command options. - * - * @return void */ protected function configure(): void { @@ -42,8 +40,6 @@ class MediaMigrate extends Command /** * Execute the console command. - * - * @return void */ public function handle(): void { diff --git a/app/Console/Commands/MediaRebuild.php b/app/Console/Commands/MediaRebuild.php index f37a755..a37db86 100644 --- a/app/Console/Commands/MediaRebuild.php +++ b/app/Console/Commands/MediaRebuild.php @@ -26,8 +26,6 @@ class MediaRebuild extends Command /** * Configure the command options. - * - * @return void */ protected function configure(): void { @@ -48,8 +46,6 @@ class MediaRebuild extends Command /** * Execute the console command. - * - * @return void */ public function handle(): void { diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 9169768..03e5175 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -11,7 +11,6 @@ class Kernel extends ConsoleKernel * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule The schedule. - * @return void */ protected function schedule(Schedule $schedule): void { @@ -20,8 +19,6 @@ class Kernel extends ConsoleKernel /** * Register the commands for the application. - * - * @return void */ protected function commands(): void { diff --git a/app/Enum/Enum.php b/app/Enum/Enum.php index 5596e01..a7b0993 100644 --- a/app/Enum/Enum.php +++ b/app/Enum/Enum.php @@ -57,8 +57,6 @@ class Enum /** * Returns a message from the enum subclass - * - * @return string */ public static function getMessage(int $messageIndex, string $defaultMessage = 'Unknown'): string { diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 72e8d38..b35c316 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -26,8 +26,6 @@ class Handler extends ExceptionHandler /** * Register the exception handling callbacks for the application. - * - * @return void */ public function register(): void { diff --git a/app/Http/Controllers/Api/ApiController.php b/app/Http/Controllers/Api/ApiController.php index 307864c..1c1678d 100644 --- a/app/Http/Controllers/Api/ApiController.php +++ b/app/Http/Controllers/Api/ApiController.php @@ -24,7 +24,6 @@ class ApiController extends Controller * @param array $data Response data. * @param integer $respondCode Response status code. * @param array $headers Response headers. - * @return \Illuminate\Http\JsonResponse */ public function respondJson(array $data, int $respondCode = HttpResponseCodes::HTTP_OK, array $headers = []): JsonResponse { @@ -35,7 +34,6 @@ class ApiController extends Controller * Return forbidden message * * @param string $message Response message. - * @return \Illuminate\Http\JsonResponse */ public function respondForbidden(string $message = 'You do not have permission to access the resource.'): JsonResponse { @@ -46,7 +44,6 @@ class ApiController extends Controller * Return forbidden message * * @param string $message Response message. - * @return \Illuminate\Http\JsonResponse */ public function respondNotFound(string $message = 'The resource was not found.'): JsonResponse { @@ -57,7 +54,6 @@ class ApiController extends Controller * Return too large message * * @param string $message Response message. - * @return \Illuminate\Http\JsonResponse */ public function respondTooLarge(string $message = 'The request entity is too large.'): JsonResponse { @@ -66,7 +62,6 @@ class ApiController extends Controller /** * Return no content - * @return \Illuminate\Http\JsonResponse */ public function respondNoContent(): JsonResponse { @@ -75,7 +70,6 @@ class ApiController extends Controller /** * Return created - * @return \Illuminate\Http\JsonResponse */ public function respondCreated(): JsonResponse { @@ -84,7 +78,6 @@ class ApiController extends Controller /** * Return accepted - * @return \Illuminate\Http\JsonResponse */ public function respondAccepted(): JsonResponse { @@ -96,7 +89,6 @@ class ApiController extends Controller * * @param string $message Error message. * @param integer $responseCode Resource code. - * @return \Illuminate\Http\JsonResponse */ public function respondError(string $message, int $responseCode = HttpResponseCodes::HTTP_UNPROCESSABLE_ENTITY): JsonResponse { @@ -110,7 +102,6 @@ class ApiController extends Controller * * @param array $errors Error messages. * @param integer $responseCode Resource code. - * @return \Illuminate\Http\JsonResponse */ public function respondWithErrors(array $errors, int $responseCode = HttpResponseCodes::HTTP_UNPROCESSABLE_ENTITY): JsonResponse { @@ -133,7 +124,6 @@ class ApiController extends Controller * * @param array|Model|Collection $data Resource data. * @param array $options Respond options. - * @return \Illuminate\Http\JsonResponse */ protected function respondAsResource( mixed $data, diff --git a/app/Http/Controllers/Api/ArticleController.php b/app/Http/Controllers/Api/ArticleController.php index b93c5a6..f612f4c 100644 --- a/app/Http/Controllers/Api/ArticleController.php +++ b/app/Http/Controllers/Api/ArticleController.php @@ -167,7 +167,6 @@ class ArticleController extends ApiController * * @param Request $request The user request. * @param Article $article The related model. - * @return JsonResponse * @throws BindingResolutionException * @throws MassAssignmentException */ @@ -216,7 +215,6 @@ class ArticleController extends ApiController * @param Request $request The user request. * @param Article $article The model. * @param Media $medium The attachment medium. - * @return JsonResponse * @throws BindingResolutionException */ public function deleteAttachment(Request $request, Article $article, Media $medium): JsonResponse diff --git a/app/Http/Controllers/Api/AttachmentController.php b/app/Http/Controllers/Api/AttachmentController.php index 6586734..0c2060a 100644 --- a/app/Http/Controllers/Api/AttachmentController.php +++ b/app/Http/Controllers/Api/AttachmentController.php @@ -29,7 +29,6 @@ class AttachmentController extends ApiController /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -40,7 +39,6 @@ class AttachmentController extends ApiController /** * Display the specified resource. * - * @param \App\Models\Attachment $attachment * @return \Illuminate\Http\Response */ public function show(Attachment $attachment) @@ -51,7 +49,6 @@ class AttachmentController extends ApiController /** * Show the form for editing the specified resource. * - * @param \App\Models\Attachment $attachment * @return \Illuminate\Http\Response */ public function edit(Attachment $attachment) @@ -62,8 +59,6 @@ class AttachmentController extends ApiController /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param \App\Models\Attachment $attachment * @return \Illuminate\Http\Response */ public function update(Request $request, Attachment $attachment) @@ -74,7 +69,6 @@ class AttachmentController extends ApiController /** * Remove the specified resource from storage. * - * @param \App\Models\Attachment $attachment * @return \Illuminate\Http\Response */ public function destroy(Attachment $attachment) diff --git a/app/Http/Controllers/Api/AuthController.php b/app/Http/Controllers/Api/AuthController.php index e6c60ab..3fab72d 100644 --- a/app/Http/Controllers/Api/AuthController.php +++ b/app/Http/Controllers/Api/AuthController.php @@ -31,7 +31,6 @@ class AuthController extends ApiController * Current User details * * @param Request $request Current request data. - * @return JsonResponse */ public function me(Request $request): JsonResponse { @@ -87,7 +86,6 @@ class AuthController extends ApiController * Logout current user * * @param Request $request Current request data. - * @return JsonResponse */ public function logout(Request $request): JsonResponse { diff --git a/app/Http/Controllers/Api/EventController.php b/app/Http/Controllers/Api/EventController.php index 523b63c..f057914 100644 --- a/app/Http/Controllers/Api/EventController.php +++ b/app/Http/Controllers/Api/EventController.php @@ -155,7 +155,6 @@ class EventController extends ApiController * * @param Request $request The user request. * @param Event $event The related model. - * @return JsonResponse */ public function updateAttachments(Request $request, Event $event): JsonResponse { @@ -203,7 +202,6 @@ class EventController extends ApiController * @param Request $request The user request. * @param Event $event The model. * @param Media $medium The attachment medium. - * @return JsonResponse */ public function deleteAttachment(Request $request, Event $event, Media $medium): JsonResponse { diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index e46a079..052ae26 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -145,7 +145,6 @@ class UserController extends ApiController * Register a new user * * @param \App\Http\Requests\UserRegisterRequest $request The register user request. - * @return \Illuminate\Http\Response */ public function register(UserRegisterRequest $request): JsonResponse { @@ -286,7 +285,6 @@ class UserController extends ApiController * Resend a new verify email * * @param \App\Http\Requests\UserResendVerifyEmailRequest $request The resend verify email request. - * @return \Illuminate\Http\Response */ public function resendVerifyEmail(UserResendVerifyEmailRequest $request): JsonResponse { @@ -340,7 +338,6 @@ class UserController extends ApiController * * @param Request $request The http request. * @param User $user The specified user. - * @return JsonResponse */ public function eventList(Request $request, User $user): JsonResponse { diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index ce91e84..76a7ff5 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -10,7 +10,6 @@ class Authenticate extends Middleware * Get the path the user should be redirected to when they are not authenticated. * * @param mixed $request Request. - * @return string|null */ protected function redirectTo(mixed $request): ?string { diff --git a/app/Http/Middleware/ForceJsonResponse.php b/app/Http/Middleware/ForceJsonResponse.php index efec056..cdfa47e 100644 --- a/app/Http/Middleware/ForceJsonResponse.php +++ b/app/Http/Middleware/ForceJsonResponse.php @@ -11,9 +11,7 @@ class ForceJsonResponse /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next - * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse */ public function handle(Request $request, Closure $next): Response { diff --git a/app/Http/Middleware/LogRequest.php b/app/Http/Middleware/LogRequest.php index 6bce316..1d4347a 100644 --- a/app/Http/Middleware/LogRequest.php +++ b/app/Http/Middleware/LogRequest.php @@ -12,9 +12,7 @@ class LogRequest /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next - * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse + * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 34029f7..5c4fba3 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -14,9 +14,8 @@ class RedirectIfAuthenticated * Handle an incoming request. * * @param Request $request Request. - * @param Closure(Request): (Response|RedirectResponse) $next Next. + * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next * @param string|null ...$guards Guards. - * @return Response|RedirectResponse */ public function handle(Request $request, Closure $next, string ...$guards): Response { diff --git a/app/Http/Middleware/UseSanctumGuard.php b/app/Http/Middleware/UseSanctumGuard.php index 3b00b9b..25979c2 100644 --- a/app/Http/Middleware/UseSanctumGuard.php +++ b/app/Http/Middleware/UseSanctumGuard.php @@ -12,9 +12,7 @@ class UseSanctumGuard /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next - * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse + * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/app/Http/Requests/BaseRequest.php b/app/Http/Requests/BaseRequest.php index 30f5992..be6c197 100644 --- a/app/Http/Requests/BaseRequest.php +++ b/app/Http/Requests/BaseRequest.php @@ -9,8 +9,6 @@ class BaseRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return boolean */ public function authorize(): bool { @@ -54,7 +52,6 @@ class BaseRequest extends FormRequest * * @param array $collection1 The first collection of rules. * @param array $collection2 The second collection of rules to merge. - * @return array */ private function mergeRules(array $collection1, array $collection2): array { diff --git a/app/Http/Requests/SubscriptionRequest.php b/app/Http/Requests/SubscriptionRequest.php index 7395fe8..387c14a 100644 --- a/app/Http/Requests/SubscriptionRequest.php +++ b/app/Http/Requests/SubscriptionRequest.php @@ -34,8 +34,6 @@ class SubscriptionRequest extends BaseRequest /** * Get the custom error messages. - * - * @return array */ public function messages(): array { diff --git a/app/Jobs/MoveMediaJob.php b/app/Jobs/MoveMediaJob.php index 9221cd7..9c33b57 100644 --- a/app/Jobs/MoveMediaJob.php +++ b/app/Jobs/MoveMediaJob.php @@ -48,8 +48,6 @@ class MoveMediaJob implements ShouldQueue /** * Execute the job. - * - * @return void */ public function handle(): void { diff --git a/app/Jobs/SendEmailJob.php b/app/Jobs/SendEmailJob.php index 89d7d1f..dcbe010 100644 --- a/app/Jobs/SendEmailJob.php +++ b/app/Jobs/SendEmailJob.php @@ -47,8 +47,6 @@ class SendEmailJob implements ShouldQueue /** * Execute the job. - * - * @return void */ public function handle(): void { diff --git a/app/Jobs/StoreUploadedFileJob.php b/app/Jobs/StoreUploadedFileJob.php index 632bab9..81862af 100644 --- a/app/Jobs/StoreUploadedFileJob.php +++ b/app/Jobs/StoreUploadedFileJob.php @@ -62,8 +62,6 @@ class StoreUploadedFileJob implements ShouldQueue /** * Execute the job. - * - * @return void */ public function handle(): void { diff --git a/app/Mail/ChangeEmailVerify.php b/app/Mail/ChangeEmailVerify.php index c56da17..0365ee5 100644 --- a/app/Mail/ChangeEmailVerify.php +++ b/app/Mail/ChangeEmailVerify.php @@ -54,8 +54,6 @@ class ChangeEmailVerify extends Mailable /** * Get the message envelope. - * - * @return \Illuminate\Mail\Mailables\Envelope */ public function envelope(): Envelope { @@ -66,8 +64,6 @@ class ChangeEmailVerify extends Mailable /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ public function content(): Content { diff --git a/app/Mail/ChangedEmail.php b/app/Mail/ChangedEmail.php index 7ef44fe..71dbe36 100644 --- a/app/Mail/ChangedEmail.php +++ b/app/Mail/ChangedEmail.php @@ -54,8 +54,6 @@ class ChangedEmail extends Mailable /** * Get the message envelope. - * - * @return \Illuminate\Mail\Mailables\Envelope */ public function envelope(): Envelope { @@ -66,8 +64,6 @@ class ChangedEmail extends Mailable /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ public function content(): Content { diff --git a/app/Mail/ChangedPassword.php b/app/Mail/ChangedPassword.php index 40ce216..00451c9 100644 --- a/app/Mail/ChangedPassword.php +++ b/app/Mail/ChangedPassword.php @@ -36,8 +36,6 @@ class ChangedPassword extends Mailable /** * Get the message envelope. - * - * @return \Illuminate\Mail\Mailables\Envelope */ public function envelope(): Envelope { @@ -48,8 +46,6 @@ class ChangedPassword extends Mailable /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ public function content(): Content { diff --git a/app/Mail/Contact.php b/app/Mail/Contact.php index 4c2f1da..cce5a36 100644 --- a/app/Mail/Contact.php +++ b/app/Mail/Contact.php @@ -53,8 +53,6 @@ class Contact extends Mailable /** * Get the message envelope. - * - * @return \Illuminate\Mail\Mailables\Envelope */ public function envelope(): Envelope { @@ -65,8 +63,6 @@ class Contact extends Mailable /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ public function content(): Content { diff --git a/app/Mail/EmailVerify.php b/app/Mail/EmailVerify.php index 8683405..e8b8097 100644 --- a/app/Mail/EmailVerify.php +++ b/app/Mail/EmailVerify.php @@ -45,8 +45,6 @@ class EmailVerify extends Mailable /** * Get the message envelope. - * - * @return \Illuminate\Mail\Mailables\Envelope */ public function envelope(): Envelope { @@ -57,8 +55,6 @@ class EmailVerify extends Mailable /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ public function content(): Content { diff --git a/app/Mail/ForgotPassword.php b/app/Mail/ForgotPassword.php index 43dbe45..52f5370 100644 --- a/app/Mail/ForgotPassword.php +++ b/app/Mail/ForgotPassword.php @@ -45,8 +45,6 @@ class ForgotPassword extends Mailable /** * Get the message envelope. - * - * @return \Illuminate\Mail\Mailables\Envelope */ public function envelope(): Envelope { @@ -57,8 +55,6 @@ class ForgotPassword extends Mailable /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ public function content(): Content { diff --git a/app/Mail/SubscriptionConfirm.php b/app/Mail/SubscriptionConfirm.php index c4aaf50..6a534ad 100644 --- a/app/Mail/SubscriptionConfirm.php +++ b/app/Mail/SubscriptionConfirm.php @@ -36,8 +36,6 @@ class SubscriptionConfirm extends Mailable /** * Get the message envelope. - * - * @return \Illuminate\Mail\Mailables\Envelope */ public function envelope(): Envelope { @@ -48,8 +46,6 @@ class SubscriptionConfirm extends Mailable /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ public function content(): Content { diff --git a/app/Mail/SubscriptionUnsubscribed.php b/app/Mail/SubscriptionUnsubscribed.php index faa865c..bef9bb4 100644 --- a/app/Mail/SubscriptionUnsubscribed.php +++ b/app/Mail/SubscriptionUnsubscribed.php @@ -36,8 +36,6 @@ class SubscriptionUnsubscribed extends Mailable /** * Get the message envelope. - * - * @return \Illuminate\Mail\Mailables\Envelope */ public function envelope(): Envelope { @@ -48,8 +46,6 @@ class SubscriptionUnsubscribed extends Mailable /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ public function content(): Content { diff --git a/app/Models/Analytics.php b/app/Models/Analytics.php index ff1dc26..988b181 100644 --- a/app/Models/Analytics.php +++ b/app/Models/Analytics.php @@ -22,7 +22,6 @@ class Analytics extends Model * automatically assigning a session value based on previous rows. * * @param array $attributes Model attributes. - * @return static */ public static function createWithSession(array $attributes): static { diff --git a/app/Models/Article.php b/app/Models/Article.php index 13b1eba..5d4f715 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -29,8 +29,6 @@ class Article extends Model /** * Get the article user - * - * @return BelongsTo */ public function user(): BelongsTo { @@ -39,8 +37,6 @@ class Article extends Model /** * Get all of the article's attachments. - * - * @return MorphMany */ public function attachments(): MorphMany { diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php index 52a9369..5a9eb1f 100644 --- a/app/Models/Attachment.php +++ b/app/Models/Attachment.php @@ -33,8 +33,6 @@ class Attachment extends Model /** * Get attachments attachable - * - * @return MorphTo */ public function attachable(): MorphTo { @@ -43,8 +41,6 @@ class Attachment extends Model /** * Get the media for this attachment. - * - * @return BelongsTo */ public function media(): BelongsTo { diff --git a/app/Models/Event.php b/app/Models/Event.php index 62e8c65..9d6d5a5 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -38,8 +38,6 @@ class Event extends Model /** * Get all of the article's attachments. - * - * @return MorphMany */ public function attachments(): MorphMany { @@ -48,8 +46,6 @@ class Event extends Model /** * Get all the associated users. - * - * @return BelongsToMany */ public function users(): BelongsToMany { diff --git a/app/Models/EventUsers.php b/app/Models/EventUsers.php index cc2a740..31a9d1f 100644 --- a/app/Models/EventUsers.php +++ b/app/Models/EventUsers.php @@ -24,8 +24,6 @@ class EventUser extends Model /** * Get the event for this attachment. - * - * @return BelongsTo */ public function event(): BelongsTo { @@ -34,8 +32,6 @@ class EventUser extends Model /** * Get the user for this attachment. - * - * @return BelongsTo */ public function user(): BelongsTo { diff --git a/app/Models/Media.php b/app/Models/Media.php index 33fc445..2ed7936 100644 --- a/app/Models/Media.php +++ b/app/Models/Media.php @@ -100,8 +100,6 @@ class Media extends Model /** * Model Boot - * - * @return void */ protected static function boot(): void { @@ -164,7 +162,6 @@ class Media extends Model * Variants Set Mutator. * * @param mixed $value The value to mutate. - * @return void */ public function setVariantsAttribute(mixed $value): void { @@ -256,8 +253,6 @@ class Media extends Model /** * Delete file and associated files with the modal. - * - * @return void */ public function deleteFile(): void { @@ -279,7 +274,6 @@ class Media extends Model /** * Invalidate Cloudflare Cache. * - * @return void * @throws InvalidArgumentException Exception. */ private function invalidateCFCache(): void @@ -311,8 +305,6 @@ class Media extends Model /** * Get URL path - * - * @return string */ public function getUrlPath(): string { @@ -322,8 +314,6 @@ class Media extends Model /** * Return the file URL - * - * @return string */ public function getUrlAttribute(): string { @@ -336,8 +326,6 @@ class Media extends Model /** * Return the file owner - * - * @return BelongsTo */ public function user(): BelongsTo { @@ -348,7 +336,6 @@ class Media extends Model * Move files to new storage device. * * @param string $storage The storage ID to move to. - * @return void */ public function moveToStorage(string $storage): void { @@ -494,8 +481,6 @@ class Media extends Model /** * Get the server maximum upload size - * - * @return integer */ public static function getMaxUploadSize(): int { @@ -620,7 +605,6 @@ class Media extends Model * Sanitize fileName for upload * * @param string $fileName Filename to sanitize. - * @return string */ private static function sanitizeFilename(string $fileName): string { diff --git a/app/Models/Permission.php b/app/Models/Permission.php index ef1c791..38f3f29 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -24,8 +24,6 @@ class Permission extends Model /** * Get the User associated with this model - * - * @return BelongsTo */ public function user(): BelongsTo { diff --git a/app/Models/User.php b/app/Models/User.php index ae029b3..3e8fe41 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -79,8 +79,6 @@ class User extends Authenticatable implements Auditable /** * Get the list of files of the user - * - * @return HasMany */ public function permissions(): HasMany { @@ -89,8 +87,6 @@ class User extends Authenticatable implements Auditable /** * Get the permission attribute - * - * @return array */ public function getPermissionsAttribute(): array { @@ -101,7 +97,6 @@ class User extends Authenticatable implements Auditable * Test if user has permission * * @param string $permission Permission to test. - * @return boolean */ public function hasPermission(string $permission): bool { @@ -112,7 +107,6 @@ class User extends Authenticatable implements Auditable * Give permissions to the user * * @param string|array $permissions The permission(s) to give. - * @return Collection */ public function givePermission($permissions): Collection { @@ -137,7 +131,6 @@ class User extends Authenticatable implements Auditable * Revoke permissions from the user * * @param string|array $permissions The permission(s) to revoke. - * @return integer */ public function revokePermission($permissions): int { @@ -152,8 +145,6 @@ class User extends Authenticatable implements Auditable /** * Get the list of files of the user - * - * @return HasMany */ public function media(): HasMany { @@ -162,8 +153,6 @@ class User extends Authenticatable implements Auditable /** * Get the list of files of the user - * - * @return HasMany */ public function articles(): HasMany { @@ -172,8 +161,6 @@ class User extends Authenticatable implements Auditable /** * Get associated user codes - * - * @return HasMany */ public function codes(): HasMany { @@ -182,8 +169,6 @@ class User extends Authenticatable implements Auditable /** * Get the list of logins of the user - * - * @return HasMany */ public function logins(): HasMany { @@ -192,8 +177,6 @@ class User extends Authenticatable implements Auditable /** * Get the events associated with the user. - * - * @return BelongsToMany */ public function events(): BelongsToMany { diff --git a/app/Models/UserCode.php b/app/Models/UserCode.php index e9b8599..aba1b38 100644 --- a/app/Models/UserCode.php +++ b/app/Models/UserCode.php @@ -23,8 +23,6 @@ class UserCode extends Model /** * Boot function from Laravel. - * - * @return void */ protected static function boot(): void { @@ -46,8 +44,6 @@ class UserCode extends Model /** * Generate new code - * - * @return void */ public function regenerate(): void { @@ -62,8 +58,6 @@ class UserCode extends Model /** * Clear expired user codes - * - * @return void */ public static function clearExpired(): void { @@ -72,8 +66,6 @@ class UserCode extends Model /** * Get associated user - * - * @return BelongsTo */ public function user(): BelongsTo { diff --git a/app/Models/UserLogins.php b/app/Models/UserLogins.php index 29fef9c..8b9a479 100644 --- a/app/Models/UserLogins.php +++ b/app/Models/UserLogins.php @@ -28,8 +28,6 @@ class UserLogins extends Model /** * Get the file user - * - * @return BelongsTo */ public function user(): BelongsTo { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 6478350..7c5628a 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -16,8 +16,6 @@ class AppServiceProvider extends ServiceProvider { /** * Register any application services. - * - * @return void */ public function register(): void { @@ -26,8 +24,6 @@ class AppServiceProvider extends ServiceProvider /** * Bootstrap any application services. - * - * @return void */ public function boot(): void { diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 1f84312..8e67de0 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -19,8 +19,6 @@ class AuthServiceProvider extends ServiceProvider /** * Register any authentication / authorization services. - * - * @return void */ public function boot(): void { diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 95217e4..f77570e 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -26,8 +26,6 @@ class EventServiceProvider extends ServiceProvider /** * Register any events for your application. - * - * @return void */ public function boot(): void { @@ -36,8 +34,6 @@ class EventServiceProvider extends ServiceProvider /** * Determine if events and listeners should be automatically discovered. - * - * @return boolean */ public function shouldDiscoverEvents(): bool { diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 8c77119..c255a5e 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -23,8 +23,6 @@ class RouteServiceProvider extends ServiceProvider /** * Define your route model bindings, pattern filters, and other route configuration. - * - * @return void */ public function boot(): void { diff --git a/app/Rules/Recaptcha.php b/app/Rules/Recaptcha.php index eb0f865..29a8030 100644 --- a/app/Rules/Recaptcha.php +++ b/app/Rules/Recaptcha.php @@ -22,7 +22,6 @@ class Recaptcha implements Rule * * @param mixed $attribute Attribute name. * @param mixed $value Attribute value. - * @return boolean */ public function passes(mixed $attribute, mixed $value): bool { @@ -42,8 +41,6 @@ class Recaptcha implements Rule /** * Get the validation error message. - * - * @return string */ public function message(): string { diff --git a/app/Rules/UniqueFileName.php b/app/Rules/UniqueFileName.php index 94785bf..823b37c 100644 --- a/app/Rules/UniqueFileName.php +++ b/app/Rules/UniqueFileName.php @@ -20,9 +20,7 @@ class UniqueFileName implements Rule /** * Determine if the validation rule passes. * - * @param string $attribute * @param mixed $value - * @return boolean */ public function passes(string $attribute, $value): bool { @@ -31,8 +29,6 @@ class UniqueFileName implements Rule /** * Get the validation error message. - * - * @return string */ public function message(): string { diff --git a/app/Rules/Uniqueish.php b/app/Rules/Uniqueish.php index 81c12ea..5dd9470 100644 --- a/app/Rules/Uniqueish.php +++ b/app/Rules/Uniqueish.php @@ -47,7 +47,6 @@ class Uniqueish implements Rule * Set the ID of the record to be ignored. * * @param mixed $id The ID to ignore. - * @return $this */ public function ignore(mixed $id): static { @@ -60,7 +59,6 @@ class Uniqueish implements Rule * * @param mixed $attribute Not used. * @param mixed $value The value to compare. - * @return boolean */ public function passes(mixed $attribute, mixed $value): bool { @@ -97,8 +95,6 @@ class Uniqueish implements Rule /** * Get the validation error message. - * - * @return string */ public function message(): string { diff --git a/app/Services/AnimatedGifService.php b/app/Services/AnimatedGifService.php index fecea69..cab5501 100644 --- a/app/Services/AnimatedGifService.php +++ b/app/Services/AnimatedGifService.php @@ -41,8 +41,6 @@ class AnimatedGifService * @param string $filenameOrBlob GIF filename path * @param integer $dataSize GIF blob size. * @param boolean $originalFrames Get original frames (with transparent background) - * - * @return array */ public function extract(string $filenameOrBlob, int $dataSize = 0, bool $originalFrames = false): array { @@ -275,8 +273,6 @@ class GifFrameExtractor /** * Parse the graphic extension of the frames (old: get_graphics_extension) - * - * @param integer $type */ private function parseGraphicsExtension(int $type) { @@ -303,8 +299,6 @@ class GifFrameExtractor /** * Get the full frame string block (old: get_image_block) - * - * @param integer $type */ private function getFrameString(int $type) { @@ -400,12 +394,6 @@ class GifFrameExtractor /** * Get the image data byte (old: get_imagedata_byte) - * - * @param string $type - * @param integer $start - * @param integer $length - * - * @return string */ private function getImageDataByte(string $type, int $start, int $length): string { @@ -419,13 +407,6 @@ class GifFrameExtractor /** * Get the image data bit (old: get_imagedata_bit) - * - * @param string $type - * @param integer $byteIndex - * @param integer $bitStart - * @param integer $bitLength - * - * @return number */ private function getImageDataBit(string $type, int $byteIndex, int $bitStart, int $bitLength): number { @@ -439,10 +420,6 @@ class GifFrameExtractor /** * Return the value of 2 ASCII chars (old: dualbyteval) - * - * @param string $s - * - * @return integer */ private function dualByteVal(string $s): int { @@ -453,8 +430,6 @@ class GifFrameExtractor /** * Read the data stream (old: read_data_stream) - * - * @param integer $firstLength */ private function readDataStream(int $firstLength) { @@ -471,8 +446,6 @@ class GifFrameExtractor /** * Open the gif file (old: loadfile) - * - * @param string $filename */ private function openFile(string $filename) { @@ -495,10 +468,6 @@ class GifFrameExtractor /** * Read the file from the beginning to $byteCount in binary (old: readbyte) - * - * @param integer $byteCount - * - * @return string */ private function readByte(int $byteCount): string { @@ -510,8 +479,6 @@ class GifFrameExtractor /** * Read a byte and return ASCII value (old: readbyte_int) - * - * @return integer */ private function readByteInt(): int { @@ -523,12 +490,6 @@ class GifFrameExtractor /** * Convert a $byte to decimal (old: readbits) - * - * @param string $byte - * @param integer $start - * @param integer $length - * - * @return number */ private function readBits(string $byte, int $start, int $length): number { @@ -540,8 +501,6 @@ class GifFrameExtractor /** * Rewind the file pointer reader (old: p_rewind) - * - * @param integer $length */ private function pointerRewind(int $length) { @@ -551,8 +510,6 @@ class GifFrameExtractor /** * Forward the file pointer reader (old: p_forward) - * - * @param integer $length */ private function pointerForward(int $length) { @@ -562,11 +519,6 @@ class GifFrameExtractor /** * Get a section of the data from $start to $start + $length (old: datapart) - * - * @param integer $start - * @param integer $length - * - * @return string */ private function dataPart(int $start, int $length): string { @@ -579,10 +531,6 @@ class GifFrameExtractor /** * Check if a character if a byte (old: checkbyte) - * - * @param integer $byte - * - * @return boolean */ private function checkByte(int $byte): bool { @@ -598,8 +546,6 @@ class GifFrameExtractor /** * Check the end of the file (old: checkEOF) - * - * @return boolean */ private function checkEOF(): bool { @@ -628,8 +574,6 @@ class GifFrameExtractor /** * Get the total of all added frame duration - * - * @return integer */ public function getTotalDuration(): int { @@ -638,8 +582,6 @@ class GifFrameExtractor /** * Get the number of extracted frames - * - * @return integer */ public function getFrameNumber(): int { @@ -648,8 +590,6 @@ class GifFrameExtractor /** * Get the extracted frames (images and durations) - * - * @return array */ public function getFrames(): array { @@ -658,8 +598,6 @@ class GifFrameExtractor /** * Get the extracted frame positions - * - * @return array */ public function getFramePositions(): array { @@ -668,8 +606,6 @@ class GifFrameExtractor /** * Get the extracted frame dimensions - * - * @return array */ public function getFrameDimensions(): array { @@ -678,8 +614,6 @@ class GifFrameExtractor /** * Get the extracted frame images - * - * @return array */ public function getFrameImages(): array { @@ -688,8 +622,6 @@ class GifFrameExtractor /** * Get the extracted frame durations - * - * @return array */ public function getFrameDurations(): array { diff --git a/app/Traits/Uuids.php b/app/Traits/Uuids.php index a5053ee..64524f0 100644 --- a/app/Traits/Uuids.php +++ b/app/Traits/Uuids.php @@ -8,8 +8,6 @@ trait Uuids { /** * Boot function from Laravel. - * - * @return void */ protected static function bootUuids(): void { @@ -22,8 +20,6 @@ trait Uuids /** * Get the value indicating whether the IDs are incrementing. - * - * @return boolean */ public function getIncrementing(): bool { @@ -32,8 +28,6 @@ trait Uuids /** * Get the auto-incrementing key type. - * - * @return string */ public function getKeyType(): string { diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 9c0da55..c874bda 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -39,8 +39,6 @@ class UserFactory extends Factory /** * Indicate that the model's email address should be unverified. - * - * @return static */ public function unverified(): static { diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 2701125..53656a4 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -30,8 +28,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index b4d45de..4f42fe6 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -22,8 +20,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index db96e7d..249da81 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -26,8 +24,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php index c134bc5..29db28a 100644 --- a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -27,8 +25,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2022_12_28_113117_create_posts_table.php b/database/migrations/2022_12_28_113117_create_posts_table.php index f4fbc61..8c3a230 100644 --- a/database/migrations/2022_12_28_113117_create_posts_table.php +++ b/database/migrations/2022_12_28_113117_create_posts_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -27,8 +25,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2022_12_30_105153_create_media_table.php b/database/migrations/2022_12_30_105153_create_media_table.php index 711cf66..7f9209c 100644 --- a/database/migrations/2022_12_30_105153_create_media_table.php +++ b/database/migrations/2022_12_30_105153_create_media_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -27,8 +25,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2022_12_30_110049_create_permissions_table.php b/database/migrations/2022_12_30_110049_create_permissions_table.php index e074e4d..5977404 100644 --- a/database/migrations/2022_12_30_110049_create_permissions_table.php +++ b/database/migrations/2022_12_30_110049_create_permissions_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -25,8 +23,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_01_01_103251_create_events_table.php b/database/migrations/2023_01_01_103251_create_events_table.php index 467874d..211be9c 100644 --- a/database/migrations/2023_01_01_103251_create_events_table.php +++ b/database/migrations/2023_01_01_103251_create_events_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -32,8 +30,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_01_021_050482_create_subscriptions_table.php b/database/migrations/2023_01_021_050482_create_subscriptions_table.php index 656e15f..635ff85 100644 --- a/database/migrations/2023_01_021_050482_create_subscriptions_table.php +++ b/database/migrations/2023_01_021_050482_create_subscriptions_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -23,8 +21,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_01_05_043106_create_jobs_table.php b/database/migrations/2023_01_05_043106_create_jobs_table.php index 560ae54..6098d9b 100644 --- a/database/migrations/2023_01_05_043106_create_jobs_table.php +++ b/database/migrations/2023_01_05_043106_create_jobs_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -26,8 +24,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_01_05_112154_create_user_codes_table.php b/database/migrations/2023_01_05_112154_create_user_codes_table.php index d130b2f..dfae89e 100644 --- a/database/migrations/2023_01_05_112154_create_user_codes_table.php +++ b/database/migrations/2023_01_05_112154_create_user_codes_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -27,8 +25,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_01_08_045958_create_audits_table.php b/database/migrations/2023_01_08_045958_create_audits_table.php index e363a3c..42669aa 100644 --- a/database/migrations/2023_01_08_045958_create_audits_table.php +++ b/database/migrations/2023_01_08_045958_create_audits_table.php @@ -9,8 +9,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -37,8 +35,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_01_08_050847_create_user_logins_table.php b/database/migrations/2023_01_08_050847_create_user_logins_table.php index e97f025..3752181 100644 --- a/database/migrations/2023_01_08_050847_create_user_logins_table.php +++ b/database/migrations/2023_01_08_050847_create_user_logins_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -29,8 +27,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_01_24_080416_create_analytics_table.php b/database/migrations/2023_01_24_080416_create_analytics_table.php index df4d332..3c5bb9a 100644 --- a/database/migrations/2023_01_24_080416_create_analytics_table.php +++ b/database/migrations/2023_01_24_080416_create_analytics_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -25,8 +23,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_02_24_023054_create_attachments_table.php b/database/migrations/2023_02_24_023054_create_attachments_table.php index 9bd6648..54b8441 100644 --- a/database/migrations/2023_02_24_023054_create_attachments_table.php +++ b/database/migrations/2023_02_24_023054_create_attachments_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -25,8 +23,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_02_28_090609_add_price_to_events_table.php b/database/migrations/2023_02_28_090609_add_price_to_events_table.php index 31df4e7..5fdc902 100644 --- a/database/migrations/2023_02_28_090609_add_price_to_events_table.php +++ b/database/migrations/2023_02_28_090609_add_price_to_events_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -20,8 +18,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_03_01_075334_add_ages_to_events_table.php b/database/migrations/2023_03_01_075334_add_ages_to_events_table.php index 133a5dd..22f0ceb 100644 --- a/database/migrations/2023_03_01_075334_add_ages_to_events_table.php +++ b/database/migrations/2023_03_01_075334_add_ages_to_events_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -20,8 +18,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_04_05_222458_update_media_table.php b/database/migrations/2023_04_05_222458_update_media_table.php index a836d2a..9a7ee94 100644 --- a/database/migrations/2023_04_05_222458_update_media_table.php +++ b/database/migrations/2023_04_05_222458_update_media_table.php @@ -9,8 +9,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -37,8 +35,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_04_18_111723_update_no_nullable_phone_on_users_table.php b/database/migrations/2023_04_18_111723_update_no_nullable_phone_on_users_table.php index bd2c47c..67d11ce 100644 --- a/database/migrations/2023_04_18_111723_update_no_nullable_phone_on_users_table.php +++ b/database/migrations/2023_04_18_111723_update_no_nullable_phone_on_users_table.php @@ -9,8 +9,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -23,8 +21,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_04_18_113354_add_display_name_to_users_table.php b/database/migrations/2023_04_18_113354_add_display_name_to_users_table.php index 4fcb54d..da2d613 100644 --- a/database/migrations/2023_04_18_113354_add_display_name_to_users_table.php +++ b/database/migrations/2023_04_18_113354_add_display_name_to_users_table.php @@ -9,8 +9,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -28,8 +26,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_04_19_122711_drop_subscriptions_table.php b/database/migrations/2023_04_19_122711_drop_subscriptions_table.php index 118dcd6..0ca3633 100644 --- a/database/migrations/2023_04_19_122711_drop_subscriptions_table.php +++ b/database/migrations/2023_04_19_122711_drop_subscriptions_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -18,8 +16,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_04_25_235615_update_posts_table.php b/database/migrations/2023_04_25_235615_update_posts_table.php index 7effe66..aac9dd7 100644 --- a/database/migrations/2023_04_25_235615_update_posts_table.php +++ b/database/migrations/2023_04_25_235615_update_posts_table.php @@ -9,8 +9,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -22,8 +20,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_05_01_045630_update_analytics_table.php b/database/migrations/2023_05_01_045630_update_analytics_table.php index d8a012d..cfcd5d7 100644 --- a/database/migrations/2023_05_01_045630_update_analytics_table.php +++ b/database/migrations/2023_05_01_045630_update_analytics_table.php @@ -9,8 +9,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -97,8 +95,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_05_04_071954_remove_username_from_users_table.php b/database/migrations/2023_05_04_071954_remove_username_from_users_table.php index 1381580..aa0df58 100644 --- a/database/migrations/2023_05_04_071954_remove_username_from_users_table.php +++ b/database/migrations/2023_05_04_071954_remove_username_from_users_table.php @@ -9,8 +9,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -21,8 +19,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_05_06_080418_create_shortlinks_table.php b/database/migrations/2023_05_06_080418_create_shortlinks_table.php index d101e1b..7c6f3fd 100644 --- a/database/migrations/2023_05_06_080418_create_shortlinks_table.php +++ b/database/migrations/2023_05_06_080418_create_shortlinks_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -23,8 +21,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_05_06_082705_add_counter_to_shortlinks_table.php b/database/migrations/2023_05_06_082705_add_counter_to_shortlinks_table.php index 28f0f0f..25cdb7a 100644 --- a/database/migrations/2023_05_06_082705_add_counter_to_shortlinks_table.php +++ b/database/migrations/2023_05_06_082705_add_counter_to_shortlinks_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -20,8 +18,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_05_08_021929_update_users_table.php b/database/migrations/2023_05_08_021929_update_users_table.php index f21cca7..497de63 100644 --- a/database/migrations/2023_05_08_021929_update_users_table.php +++ b/database/migrations/2023_05_08_021929_update_users_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -21,8 +19,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_05_09_003156_add_location_url_to_events.php b/database/migrations/2023_05_09_003156_add_location_url_to_events.php index af93923..e33f9e8 100644 --- a/database/migrations/2023_05_09_003156_add_location_url_to_events.php +++ b/database/migrations/2023_05_09_003156_add_location_url_to_events.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -20,8 +18,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_05_11_032859_add_private_to_attachments_table.php b/database/migrations/2023_05_11_032859_add_private_to_attachments_table.php index aa24e77..2efac94 100644 --- a/database/migrations/2023_05_11_032859_add_private_to_attachments_table.php +++ b/database/migrations/2023_05_11_032859_add_private_to_attachments_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -20,8 +18,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_05_11_033621_create_event_users_table.php b/database/migrations/2023_05_11_033621_create_event_users_table.php index e4a4702..ab3cdbd 100644 --- a/database/migrations/2023_05_11_033621_create_event_users_table.php +++ b/database/migrations/2023_05_11_033621_create_event_users_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -26,8 +24,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_05_24_000000_rename_password_resets_table.php b/database/migrations/2023_05_24_000000_rename_password_resets_table.php index ab300e6..f0ad375 100644 --- a/database/migrations/2023_05_24_000000_rename_password_resets_table.php +++ b/database/migrations/2023_05_24_000000_rename_password_resets_table.php @@ -8,8 +8,6 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ public function up(): void { @@ -18,8 +16,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 230545b..d3eee24 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -12,8 +12,6 @@ class DatabaseSeeder extends Seeder { /** * Seed the application's database. - * - * @return void */ public function run(): void { diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index d809638..5773b0c 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -8,8 +8,6 @@ class ExampleTest extends TestCase { /** * A basic test example. - * - * @return void */ public function test_that_true_is_true(): void { -- 2.49.1 From fbf437ac992ad347b073f665e09afaf1779a77d2 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 24 May 2023 21:33:19 +0000 Subject: [PATCH 16/16] Shift cleanup --- app/Http/Kernel.php | 2 +- app/Http/Middleware/LogRequest.php | 2 +- app/Http/Middleware/RedirectIfAuthenticated.php | 6 +++--- app/Http/Middleware/UseSanctumGuard.php | 2 +- app/Rules/UniqueFileName.php | 2 +- config/broadcasting.php | 2 +- config/cache.php | 2 +- config/database.php | 2 +- config/filesystems.php | 2 +- config/logging.php | 2 +- tests/CreatesApplication.php | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index ca0a07b..3031207 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -40,7 +40,7 @@ class Kernel extends HttpKernel 'api' => [ // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, - \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', + \Illuminate\Routing\Middleware\ThrottleRequests::class . ':api', \Illuminate\Routing\Middleware\SubstituteBindings::class, // \App\Http\Middleware\ForceJsonResponse::class, 'useSanctumGuard', diff --git a/app/Http/Middleware/LogRequest.php b/app/Http/Middleware/LogRequest.php index 1d4347a..fdd5642 100644 --- a/app/Http/Middleware/LogRequest.php +++ b/app/Http/Middleware/LogRequest.php @@ -12,7 +12,7 @@ class LogRequest /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next + * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 5c4fba3..ddefde7 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -13,9 +13,9 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param Request $request Request. - * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next - * @param string|null ...$guards Guards. + * @param Request $request Request. + * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next + * @param string|null ...$guards Guards. */ public function handle(Request $request, Closure $next, string ...$guards): Response { diff --git a/app/Http/Middleware/UseSanctumGuard.php b/app/Http/Middleware/UseSanctumGuard.php index 25979c2..f7abf14 100644 --- a/app/Http/Middleware/UseSanctumGuard.php +++ b/app/Http/Middleware/UseSanctumGuard.php @@ -12,7 +12,7 @@ class UseSanctumGuard /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next + * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/app/Rules/UniqueFileName.php b/app/Rules/UniqueFileName.php index 823b37c..c04c388 100644 --- a/app/Rules/UniqueFileName.php +++ b/app/Rules/UniqueFileName.php @@ -20,7 +20,7 @@ class UniqueFileName implements Rule /** * Determine if the validation rule passes. * - * @param mixed $value + * @param mixed $value */ public function passes(string $attribute, $value): bool { diff --git a/config/broadcasting.php b/config/broadcasting.php index 9e4d4aa..4dbd22c 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -36,7 +36,7 @@ return [ 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ - 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', + 'host' => env('PUSHER_HOST') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com', 'port' => env('PUSHER_PORT', 443), 'scheme' => env('PUSHER_SCHEME', 'https'), 'encrypted' => true, diff --git a/config/cache.php b/config/cache.php index 33bb295..daf5e68 100644 --- a/config/cache.php +++ b/config/cache.php @@ -105,6 +105,6 @@ return [ | */ - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'), ]; diff --git a/config/database.php b/config/database.php index 137ad18..535cd52 100644 --- a/config/database.php +++ b/config/database.php @@ -125,7 +125,7 @@ return [ 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), ], 'default' => [ diff --git a/config/filesystems.php b/config/filesystems.php index ca2df13..5756647 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -73,7 +73,7 @@ return [ 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', 'throw' => false, ], diff --git a/config/logging.php b/config/logging.php index c44d276..d000835 100644 --- a/config/logging.php +++ b/config/logging.php @@ -89,7 +89,7 @@ return [ 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), - 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), + 'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'), ], 'processors' => [PsrLogMessageProcessor::class], ], diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index cc68301..e3ad27e 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -12,7 +12,7 @@ trait CreatesApplication */ public function createApplication(): Application { - $app = require __DIR__.'/../bootstrap/app.php'; + $app = require __DIR__ . '/../bootstrap/app.php'; $app->make(Kernel::class)->bootstrap(); -- 2.49.1