From ded4144295ce04b8eb00526ee93aa256b44ad169 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 23 Oct 2022 09:48:13 +0000 Subject: [PATCH] Apply fixes from StyleCI [ci skip] [skip ci] --- .../Admin/ManagePostsController.php | 9 +++---- src/Controllers/BlogEtcAdminController.php | 1 + .../BlogEtcCategoryAdminController.php | 1 + .../BlogEtcCommentWriterController.php | 1 + .../BlogEtcCommentsAdminController.php | 1 + .../BlogEtcImageUploadController.php | 1 + src/Controllers/BlogEtcReaderController.php | 1 + src/Controllers/BlogEtcRssFeedController.php | 1 + src/Controllers/FeedController.php | 1 - src/Controllers/PostsController.php | 6 ++--- src/Events/UploadedImage.php | 2 +- .../LegacyGetImageFileInterface.php | 1 + src/Models/BlogEtcCategory.php | 1 + src/Models/BlogEtcComment.php | 1 + src/Models/BlogEtcPost.php | 1 + src/Models/BlogEtcUploadedPhoto.php | 1 + src/Models/Post.php | 14 +++++------ src/Repositories/PostsRepository.php | 4 +-- src/Requests/Traits/HasImageUploadTrait.php | 1 - src/Services/PostsService.php | 6 ++--- src/Services/UploadsService.php | 25 ++++++++----------- tests/TestCase.php | 6 ++--- 22 files changed, 44 insertions(+), 42 deletions(-) diff --git a/src/Controllers/Admin/ManagePostsController.php b/src/Controllers/Admin/ManagePostsController.php index 7b08f0e..fbfb7ea 100644 --- a/src/Controllers/Admin/ManagePostsController.php +++ b/src/Controllers/Admin/ManagePostsController.php @@ -73,9 +73,9 @@ public function create_post() /** * Save a new post. * - * @throws Exception - * * @return RedirectResponse|Redirector + * + * @throws Exception */ public function store(CreateBlogEtcPostRequest $request) { @@ -96,7 +96,6 @@ public function store_post(CreateBlogEtcPostRequest $request) * Show form to edit post. * * @param $blogPostId - * * @return mixed */ public function edit($blogPostId) @@ -120,10 +119,9 @@ public function edit_post($blogPostId) * This uses some legacy code. This will get refactored soon into something nicer. * * @param $blogPostId + * @return RedirectResponse|Redirector * * @throws Exception - * - * @return RedirectResponse|Redirector */ public function update(UpdateBlogEtcPostRequest $request, $blogPostId) { @@ -144,7 +142,6 @@ public function update_post(UpdateBlogEtcPostRequest $request, $blogPostId) * Delete a post. * * @param $blogPostId - * * @return mixed */ public function destroy(DeleteBlogEtcPostRequest $request, $blogPostId) diff --git a/src/Controllers/BlogEtcAdminController.php b/src/Controllers/BlogEtcAdminController.php index c2a264f..341cdfd 100755 --- a/src/Controllers/BlogEtcAdminController.php +++ b/src/Controllers/BlogEtcAdminController.php @@ -6,6 +6,7 @@ /** * For backwards compatibility only. + * * @deprecated - use ManagePostsController */ class BlogEtcAdminController extends ManagePostsController diff --git a/src/Controllers/BlogEtcCategoryAdminController.php b/src/Controllers/BlogEtcCategoryAdminController.php index 2021481..74a0242 100755 --- a/src/Controllers/BlogEtcCategoryAdminController.php +++ b/src/Controllers/BlogEtcCategoryAdminController.php @@ -6,6 +6,7 @@ /** * For backwards compatibility only. + * * @deprecated - use ManageCategoriesController */ class BlogEtcCategoryAdminController extends ManageCategoriesController diff --git a/src/Controllers/BlogEtcCommentWriterController.php b/src/Controllers/BlogEtcCommentWriterController.php index 597dfb2..98ac7b8 100755 --- a/src/Controllers/BlogEtcCommentWriterController.php +++ b/src/Controllers/BlogEtcCommentWriterController.php @@ -4,6 +4,7 @@ /** * For backwards compatibility only. + * * @deprecated - use CommentsController instead */ class BlogEtcCommentWriterController extends CommentsController diff --git a/src/Controllers/BlogEtcCommentsAdminController.php b/src/Controllers/BlogEtcCommentsAdminController.php index 0efaf1f..43bd91d 100755 --- a/src/Controllers/BlogEtcCommentsAdminController.php +++ b/src/Controllers/BlogEtcCommentsAdminController.php @@ -6,6 +6,7 @@ /** * For backwards compatibility only. + * * @deprecated - use ManageCommentsController */ class BlogEtcCommentsAdminController extends ManageCommentsController diff --git a/src/Controllers/BlogEtcImageUploadController.php b/src/Controllers/BlogEtcImageUploadController.php index 70df200..2a8b388 100755 --- a/src/Controllers/BlogEtcImageUploadController.php +++ b/src/Controllers/BlogEtcImageUploadController.php @@ -6,6 +6,7 @@ /** * For backwards compatibility only. + * * @deprecated - use ManageUploadsController */ class BlogEtcImageUploadController extends ManageUploadsController diff --git a/src/Controllers/BlogEtcReaderController.php b/src/Controllers/BlogEtcReaderController.php index 8648774..973168a 100755 --- a/src/Controllers/BlogEtcReaderController.php +++ b/src/Controllers/BlogEtcReaderController.php @@ -4,6 +4,7 @@ /** * For backwards compatibility only. + * * @deprecated - use PostsController instead */ class BlogEtcReaderController extends PostsController diff --git a/src/Controllers/BlogEtcRssFeedController.php b/src/Controllers/BlogEtcRssFeedController.php index 9e37f66..8d0c07d 100755 --- a/src/Controllers/BlogEtcRssFeedController.php +++ b/src/Controllers/BlogEtcRssFeedController.php @@ -4,6 +4,7 @@ /** * Legacy class for backwards compatibility. + * * @deprecated - use FeedController instead */ class BlogEtcRssFeedController extends FeedController diff --git a/src/Controllers/FeedController.php b/src/Controllers/FeedController.php index 450e8c8..45fbf83 100755 --- a/src/Controllers/FeedController.php +++ b/src/Controllers/FeedController.php @@ -65,7 +65,6 @@ protected function makeFreshFeed(Feed $feed) /** * @param $posts - * * @return mixed */ protected function setupFeed(Feed $feed, $posts) diff --git a/src/Controllers/PostsController.php b/src/Controllers/PostsController.php index c5a2cf6..673b23a 100755 --- a/src/Controllers/PostsController.php +++ b/src/Controllers/PostsController.php @@ -52,7 +52,8 @@ public function search(SearchRequest $request): \Illuminate\Contracts\View\View // Map it so the post is actually accessible with ->indexable, for backwards compatibility in old view files. $searchResultsMappedWithIndexable = $searchResults->map(function (Post $post) { - return new class($post) { + return new class($post) + { public $indexable; public function __construct(Post $post) @@ -89,8 +90,7 @@ public function showCategory($categorySlug): \Illuminate\Contracts\View\View * Show blog posts * If $categorySlug is set, then only show from that category. * - * @param string $categorySlug - * + * @param string $categorySlug * @return mixed */ public function index(string $categorySlug = null) diff --git a/src/Events/UploadedImage.php b/src/Events/UploadedImage.php index fd898fd..6f6fde3 100644 --- a/src/Events/UploadedImage.php +++ b/src/Events/UploadedImage.php @@ -26,7 +26,7 @@ class UploadedImage * UploadedImage constructor. * * @param $image_filename - the new filename - * @param Post $blogEtcPost + * @param Post $blogEtcPost * @param $image * @param $source string|null the __METHOD__ firing this event (or other string) */ diff --git a/src/Interfaces/LegacyGetImageFileInterface.php b/src/Interfaces/LegacyGetImageFileInterface.php index 4c736e9..df935f9 100644 --- a/src/Interfaces/LegacyGetImageFileInterface.php +++ b/src/Interfaces/LegacyGetImageFileInterface.php @@ -6,6 +6,7 @@ interface LegacyGetImageFileInterface { /** * legacy. + * * @param $size * @return mixed */ diff --git a/src/Models/BlogEtcCategory.php b/src/Models/BlogEtcCategory.php index 5f39974..6dc046f 100755 --- a/src/Models/BlogEtcCategory.php +++ b/src/Models/BlogEtcCategory.php @@ -4,6 +4,7 @@ /** * Legacy class for backwards compatibility. + * * @deprecated */ class BlogEtcCategory extends Category diff --git a/src/Models/BlogEtcComment.php b/src/Models/BlogEtcComment.php index c41912c..9e164a7 100755 --- a/src/Models/BlogEtcComment.php +++ b/src/Models/BlogEtcComment.php @@ -4,6 +4,7 @@ /** * Legacy class for backwards compatibility. + * * @deprecated */ class BlogEtcComment extends Comment diff --git a/src/Models/BlogEtcPost.php b/src/Models/BlogEtcPost.php index f8c007c..2b11bd5 100755 --- a/src/Models/BlogEtcPost.php +++ b/src/Models/BlogEtcPost.php @@ -4,6 +4,7 @@ /** * Legacy class name for backwards compatibility. + * * @deprecated */ class BlogEtcPost extends Post diff --git a/src/Models/BlogEtcUploadedPhoto.php b/src/Models/BlogEtcUploadedPhoto.php index 8025953..7b70064 100644 --- a/src/Models/BlogEtcUploadedPhoto.php +++ b/src/Models/BlogEtcUploadedPhoto.php @@ -4,6 +4,7 @@ /** * legacy class for backwards compatibility. + * * @deprecated */ class BlogEtcUploadedPhoto extends UploadedPhoto diff --git a/src/Models/Post.php b/src/Models/Post.php index 96e25a7..3e3ec4b 100755 --- a/src/Models/Post.php +++ b/src/Models/Post.php @@ -160,7 +160,7 @@ public function genSeoTitle(): ?string } /** - * @param mixed ...$args + * @param mixed ...$args * * @deprecated - use imageTag() instead */ @@ -177,10 +177,10 @@ public function image_tag($size = 'medium', * * TODO - return HtmlString * - * @param string $size - large, medium, thumbnail - * @param bool $addAHref - if true then it will add ... around the tag - * @param string|null $imgTagClass - if you want any additional CSS classes for this tag for the - * @param string|null $anchorTagClass - is you want any additional CSS classes in the anchor tag + * @param string $size - large, medium, thumbnail + * @param bool $addAHref - if true then it will add ... around the tag + * @param string|null $imgTagClass - if you want any additional CSS classes for this tag for the + * @param string|null $anchorTagClass - is you want any additional CSS classes in the anchor tag */ public function imageTag( $size = 'medium', @@ -205,7 +205,7 @@ public function imageTag( * Returns true if the database record indicates that this blog post * has a featured image of size $size. * - * @param string $size + * @param string $size */ public function hasImage($size = 'medium'): bool { @@ -233,7 +233,7 @@ protected function checkValidImageSize(string $size = 'medium'): bool * Get the full URL for an image * You should use ::has_image($size) to check if the size is valid. * - * @param string $size - should be 'medium' , 'large' or 'thumbnail' + * @param string $size - should be 'medium' , 'large' or 'thumbnail' */ public function imageUrl($size = 'medium'): string { diff --git a/src/Repositories/PostsRepository.php b/src/Repositories/PostsRepository.php index 37dd4c6..1b7964b 100644 --- a/src/Repositories/PostsRepository.php +++ b/src/Repositories/PostsRepository.php @@ -31,7 +31,7 @@ public function __construct(Post $model) /** * Return blog posts ordered by posted_at, paginated. * - * @param int $categoryID + * @param int $categoryID */ public function indexPaginated(int $perPage = 10, int $categoryID = null): LengthAwarePaginator { @@ -147,7 +147,7 @@ public function find(int $blogEtcPostID): Post * * TODO - currently untested. * - * @param array $uploadedImages + * @param array $uploadedImages */ public function updateImageSizes(Post $post, ?array $uploadedImages): Post { diff --git a/src/Requests/Traits/HasImageUploadTrait.php b/src/Requests/Traits/HasImageUploadTrait.php index 5e0d0a1..84728d7 100755 --- a/src/Requests/Traits/HasImageUploadTrait.php +++ b/src/Requests/Traits/HasImageUploadTrait.php @@ -8,7 +8,6 @@ trait HasImageUploadTrait { /** * @param $size - * * @return UploadedFile|null */ public function get_image_file($size) diff --git a/src/Services/PostsService.php b/src/Services/PostsService.php index 8fe71e1..e1a890c 100644 --- a/src/Services/PostsService.php +++ b/src/Services/PostsService.php @@ -83,7 +83,7 @@ public function repository(): PostsRepository /** * Return all results, paginated. * - * @param int $perPage + * @param int $perPage */ public function indexPaginated($perPage = 10, int $categoryID = null): LengthAwarePaginator { @@ -133,9 +133,9 @@ public function update(/** @scrutinizer ignore-unused */ int $blogPostID, /*Post * Delete a blog etc post, return the deleted post and an array of featured images which were associated * to the blog post (but which were not deleted form the filesystem). * - * @throws Exception - * * @return array - [Post (deleted post), array (remaining featured photos) + * + * @throws Exception */ public function delete(int $postID): array { diff --git a/src/Services/UploadsService.php b/src/Services/UploadsService.php index 6508066..cd2af85 100644 --- a/src/Services/UploadsService.php +++ b/src/Services/UploadsService.php @@ -98,10 +98,10 @@ public function legacyUpdatePost(UpdateBlogEtcPostRequest $request, $blogPostId) * * Process any uploaded images (for featured image). * - * @throws Exception - * * @return array returns an array of details about each file resized * + * @throws Exception + * * @todo - This class was added after the other main features, so this duplicates some code from the main blog post admin controller (BlogEtcAdminController). For next full release this should be tided up. */ public function legacyProcessUploadedImagesSingle(UploadImageRequest $request) @@ -177,14 +177,13 @@ public function legacyProcessUploadedImages(LegacyGetImageFileInterface $request } /** - * @param Post $new_blog_post + * @param Post $new_blog_post * @param $suggested_title string - used to help generate the filename * @param $image_size_details mixed - either an array (with 'w' and 'h') or a string (and it'll be uploaded at full size, no size reduction, but will use this string to generate the filename) * @param $photo + * @return array * * @throws Exception - * - * @return array */ protected function legacyUploadAndResize(Post $new_blog_post = null, $suggested_title, $image_size_details, $photo) { @@ -223,9 +222,9 @@ protected function legacyUploadAndResize(Post $new_blog_post = null, $suggested_ } /** - * @throws RuntimeException - * * @return string + * + * @throws RuntimeException */ public function image_destination_path() { @@ -258,10 +257,9 @@ protected function check_image_destination_path_is_writable($path) * Todo: support multiple filesystem locations. * * @param $image_size_details - either an array (with w/h attributes) or a string + * @return string * * @throws RuntimeException - * - * @return string */ public function legacyGetImageFilename(string $suggested_title, $image_size_details, UploadedFile $photo) { @@ -381,10 +379,10 @@ public function increaseMemoryLimit(): void /** * Resize and store an image. * - * @param Post $new_blog_post + * @param Post $new_blog_post * @param $suggested_title - used to help generate the filename - * @param array|string $imageSizeDetails - either an array (with 'w' and 'h') or a string (and it'll be uploaded at full size, - * no size reduction, but will use this string to generate the filename) + * @param array|string $imageSizeDetails - either an array (with 'w' and 'h') or a string (and it'll be uploaded at full size, + * no size reduction, but will use this string to generate the filename) * @param $photo * * @throws Exception @@ -491,7 +489,7 @@ protected function baseFilename(string $suggestedTitle): string * If a string is given: * getWhForFilename("some string") it will return -some-string". (max len: 30) * - * @param array|string $imageSize + * @param array|string $imageSize * * @throws RuntimeException */ @@ -606,7 +604,6 @@ protected function storeInDatabase( * Legacy function, will be refactored soon. * * @param $blogPostId - * * @return mixed */ public function legacyDestroyPost(/* @scrutinizer ignore-unused */ DeleteBlogEtcPostRequest $request, $blogPostId) diff --git a/tests/TestCase.php b/tests/TestCase.php index ff45d96..c847d38 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -102,8 +102,7 @@ protected function mockView(string $expectedView, array $viewArgumentTypes): voi /** * Used for Orchestra\Testbench package. * - * @param Application $app - * + * @param Application $app * @return array */ protected function getPackageProviders($app) @@ -181,8 +180,7 @@ protected function loadMigrations(): void /** * Define environment setup. * - * @param Application $app - * + * @param Application $app * @return void */ protected function getEnvironmentSetUp($app)