diff --git a/Api/AuthorCollectionInterface.php b/Api/AuthorCollectionInterface.php index c500f5d4..8016a0e1 100755 --- a/Api/AuthorCollectionInterface.php +++ b/Api/AuthorCollectionInterface.php @@ -1,11 +1,13 @@ _rendererTypes['author'] = \Magefan\Blog\Block\Adminhtml\Grid\Column\Render\Author::class; diff --git a/Block/Adminhtml/Grid/Column/Categories.php b/Block/Adminhtml/Grid/Column/Categories.php index d61aa0fd..796b23bb 100755 --- a/Block/Adminhtml/Grid/Column/Categories.php +++ b/Block/Adminhtml/Grid/Column/Categories.php @@ -1,11 +1,13 @@ _rendererTypes['category'] = \Magefan\Blog\Block\Adminhtml\Grid\Column\Render\Category::class; diff --git a/Block/Adminhtml/Grid/Column/Filter/Author.php b/Block/Adminhtml/Grid/Column/Filter/Author.php index 0a56ed8b..01561dca 100644 --- a/Block/Adminhtml/Grid/Column/Filter/Author.php +++ b/Block/Adminhtml/Grid/Column/Filter/Author.php @@ -1,11 +1,13 @@ getIsActive() || $row->getStatus()) { if ($row->getStatus() == 2) { diff --git a/Block/Adminhtml/Import/Form.php b/Block/Adminhtml/Import/Form.php index eee2d733..5b06041a 100644 --- a/Block/Adminhtml/Import/Form.php +++ b/Block/Adminhtml/Import/Form.php @@ -1,11 +1,13 @@ registry = $registry; $this->form = $form; @@ -88,7 +90,7 @@ public function getElementHtml() * * @return array|null */ - public function getImages() + public function getImages(): array { $result = []; $gallery = $this->registry->registry('current_model')->getGalleryImages(); diff --git a/Block/Adminhtml/Post/Helper/Form/Gallery/Content.php b/Block/Adminhtml/Post/Helper/Form/Gallery/Content.php index 94c770b4..2f2d37ce 100644 --- a/Block/Adminhtml/Post/Helper/Form/Gallery/Content.php +++ b/Block/Adminhtml/Post/Helper/Form/Gallery/Content.php @@ -1,11 +1,13 @@ getHtmlId() . 'JsObject'; } @@ -160,7 +162,7 @@ public function getImagesJson() private function sortImagesByPosition($images) { if (is_array($images)) { - usort($images, function ($imageA, $imageB) { + usort($images, function (array $imageA, array $imageB): int { return ($imageA['position'] < $imageB['position']) ? -1 : 1; }); } diff --git a/Block/Adminhtml/Post/SaveAndContinueButton.php b/Block/Adminhtml/Post/SaveAndContinueButton.php index a048d09d..2a5f81f2 100755 --- a/Block/Adminhtml/Post/SaveAndContinueButton.php +++ b/Block/Adminhtml/Post/SaveAndContinueButton.php @@ -1,11 +1,13 @@ _storeManager->getWebsites() as $website) { foreach ($website->getGroups() as $group) { @@ -90,7 +92,7 @@ public function isEnabled() /** * @return bool */ - public function isKeyMissing() + public function isKeyMissing(): bool { $section = ObjectManager::getInstance()->create(Section::class, ['name' => 'mfblog']); return !$this->config->getConfig(self::XML_PATH_KEY) diff --git a/Block/Adminhtml/System/Config/Form/ColorPicker.php b/Block/Adminhtml/System/Config/Form/ColorPicker.php index 1f2fc042..1b9f248d 100755 --- a/Block/Adminhtml/System/Config/Form/ColorPicker.php +++ b/Block/Adminhtml/System/Config/Form/ColorPicker.php @@ -1,11 +1,13 @@ diff --git a/Block/Adminhtml/System/Config/Form/SitemapInfo.php b/Block/Adminhtml/System/Config/Form/SitemapInfo.php index b672045f..b849fedc 100644 --- a/Block/Adminhtml/System/Config/Form/SitemapInfo.php +++ b/Block/Adminhtml/System/Config/Form/SitemapInfo.php @@ -1,4 +1,7 @@ moduleList->getOne($this->getModuleName()); $html = '
diff --git a/Block/Adminhtml/System/Config/Form/UpdateInfo.php b/Block/Adminhtml/System/Config/Form/UpdateInfo.php index 336ec8f9..136dd76b 100644 --- a/Block/Adminhtml/System/Config/Form/UpdateInfo.php +++ b/Block/Adminhtml/System/Config/Form/UpdateInfo.php @@ -1,11 +1,13 @@ getCurrentVersion(), $this->getLatestVersion()) < 0); } diff --git a/Block/Adminhtml/Tag.php b/Block/Adminhtml/Tag.php index ccec3d59..25f2ce3e 100755 --- a/Block/Adminhtml/Tag.php +++ b/Block/Adminhtml/Tag.php @@ -1,11 +1,13 @@ _coreRegistry->registry('current_blog_archive_month'); + return (string)$this->_coreRegistry->registry('current_blog_archive_month'); } /** * Get archive year * @return int */ - public function getYear() + public function getYear(): int { return (int)$this->_coreRegistry->registry('current_blog_archive_year'); } diff --git a/Block/Archive/PostList.php b/Block/Archive/PostList.php index 50b42f32..3a3c140a 100755 --- a/Block/Archive/PostList.php +++ b/Block/Archive/PostList.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/archive/'.$param, diff --git a/Block/Author/PostList.php b/Block/Author/PostList.php index 8dbd563e..088d098c 100755 --- a/Block/Author/PostList.php +++ b/Block/Author/PostList.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/author/template', diff --git a/Block/Catalog/Product/RelatedPosts.php b/Block/Catalog/Product/RelatedPosts.php index fe7474c1..9c3c4279 100755 --- a/Block/Catalog/Product/RelatedPosts.php +++ b/Block/Catalog/Product/RelatedPosts.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/product_page/related_posts_enabled', diff --git a/Block/Category/AbstractCategory.php b/Block/Category/AbstractCategory.php index 67bd3bc2..16fc5e3d 100644 --- a/Block/Category/AbstractCategory.php +++ b/Block/Category/AbstractCategory.php @@ -1,11 +1,13 @@ getCategory()->getData('display_mode'); return ($displayMode == CategoryDisplayMode::POSTS_AND_SUBCATEGORIES_LINKS || @@ -45,7 +47,7 @@ protected function canDisplay() * @throws \Magento\Framework\Exception\LocalizedException * @return void */ - protected function _addBreadcrumbs($title = null, $key = null) + protected function _addBreadcrumbs($title = null, $key = null): null { return null; } diff --git a/Block/Category/PostList.php b/Block/Category/PostList.php index 85407ccf..54e2ddd0 100644 --- a/Block/Category/PostList.php +++ b/Block/Category/PostList.php @@ -1,11 +1,13 @@ getCategory()->getData('display_mode'); return ($displayMode == CategoryDisplayMode::POSTS); @@ -208,7 +210,7 @@ public function getIdentities() * * @return string */ - public function getPostTemplateType() + public function getPostTemplateType(): string { $template = (string)$this->getCategory()->getData('posts_list_template'); if ($template) { diff --git a/Block/Category/SubCategoryLinks.php b/Block/Category/SubCategoryLinks.php index cc34ff7a..68377c6b 100644 --- a/Block/Category/SubCategoryLinks.php +++ b/Block/Category/SubCategoryLinks.php @@ -1,11 +1,13 @@ getCategory()->getData('display_mode'); return ($displayMode == CategoryDisplayMode::SUBCATEGORIES_LINKS diff --git a/Block/Category/View.php b/Block/Category/View.php index 928bd82b..86716058 100755 --- a/Block/Category/View.php +++ b/Block/Category/View.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/index_page/'.$param, @@ -194,7 +196,7 @@ protected function _addBreadcrumbs($title = null, $key = null) * * @return string */ - public function getPostTemplateType() + public function getPostTemplateType(): string { $template = (string)$this->_scopeConfig->getValue( 'mfblog/index_page/template', diff --git a/Block/Infortis/UltraMegamenu/Topmenu.php b/Block/Infortis/UltraMegamenu/Topmenu.php index 9cf13ec7..3ad40493 100644 --- a/Block/Infortis/UltraMegamenu/Topmenu.php +++ b/Block/Infortis/UltraMegamenu/Topmenu.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/author/enabled', @@ -48,7 +50,7 @@ public function authorEnabled() * Retrieve 1 if author page is enabled * @return int */ - public function authorPageEnabled() + public function authorPageEnabled(): int { return (int) $this->_scopeConfig->getValue( 'mfblog/author/page_enabled', @@ -60,7 +62,7 @@ public function authorPageEnabled() * Retrieve true if magefan comments are enabled * @return bool */ - public function magefanCommentsEnabled() + public function magefanCommentsEnabled(): bool { return $this->_scopeConfig->getValue( 'mfblog/post_view/comments/type', @@ -71,7 +73,7 @@ public function magefanCommentsEnabled() /** * @return bool */ - public function viewsCountEnabled() + public function viewsCountEnabled(): bool { return (bool)$this->_scopeConfig->getValue( 'mfblog/post_view/views_count/enabled', @@ -83,7 +85,7 @@ public function viewsCountEnabled() * Retrieve 1 if display reading time is enabled * @return int */ - public function readingTimeEnabled() + public function readingTimeEnabled(): int { return (int) $this->_scopeConfig->getValue( 'mfblog/post_view/reading_time/enabled', diff --git a/Block/Post/PostList.php b/Block/Post/PostList.php index 1fbdbb8e..bc9911b7 100755 --- a/Block/Post/PostList.php +++ b/Block/Post/PostList.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/post_list/template', diff --git a/Block/Post/PostList/AbstractList.php b/Block/Post/PostList/AbstractList.php index 9284bd61..d89c9e22 100755 --- a/Block/Post/PostList/AbstractList.php +++ b/Block/Post/PostList/AbstractList.php @@ -1,11 +1,13 @@ _collection = $collection; @@ -105,7 +107,7 @@ public function getLimit() * * @return int */ - public function getCurrentPage() + public function getCurrentPage(): int { $page = (int) $this->_request->getParam($this->getPageParamName()); return $page ? $page : 1; @@ -114,7 +116,7 @@ public function getCurrentPage() /** * @return bool|\Magento\Framework\DataObject|\Magento\Framework\View\Element\AbstractBlock|\Magento\Theme\Block\Html\Pager */ - public function getPagerBlock() + public function getPagerBlock(): \Magento\Framework\DataObject|false { $pagerBlock = $this->getChildBlock('post_list_toolbar_pager'); if ($pagerBlock instanceof \Magento\Framework\DataObject) { @@ -169,7 +171,7 @@ public function getPagerHtml() /** * @return string */ - public function getPageParamName() + public function getPageParamName(): string { return $this->config->getPagePaginationType() !== 'p' ? 'page' : 'p'; } diff --git a/Block/Post/PostList/Toolbar/Pager.php b/Block/Post/PostList/Toolbar/Pager.php index 5e2ab30a..8386342f 100755 --- a/Block/Post/PostList/Toolbar/Pager.php +++ b/Block/Post/PostList/Toolbar/Pager.php @@ -1,11 +1,13 @@ getCurrentPage() + 1; $page <= $this->getLastPageNum(); $page++) { @@ -38,7 +40,7 @@ public function getPagesUrls() * * @return bool */ - public function useLazyload() + public function useLazyload(): bool { $lastPage = $this->getLastPageNum(); $currentPage = $this->getCurrentPage(); @@ -74,7 +76,7 @@ public function getLazyloadConfig(array $config = []) * * @return int */ - public function getLazyloadMode() + public function getLazyloadMode(): int { return (int) $this->_scopeConfig->getValue( 'mfblog/post_list/lazyload_enabled', @@ -87,7 +89,7 @@ public function getLazyloadMode() * * @return int */ - public function getLazyloadPadding() + public function getLazyloadPadding(): int { return (int) $this->_scopeConfig->getValue( 'mfblog/post_list/lazyload_padding', diff --git a/Block/Post/View.php b/Block/Post/View.php index bd28134e..a2a3474b 100755 --- a/Block/Post/View.php +++ b/Block/Post/View.php @@ -1,4 +1,7 @@ _scopeConfig->getValue( 'mfblog/post_view/reading_time/enabled', diff --git a/Block/Post/View/Comments.php b/Block/Post/View/Comments.php index a54742cc..01e19772 100755 --- a/Block/Post/View/Comments.php +++ b/Block/Post/View/Comments.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/post_view/comments/number_of_comments', diff --git a/Block/Post/View/Comments/Disqus.php b/Block/Post/View/Comments/Disqus.php index 0f0e0558..86cf04ce 100755 --- a/Block/Post/View/Comments/Disqus.php +++ b/Block/Post/View/Comments/Disqus.php @@ -1,11 +1,13 @@ getLocaleCode() . '/sdk.js#xfbml=1&version=v3.3&appId=' . diff --git a/Block/Post/View/Comments/Google.php b/Block/Post/View/Comments/Google.php index af896f72..fc79a357 100755 --- a/Block/Post/View/Comments/Google.php +++ b/Block/Post/View/Comments/Google.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( \Magefan\Blog\Model\Config::GUEST_COMMENT, @@ -162,11 +164,11 @@ public function canPost() /** * Retrieve number of comments to display * - * @return string + * @return int */ - public function getNumberOfComments() + public function getNumberOfComments(): int { - return $this->_scopeConfig->getValue( + return (int)$this->_scopeConfig->getValue( \Magefan\Blog\Model\Config::NUMBER_OF_COMMENTS, ScopeInterface::SCOPE_STORE ); diff --git a/Block/Post/View/Comments/Magefan/Comment.php b/Block/Post/View/Comments/Magefan/Comment.php index c77041b4..e8ed50ea 100755 --- a/Block/Post/View/Comments/Magefan/Comment.php +++ b/Block/Post/View/Comments/Magefan/Comment.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/post_view/comments/format_date', diff --git a/Block/Post/View/Gallery.php b/Block/Post/View/Gallery.php index 0ef50047..9d7d1dfa 100755 --- a/Block/Post/View/Gallery.php +++ b/Block/Post/View/Gallery.php @@ -1,4 +1,7 @@ _scopeConfig->getValue( 'mfblog/post_view/nextprev/enabled', diff --git a/Block/Post/View/Opengraph.php b/Block/Post/View/Opengraph.php index b711d538..bda8aba4 100755 --- a/Block/Post/View/Opengraph.php +++ b/Block/Post/View/Opengraph.php @@ -1,4 +1,7 @@ _scopeConfig->getValue( \Magefan\Blog\Model\Config::XML_RELATED_POSTS_ENABLED, diff --git a/Block/Post/View/RelatedProducts.php b/Block/Post/View/RelatedProducts.php index afd5a54f..5b2122c5 100755 --- a/Block/Post/View/RelatedProducts.php +++ b/Block/Post/View/RelatedProducts.php @@ -1,11 +1,13 @@ getPost(); @@ -98,7 +100,7 @@ protected function _prepareCollection() * Retrieve true if Display Related Products enabled * @return boolean */ - public function displayProducts() + public function displayProducts(): bool { return (bool) $this->_scopeConfig->getValue( \Magefan\Blog\Model\Config::XML_RELATED_PRODUCTS_ENABLED, @@ -183,7 +185,7 @@ public function getItemCollection() /** * @return int */ - public function hasItems() + public function hasItems(): int { return count($this->getItems()); } diff --git a/Block/Post/View/Richsnippets.php b/Block/Post/View/Richsnippets.php index da90d2e9..da6ae382 100755 --- a/Block/Post/View/Richsnippets.php +++ b/Block/Post/View/Richsnippets.php @@ -1,4 +1,7 @@ getPost(); diff --git a/Block/Post/View/ViewsCount.php b/Block/Post/View/ViewsCount.php index 752d3bbb..78d64277 100644 --- a/Block/Post/View/ViewsCount.php +++ b/Block/Post/View/ViewsCount.php @@ -1,11 +1,13 @@ getFilteredContent(); /* Remove iframes */ diff --git a/Block/Search/PostList.php b/Block/Search/PostList.php index fe1e5843..880c4605 100755 --- a/Block/Search/PostList.php +++ b/Block/Search/PostList.php @@ -1,11 +1,13 @@ getRequest()->getParam('q')); } @@ -46,7 +48,7 @@ protected function _preparePostCollection() * * @return string */ - public function getCollectionOrderField() + public function getCollectionOrderField(): string { return 'search_rate'; } @@ -98,7 +100,7 @@ protected function _getTitle() * * @return string */ - public function getPostTemplateType() + public function getPostTemplateType(): string { $template = (string)$this->_scopeConfig->getValue( 'mfblog/search/template', diff --git a/Block/Sidebar.php b/Block/Sidebar.php index b2a5f304..3ec558c1 100644 --- a/Block/Sidebar.php +++ b/Block/Sidebar.php @@ -1,11 +1,13 @@ getGroupBy() == 'year') { $time = is_numeric($time) ? $time : strtotime((string)$time); diff --git a/Block/Sidebar/Categories.php b/Block/Sidebar/Categories.php index 054284cf..4ea76366 100755 --- a/Block/Sidebar/Categories.php +++ b/Block/Sidebar/Categories.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/sidebar/'.$this->_widgetKey.'/max_depth', diff --git a/Block/Sidebar/Custom.php b/Block/Sidebar/Custom.php index b4d2ba83..b9cb41db 100755 --- a/Block/Sidebar/Custom.php +++ b/Block/Sidebar/Custom.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/sidebar/'.$this->_widgetKey.'/posts_ids', @@ -66,7 +66,7 @@ protected function getPostIdsConfigValue() * Retrieve true if display the post image is enabled in the config * @return bool */ - public function getDisplayImage() + public function getDisplayImage(): bool { return (bool)$this->_scopeConfig->getValue( 'mfblog/sidebar/'.$this->_widgetKey.'/display_image', diff --git a/Block/Sidebar/Popular.php b/Block/Sidebar/Popular.php index 6c3bc5ca..ac84cba1 100644 --- a/Block/Sidebar/Popular.php +++ b/Block/Sidebar/Popular.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/sidebar/'.$this->_widgetKey.'/display_image', diff --git a/Block/Sidebar/PostRelatedProducts.php b/Block/Sidebar/PostRelatedProducts.php index 8387bcf5..63261933 100644 --- a/Block/Sidebar/PostRelatedProducts.php +++ b/Block/Sidebar/PostRelatedProducts.php @@ -1,11 +1,13 @@ getPost(); diff --git a/Block/Sidebar/Recent.php b/Block/Sidebar/Recent.php index d5fa5656..82aaccd9 100755 --- a/Block/Sidebar/Recent.php +++ b/Block/Sidebar/Recent.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/sidebar/'.$this->_widgetKey.'/display_image', diff --git a/Block/Sidebar/Rss.php b/Block/Sidebar/Rss.php index 2e9fa9ec..3f89e3fc 100755 --- a/Block/Sidebar/Rss.php +++ b/Block/Sidebar/Rss.php @@ -1,11 +1,13 @@ getRequest()->getParam('q', '')); } diff --git a/Block/Sidebar/TagClaud.php b/Block/Sidebar/TagClaud.php index 44059f09..82dbf84c 100755 --- a/Block/Sidebar/TagClaud.php +++ b/Block/Sidebar/TagClaud.php @@ -1,11 +1,13 @@ getMaxCount(); $percent = floor(($tag->getCount() / $maxCount) * 100); diff --git a/Block/Sidebar/Widget.php b/Block/Sidebar/Widget.php index 23e12c01..0c66e877 100755 --- a/Block/Sidebar/Widget.php +++ b/Block/Sidebar/Widget.php @@ -1,11 +1,13 @@ hasData('sort_order')) { $this->setData('sort_order', $this->_scopeConfig->getValue( diff --git a/Block/Smartwave/Megamenu/Topmenu.php b/Block/Smartwave/Megamenu/Topmenu.php index f2c47989..1dcf66f0 100644 --- a/Block/Smartwave/Megamenu/Topmenu.php +++ b/Block/Smartwave/Megamenu/Topmenu.php @@ -1,11 +1,13 @@ _scopeConfig->getValue( 'mfblog/social/add_this_enabled', diff --git a/Block/Tag/AbstractTag.php b/Block/Tag/AbstractTag.php index 98643f63..b96c357a 100644 --- a/Block/Tag/AbstractTag.php +++ b/Block/Tag/AbstractTag.php @@ -1,11 +1,13 @@ getTag()->getData('posts_list_template'); if ($template) { diff --git a/Block/Widget/Featured.php b/Block/Widget/Featured.php index b6fd5cf8..9acf1448 100644 --- a/Block/Widget/Featured.php +++ b/Block/Widget/Featured.php @@ -1,11 +1,13 @@ getData('posts_ids'); } diff --git a/Block/Widget/Link.php b/Block/Widget/Link.php index 5b2d0fa9..89a461f9 100644 --- a/Block/Widget/Link.php +++ b/Block/Widget/Link.php @@ -1,4 +1,7 @@ _postCollection; } - public function getPostedOn($post, $format = 'Y-m-d H:i:s') + public function getPostedOn($post, $format = 'Y-m-d H:i:s'): string { return date($format, strtotime((string)$post->getData('publish_time'))); } - public function getOriginalPostImage($post) + public function getOriginalPostImage($post): string { $imgageFile = $post->getPostImage(); return $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA).$imgageFile; @@ -192,7 +194,7 @@ public function getElementShow() return $this->_show; } - public function isShow($item) + public function isShow($item): bool { return in_array($item, $this->getElementShow()); } diff --git a/Block/Widget/Recent.php b/Block/Widget/Recent.php index 270e4556..e75624d4 100755 --- a/Block/Widget/Recent.php +++ b/Block/Widget/Recent.php @@ -1,11 +1,13 @@ _view->loadLayout(); $this->_setActiveMenu('Magefan_Blog::import'); diff --git a/Controller/Adminhtml/Import/Run.php b/Controller/Adminhtml/Import/Run.php index 4f3a3fb7..a57517ba 100755 --- a/Controller/Adminhtml/Import/Run.php +++ b/Controller/Adminhtml/Import/Run.php @@ -1,11 +1,13 @@ prepareData($data)->execute(); $stats = $import->getImportStatistic(); - +var_dump($stats->getData('skipped_count')); if ($stats->getData('imported_count')) { if (!$stats->getData('skipped_count')) { - $this->messageManager->addSuccess(__( + $this->messageManager->addSuccess((string)__( 'The import process was completed successfully. %1 posts, %2 categories, %3 tags, %4 authors and %5 comments where imported.', $stats->getData('imported_posts_count'), @@ -55,7 +57,7 @@ public function execute() $stats->getData('imported_comments_count') )); } else { - $this->messageManager->addNotice(__( + $this->messageManager->addNotice((string)__( 'The import process completed. %1 posts, %2 categories, %3 tags, %4 authors and %5 comments where imported. Some posts or categories or tags or authors or comments where skipped. %6 %7 %8 %9 %10', $stats->getData('imported_posts_count'), @@ -79,7 +81,7 @@ public function execute() if (!$stats->getData('skipped_count')) { $this->messageManager->addNotice(__('Nothing to import.')); } else { - throw new \Exception(__('Can not make import.'), 1); + throw new \Exception((string)__('Can not make import.'), 1); } } diff --git a/Controller/Adminhtml/Post.php b/Controller/Adminhtml/Post.php index 9e207aee..830e5194 100755 --- a/Controller/Adminhtml/Post.php +++ b/Controller/Adminhtml/Post.php @@ -1,11 +1,13 @@ _getModel(); diff --git a/Controller/Adminhtml/Post/Save.php b/Controller/Adminhtml/Post/Save.php index ccf75ad7..78d58df6 100755 --- a/Controller/Adminhtml/Post/Save.php +++ b/Controller/Adminhtml/Post/Save.php @@ -1,11 +1,13 @@ getId()) { diff --git a/Controller/Router.php b/Controller/Router.php index 44870edc..ba10090a 100755 --- a/Controller/Router.php +++ b/Controller/Router.php @@ -1,11 +1,13 @@ getObjectId( $this->_postFactory, @@ -405,7 +407,7 @@ protected function _getPostId($identifier, $checkSufix = true) * @return int * @deprecated Use URL resolver interface instead */ - protected function _getCategoryId($identifier, $checkSufix = true) + protected function _getCategoryId(string $identifier, $checkSufix = true) { return $this->getObjectId( $this->_categoryFactory, @@ -422,7 +424,7 @@ protected function _getCategoryId($identifier, $checkSufix = true) * @return int * @deprecated Use URL resolver interface instead */ - protected function _getAuthorId($identifier, $checkSufix = true) + protected function _getAuthorId(string $identifier, $checkSufix = true) { return $this->getObjectId( $this->_authorFactory, @@ -439,7 +441,7 @@ protected function _getAuthorId($identifier, $checkSufix = true) * @return int * @deprecated Use URL resolver interface instead */ - protected function _getTagId($identifier, $checkSufix = true) + protected function _getTagId(string $identifier, $checkSufix = true) { return $this->getObjectId( $this->_tagFactory, @@ -457,7 +459,7 @@ protected function _getTagId($identifier, $checkSufix = true) * @return mixed * @deprecated Use URL resolver interface instead */ - protected function getObjectId($factory, $controllerName, $identifier, $checkSufix) + protected function getObjectId($factory, string $controllerName, string $identifier, $checkSufix) { $key = $controllerName . '-' .$identifier . ($checkSufix ? '-checksufix' : ''); if (!isset($this->ids[$key])) { @@ -485,7 +487,7 @@ protected function getObjectId($factory, $controllerName, $identifier, $checkSuf * @return boolean * @deprecated Use URL resolver interface instead */ - protected function _isArchiveIdentifier($identifier) + protected function _isArchiveIdentifier($identifier): bool { $info = explode('-', $identifier); return count($info) == 2 diff --git a/Controller/Rss/Feed.php b/Controller/Rss/Feed.php index abee5df4..b3117a6b 100755 --- a/Controller/Rss/Feed.php +++ b/Controller/Rss/Feed.php @@ -1,4 +1,7 @@ config->isEnabled()) { return; diff --git a/Helper/Config.php b/Helper/Config.php index 40852889..a8acbbb1 100644 --- a/Helper/Config.php +++ b/Helper/Config.php @@ -1,11 +1,13 @@ '%1', 'M' => '%2']; @@ -37,7 +39,7 @@ public static function getTranslatedDate($format, $dateOrTime) $date = date($format, $time); foreach ($month as $to => $from) { - $date = str_replace($from, __(date($to, $time)), $date); + $date = str_replace($from, (string)__(date($to, $time)), $date); } return $date; @@ -61,7 +63,7 @@ public function getConfig($path, $storeId = null) /** * @return mixed */ - public function isOriginMfLazyLoadEnable() + public function isOriginMfLazyLoadEnable(): bool { return $this->getConfig(self::XML_PATH_MFLAZYLOAD_ENABLED) && ($this->getConfig(self::XML_PATH_MFLAZYLOAD_METHOD) == 0) && $this->_moduleManager->isEnabled('Magefan_LazyLoad'); } diff --git a/Helper/Image.php b/Helper/Image.php index 6e16b2b6..53f0b59b 100644 --- a/Helper/Image.php +++ b/Helper/Image.php @@ -1,4 +1,7 @@ _newFile = ''; $this->_baseFile = $baseFile; @@ -96,11 +99,12 @@ public function init($baseFile) } /** - * @param $width - * @param null $height + * @param string $width + * @param $height + * @param $keepFrame * @return $this */ - public function resize($width, $height = null, $keepFrame = null) + public function resize(string $width, $height = null, $keepFrame = null): static { if ($this->_baseFile) { $pathinfo = pathinfo(($this->_baseFile)); @@ -155,7 +159,7 @@ public function getWidthAndHeigth(): array * @param $height * @return $this */ - protected function resizeBaseFile($width, $height, $keepFrame) + protected function resizeBaseFile($width, $height, $keepFrame): static { if (!$this->fileExists($this->_baseFile)) { $this->_baseFile = null; @@ -197,7 +201,7 @@ protected function fileExists($filename) * @return string * @throws \Magento\Framework\Exception\NoSuchEntityException */ - public function __toString() + public function __toString(): string { $url = ""; if ($this->_baseFile) { diff --git a/Helper/Menu.php b/Helper/Menu.php index 4e8ede36..2f46d6a7 100644 --- a/Helper/Menu.php +++ b/Helper/Menu.php @@ -1,11 +1,13 @@ getName(); } @@ -93,7 +95,7 @@ public function getTitle() * Retrieve meta title * @return string */ - public function getMetaTitle() + public function getMetaTitle(): string { $title = $this->getData('meta_title'); if (!$title) { @@ -107,7 +109,7 @@ public function getMetaTitle() * Retrieve meta description * @return string */ - public function getMetaDescription() + public function getMetaDescription(): string { $desc = $this->getData('meta_description'); if (!$desc) { @@ -134,7 +136,7 @@ public function getMetaDescription() * Retrieve author identifier * @return string | null */ - public function getIdentifier() + public function getIdentifier(): ?string { return preg_replace( "/[^A-Za-z0-9\-]/", @@ -186,7 +188,7 @@ public function getAuthorUrl() * @param string $separator * @return string */ - public function getName($separator = ' ') + public function getName(string $separator = ' '): string { return $this->getFirstname() . $separator . $this->getLastname(); } diff --git a/Model/AuthorRepository.php b/Model/AuthorRepository.php index c6790243..72dc2be8 100644 --- a/Model/AuthorRepository.php +++ b/Model/AuthorRepository.php @@ -1,4 +1,7 @@ authorResourceModel->delete($author); @@ -169,7 +172,7 @@ public function delete(AuthorInterface $author) * @throws NoSuchEntityException * @throws StateException */ - public function deleteById($authorId) + public function deleteById($authorId): bool { return $this->delete($this->getById($authorId)); } diff --git a/Model/Category.php b/Model/Category.php index 7e0a0001..3fa6d888 100755 --- a/Model/Category.php +++ b/Model/Category.php @@ -1,11 +1,13 @@ getIsActive() == self::STATUS_ENABLED); } @@ -206,7 +208,7 @@ public function isActive() * Retrieve available category statuses * @return array */ - public function getAvailableStatuses() + public function getAvailableStatuses(): array { return [self::STATUS_DISABLED => __('Disabled'), self::STATUS_ENABLED => __('Enabled')]; } @@ -219,7 +221,7 @@ public function getAvailableStatuses() * @param int $storeId * @return int */ - public function checkIdentifier($identifier, $storeId) + public function checkIdentifier($identifier, $storeId): string|false { return $this->_getResource()->checkIdentifier($identifier, $storeId); } @@ -282,7 +284,7 @@ public function getParentCategory() * @param self $category * @return boolean */ - public function isParent($category) + public function isParent($category): bool { if (is_object($category)) { $category = $category->getId(); @@ -327,7 +329,7 @@ public function getChildrenIds($grandchildren = true) * @param self $category * @return boolean */ - public function isChild($category) + public function isChild($category): bool { return $category->isParent($this); } @@ -336,7 +338,7 @@ public function isChild($category) * Retrieve category depth level * @return int */ - public function getLevel() + public function getLevel(): int { return count($this->getParentIds()); } @@ -377,7 +379,7 @@ public function getCanonicalUrl() * Retrieve meta title * @return string */ - public function getMetaTitle() + public function getMetaTitle(): string { $title = $this->getData('meta_title'); if (!$title) { @@ -391,7 +393,7 @@ public function getMetaTitle() * Retrieve meta description * @return string */ - public function getMetaDescription() + public function getMetaDescription(): string { $desc = $this->getData('meta_description'); if (!$desc) { @@ -418,7 +420,7 @@ public function getMetaDescription() * Retrieve if is visible on store * @return bool */ - public function isVisibleOnStore($storeId) + public function isVisibleOnStore($storeId): bool { return $this->getIsActive() && (null === $storeId || array_intersect([0, $storeId], $this->getStoreIds())); @@ -450,7 +452,7 @@ public function getPostsCount() * @return self * @deprecated replaced with getDynamicData */ - public function initDinamicData() + public function initDinamicData(): static { $keys = [ 'meta_description', diff --git a/Model/CategoryManagement.php b/Model/CategoryManagement.php index 5d0856c9..8b04aa0a 100644 --- a/Model/CategoryManagement.php +++ b/Model/CategoryManagement.php @@ -1,11 +1,13 @@ categoryResourceModel->delete($category); @@ -168,7 +171,7 @@ public function delete(Category $category) * @throws NoSuchEntityException * @throws StateException */ - public function deleteById($categoryId) + public function deleteById($categoryId): bool { return $this->delete($this->getById($categoryId)); } diff --git a/Model/Comment.php b/Model/Comment.php index f680692a..1fb6d85a 100755 --- a/Model/Comment.php +++ b/Model/Comment.php @@ -1,11 +1,13 @@ getStatus() == \Magefan\Blog\Model\Config\Source\CommentStatus::APPROVED); } @@ -152,7 +154,7 @@ public function isActive() * Retrieve if is visible on store * @return bool */ - public function isVisibleOnStore($storeId) + public function isVisibleOnStore($storeId): bool { return $this->isActive() && (null === $storeId || array_intersect([0, $storeId], [$this->getStoreId()])); @@ -269,7 +271,7 @@ public function getChildComments() * Retrieve true if comment is reply to other comment * @return boolean */ - public function isReply() + public function isReply(): bool { return (bool)$this->getParentId(); } @@ -278,7 +280,7 @@ public function isReply() * Validate comment * @return void */ - public function validate() + public function validate(): void { if (mb_strlen($this->getText()) < 3) { throw new \Exception(__('Comment text is too short.'), 1); @@ -290,7 +292,7 @@ public function validate() * @param string $format * @return string */ - public function getPublishDate($format = 'Y-m-d H:i:s') + public function getPublishDate($format = 'Y-m-d H:i:s'): string|array { return \Magefan\Blog\Helper\Data::getTranslatedDate( $format, @@ -301,7 +303,7 @@ public function getPublishDate($format = 'Y-m-d H:i:s') /** * @return array|ResourceModel\Comment\Collection */ - public function getRepliesCollection() + public function getRepliesCollection(): \Magefan\Blog\Model\ResourceModel\Comment\Collection|array { $repliesCollection = []; if (!$this->isReply()) { diff --git a/Model/Comment/Notification.php b/Model/Comment/Notification.php index 004377ce..f506150d 100644 --- a/Model/Comment/Notification.php +++ b/Model/Comment/Notification.php @@ -1,11 +1,13 @@ backendSession->isLoggedIn()) { return; // Isn't logged in diff --git a/Model/CommentRepository.php b/Model/CommentRepository.php index 10c89aa2..d8bbba16 100644 --- a/Model/CommentRepository.php +++ b/Model/CommentRepository.php @@ -1,4 +1,7 @@ commentResourceModel->delete($comment); @@ -154,7 +157,7 @@ public function delete(Comment $comment) * @throws NoSuchEntityException * @throws StateException */ - public function deleteById($commentId) + public function deleteById($commentId): bool { return $this->delete($this->getById($commentId)); } diff --git a/Model/Config.php b/Model/Config.php index 1823be3a..fc6cd6dd 100644 --- a/Model/Config.php +++ b/Model/Config.php @@ -1,11 +1,13 @@ getConfig( self::XML_PATH_EXTENSION_ENABLED, @@ -188,7 +190,7 @@ public function isEnabled($storeId = null) * * @return bool */ - public function isRelatedPostsEnabled($storeId = null) + public function isRelatedPostsEnabled($storeId = null): bool { return (bool)$this->getConfig( self::XML_RELATED_POSTS_ENABLED, @@ -201,7 +203,7 @@ public function isRelatedPostsEnabled($storeId = null) * * @return bool */ - public function isRelatedProductsEnabled($storeId = null) + public function isRelatedProductsEnabled($storeId = null): bool { return (bool)$this->getConfig( self::XML_RELATED_PRODUCTS_ENABLED, @@ -228,7 +230,7 @@ public function getConfig($path, $storeId = null) * @param $pageType * @return bool */ - public function getDisplayCanonicalTag($pageType) + public function getDisplayCanonicalTag($pageType): bool { if ($this->getConfig(self::XML_PATH_DISPLAY_CANONICAL_TAG_FOR)) { @@ -244,7 +246,7 @@ public function getDisplayCanonicalTag($pageType) * @param null $storeId * @return bool */ - public function isBlogCssIncludeOnAll($storeId = null) + public function isBlogCssIncludeOnAll($storeId = null): bool { return (bool)$this->getConfig( self::XML_INCLUDE_BLOG_CSS_ALL_PAGES, @@ -256,7 +258,7 @@ public function isBlogCssIncludeOnAll($storeId = null) * @param null $storeId * @return bool */ - public function isBlogCssIncludeOnHome($storeId = null) + public function isBlogCssIncludeOnHome($storeId = null): bool { return (bool)$this->getConfig( self::XML_INCLUDE_BLOG_CSS_HOME_PAGE, @@ -268,7 +270,7 @@ public function isBlogCssIncludeOnHome($storeId = null) * @param null $storeId * @return bool */ - public function isBlogCssIncludeOnProduct($storeId = null) + public function isBlogCssIncludeOnProduct($storeId = null): bool { return (bool)$this->getConfig( self::XML_INCLUDE_BLOG_CSS_PRODUCT_PAGES, @@ -305,7 +307,7 @@ public function getCustomCss($storeId = null): string * @param $storeId * @return bool */ - public function getIncludeBootstrapCustomMini($storeId = null) + public function getIncludeBootstrapCustomMini($storeId = null): bool { return (bool)$this->getConfig( self::XML_BLOG_INCLUDE_BOOTSTRAP_CUSTOM_MINI, diff --git a/Model/Config/Source/ArchiveGroupBy.php b/Model/Config/Source/ArchiveGroupBy.php index 81b755c5..35bfc3ef 100755 --- a/Model/Config/Source/ArchiveGroupBy.php +++ b/Model/Config/Source/ArchiveGroupBy.php @@ -40,7 +40,7 @@ public function toOptionArray() * * @return array */ - public function toArray() + public function toArray(): array { $array = []; foreach ($this->toOptionArray() as $item) { diff --git a/Model/Config/Source/Author.php b/Model/Config/Source/Author.php index f97af370..a6371a91 100755 --- a/Model/Config/Source/Author.php +++ b/Model/Config/Source/Author.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/AuthorType.php b/Model/Config/Source/AuthorType.php index ef1428fb..1cb7e6c1 100755 --- a/Model/Config/Source/AuthorType.php +++ b/Model/Config/Source/AuthorType.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/BlogPages.php b/Model/Config/Source/BlogPages.php index aa099e9f..ccd10e31 100644 --- a/Model/Config/Source/BlogPages.php +++ b/Model/Config/Source/BlogPages.php @@ -1,4 +1,7 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/Category.php b/Model/Config/Source/Category.php index 39a6c80e..2db7bfae 100755 --- a/Model/Config/Source/Category.php +++ b/Model/Config/Source/Category.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { @@ -80,7 +82,7 @@ public function toArray() * @param int $n * @return string */ - protected function _getSpaces($n) + protected function _getSpaces($n): string { $s = ''; for ($i = 0; $i < $n; $i++) { diff --git a/Model/Config/Source/CategoryDisplayMode.php b/Model/Config/Source/CategoryDisplayMode.php index 34daaf74..33f09bc2 100644 --- a/Model/Config/Source/CategoryDisplayMode.php +++ b/Model/Config/Source/CategoryDisplayMode.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/CategoryPath.php b/Model/Config/Source/CategoryPath.php index 6514bce9..780fcfe1 100755 --- a/Model/Config/Source/CategoryPath.php +++ b/Model/Config/Source/CategoryPath.php @@ -1,11 +1,13 @@ []|array<'label'|'optgroup'|'value', mixed>[] + */ + protected function _getOptions($itemId = 0): array { $childs = $this->_getChilds(); $options = []; diff --git a/Model/Config/Source/CategoryTree.php b/Model/Config/Source/CategoryTree.php index 6deb96f9..69973e28 100755 --- a/Model/Config/Source/CategoryTree.php +++ b/Model/Config/Source/CategoryTree.php @@ -1,11 +1,13 @@ _options; } - protected function _getOptions($itemId = 0) + /** + * @return array> + */ + protected function _getOptions($itemId = 0): array { $childs = $this->_getChilds(); $options = []; diff --git a/Model/Config/Source/CommentStatus.php b/Model/Config/Source/CommentStatus.php index 20e50a8b..74a86e76 100644 --- a/Model/Config/Source/CommentStatus.php +++ b/Model/Config/Source/CommentStatus.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/CommetType.php b/Model/Config/Source/CommetType.php index 151fcdca..69f0d994 100755 --- a/Model/Config/Source/CommetType.php +++ b/Model/Config/Source/CommetType.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/DisplayMode.php b/Model/Config/Source/DisplayMode.php index 508f1958..b1ebc0cc 100644 --- a/Model/Config/Source/DisplayMode.php +++ b/Model/Config/Source/DisplayMode.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/ImageSizeOptions.php b/Model/Config/Source/ImageSizeOptions.php index 7e6acd77..99a81720 100644 --- a/Model/Config/Source/ImageSizeOptions.php +++ b/Model/Config/Source/ImageSizeOptions.php @@ -32,7 +32,7 @@ public function toOptionArray() * * @return array */ - public function toArray() + public function toArray(): array { $array = []; foreach ($this->toOptionArray() as $item) { diff --git a/Model/Config/Source/LazyLoad.php b/Model/Config/Source/LazyLoad.php index c480a9ea..7ffffa82 100755 --- a/Model/Config/Source/LazyLoad.php +++ b/Model/Config/Source/LazyLoad.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/PageLayout.php b/Model/Config/Source/PageLayout.php index 9ad8629e..e53224a7 100755 --- a/Model/Config/Source/PageLayout.php +++ b/Model/Config/Source/PageLayout.php @@ -1,9 +1,11 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/PagePaginationType.php b/Model/Config/Source/PagePaginationType.php index 6ee05811..513278bd 100644 --- a/Model/Config/Source/PagePaginationType.php +++ b/Model/Config/Source/PagePaginationType.php @@ -1,9 +1,11 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/PermalinkType.php b/Model/Config/Source/PermalinkType.php index 29822242..ea1d8b08 100755 --- a/Model/Config/Source/PermalinkType.php +++ b/Model/Config/Source/PermalinkType.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/PostsSortBy.php b/Model/Config/Source/PostsSortBy.php index 8efb1bd6..989553d4 100644 --- a/Model/Config/Source/PostsSortBy.php +++ b/Model/Config/Source/PostsSortBy.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/ReadingProgressBarPosition.php b/Model/Config/Source/ReadingProgressBarPosition.php index 472a7934..d3d99b51 100644 --- a/Model/Config/Source/ReadingProgressBarPosition.php +++ b/Model/Config/Source/ReadingProgressBarPosition.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/SocialNetworks.php b/Model/Config/Source/SocialNetworks.php index 90209373..82e79a01 100644 --- a/Model/Config/Source/SocialNetworks.php +++ b/Model/Config/Source/SocialNetworks.php @@ -30,7 +30,7 @@ public function toOptionArray() * * @return array */ - public function toArray() + public function toArray(): array { $array = []; foreach ($this->toOptionArray() as $item) { diff --git a/Model/Config/Source/Tag.php b/Model/Config/Source/Tag.php index 7fd80c21..43d67505 100755 --- a/Model/Config/Source/Tag.php +++ b/Model/Config/Source/Tag.php @@ -1,11 +1,13 @@ toOptionArray() as $item) { diff --git a/Model/Config/Source/TagRobots.php b/Model/Config/Source/TagRobots.php index d3ca6d75..eefecf66 100644 --- a/Model/Config/Source/TagRobots.php +++ b/Model/Config/Source/TagRobots.php @@ -1,11 +1,13 @@ imageHelper->init($this->getFile()) ->resize($width, $height); @@ -79,7 +81,7 @@ public function resize($width, $height = null) * Retrieve image url * @return string */ - public function __toString() + public function __toString(): string { return $this->getUrl(); } diff --git a/Model/ImageUploader.php b/Model/ImageUploader.php index bffced38..90ddf1a5 100755 --- a/Model/ImageUploader.php +++ b/Model/ImageUploader.php @@ -1,11 +1,13 @@ getDbAdapter(); $_pref = $this->getPrefix(); diff --git a/Model/Import/Aw2.php b/Model/Import/Aw2.php index 0b34e6fa..8278260f 100644 --- a/Model/Import/Aw2.php +++ b/Model/Import/Aw2.php @@ -1,11 +1,13 @@ getDbAdapter(); $_pref = $this->getPrefix(); diff --git a/Model/Import/Mageplaza.php b/Model/Import/Mageplaza.php index 973dec7f..9d71f1f9 100644 --- a/Model/Import/Mageplaza.php +++ b/Model/Import/Mageplaza.php @@ -1,11 +1,13 @@ getDbAdapter(); $_pref = $this->getPrefix(); diff --git a/Model/Import/Mageplaza1.php b/Model/Import/Mageplaza1.php index cf5b1b63..67240b08 100644 --- a/Model/Import/Mageplaza1.php +++ b/Model/Import/Mageplaza1.php @@ -1,11 +1,13 @@ getDbAdapter(); $_pref = $this->getPrefix(); @@ -292,7 +294,7 @@ public function execute() * @return |null * @throws \Zend_Db_Exception */ - private function getPostAttrValue($postId, $attributeCode) + private function getPostAttrValue($postId, string $attributeCode) { $adapter = $this->getDbAdapter(); $_pref = $this->getPrefix(); @@ -338,7 +340,7 @@ private function getBlogEntityId() * @return int * @throws \Zend_Db_Exception */ - private function getBlogAttributeId($attributeCode) + private function getBlogAttributeId(string $attributeCode) { if (!isset($this->blogAttributes[$attributeCode])) { $this->blogAttributes[$attributeCode] = []; diff --git a/Model/Import/Mirasvit.php b/Model/Import/Mirasvit.php index 48f27653..c6f7f3e9 100644 --- a/Model/Import/Mirasvit.php +++ b/Model/Import/Mirasvit.php @@ -1,11 +1,13 @@ getDbAdapter(); $_pref = $this->getPrefix(); @@ -273,7 +275,7 @@ public function execute() $adapter->getDriver()->getConnection()->disconnect(); } - protected function getAttributValue($entitytTypeCode, $entitytId, $attributeCode) + protected function getAttributValue(string $entitytTypeCode, string $entitytId, $attributeCode) { $adapter = $this->getDbAdapter(); $_pref = $this->getPrefix(); diff --git a/Model/Import/Wordpress.php b/Model/Import/Wordpress.php index d1722c14..c7a7d436 100644 --- a/Model/Import/Wordpress.php +++ b/Model/Import/Wordpress.php @@ -1,11 +1,13 @@ getDbAdapter(); $_pref = $this->getPrefix(); @@ -387,7 +389,7 @@ public function execute() $adapter->getDriver()->getConnection()->disconnect(); } - protected function wordpressOutoutWrap($pee, $br = true) + protected function wordpressOutoutWrap($pee, $br = true): string|array|null { $pre_tags = []; diff --git a/Model/NoSlashUrlRedirect.php b/Model/NoSlashUrlRedirect.php index a5d76cb7..a66ebce0 100644 --- a/Model/NoSlashUrlRedirect.php +++ b/Model/NoSlashUrlRedirect.php @@ -1,4 +1,7 @@ scopeConfig->getValue(Config::XML_PATH_EXTENSION_ENABLED, ScopeInterface::SCOPE_STORE); diff --git a/Model/Post.php b/Model/Post.php index d89c368c..73cb088e 100755 --- a/Model/Post.php +++ b/Model/Post.php @@ -1,11 +1,13 @@ getData('identifier'); } @@ -317,7 +319,7 @@ public function getControllerName() * @param boolean $plural * @return string */ - public function getOwnTitle($plural = false) + public function getOwnTitle($plural = false): string { return $plural ? 'Posts' : 'Post'; } @@ -327,7 +329,7 @@ public function getOwnTitle($plural = false) * Retrieve true if post is active * @return boolean [description] */ - public function isActive() + public function isActive(): bool { return ($this->getIsActive() == self::STATUS_ENABLED); } @@ -336,7 +338,7 @@ public function isActive() * Retrieve available post statuses * @return array */ - public function getAvailableStatuses() + public function getAvailableStatuses(): array { return [self::STATUS_DISABLED => __('Disabled'), self::STATUS_ENABLED => __('Enabled')]; } @@ -349,7 +351,7 @@ public function getAvailableStatuses() * @param int $storeId * @return int */ - public function checkIdentifier($identifier, $storeId) + public function checkIdentifier($identifier, $storeId): string|false { return $this->_getResource()->checkIdentifier($identifier, $storeId); } @@ -428,7 +430,7 @@ public function getFeaturedListImage() * @param array $images * @return $this */ - public function setGalleryImages(array $images) + public function setGalleryImages(array $images): static { $this->setData( 'media_gallery', @@ -551,7 +553,7 @@ public function getShortFilteredContent($len = null, $endCharacters = null) * @param mixed $endCharacters * @return string */ - public function getShortFilteredContentWithoutImages($len = null, $endCharacters = null) + public function getShortFilteredContentWithoutImages($len = null, $endCharacters = null): ?string { return preg_replace('', '', $this->getShortFilteredContent($len, $endCharacters)); } @@ -560,7 +562,7 @@ public function getShortFilteredContentWithoutImages($len = null, $endCharacters * Retrieve meta title * @return string */ - public function getMetaTitle() + public function getMetaTitle(): string { $title = $this->getData('meta_title'); if (!$title) { @@ -608,7 +610,7 @@ public function getMetaDescription() * Retrieve og title * @return string */ - public function getOgTitle() + public function getOgTitle(): string { $title = $this->getData('og_title'); if (!$title) { @@ -622,7 +624,7 @@ public function getOgTitle() * Retrieve og description * @return string */ - public function getOgDescription() + public function getOgDescription(): string { $desc = $this->getData('og_description'); if (!$desc) { @@ -641,7 +643,7 @@ public function getOgDescription() * Retrieve og type * @return string */ - public function getOgType() + public function getOgType(): string { $type = $this->getData('og_type'); if (!$type) { @@ -701,7 +703,7 @@ public function getParentCategories() * @param $b * @return int */ - public function sortByPositionDesc($a, $b) + public function sortByPositionDesc($a, $b): int { return strcmp($b->getPosition(), $a->getPosition()); } @@ -730,7 +732,7 @@ public function getParentCategory() * Retrieve post parent categories count * @return int */ - public function getCategoriesCount() + public function getCategoriesCount(): int { return count($this->getParentCategories()); } @@ -756,7 +758,7 @@ public function getRelatedTags() * Retrieve post tags * @return \Magefan\Blog\Model\ResourceModel\Tag\Collection */ - public function getRelatedCoauthors() + public function getRelatedCoauthors(): array { return []; } @@ -765,7 +767,7 @@ public function getRelatedCoauthors() * Retrieve post tags count * @return int */ - public function getTagsCount() + public function getTagsCount(): int { return count($this->getRelatedTags()); } @@ -887,7 +889,7 @@ public function getAuthor() * Retrieve if is visible on store * @return bool */ - public function isVisibleOnStore($storeId) + public function isVisibleOnStore($storeId): bool { return $this->getIsActive() && $this->getData('publish_time') <= $this->getResource()->getDate()->gmtDate() @@ -898,7 +900,7 @@ public function isVisibleOnStore($storeId) * Retrieve if is preview secret is valid * @return bool */ - public function isValidSecret($secret) + public function isValidSecret($secret): bool { return ($secret && $this->getSecret() === $secret); } @@ -908,7 +910,7 @@ public function isValidSecret($secret) * @param string $format * @return string */ - public function getPublishDate($format = '') + public function getPublishDate($format = ''): string|array { if (!$format) { $format = $this->scopeConfig->getValue( @@ -934,7 +936,7 @@ public function getPublishDate($format = '') * Retrieve true if post publish date display is enabled * @return bool */ - public function isPublishDateEnabled() + public function isPublishDateEnabled(): bool { return (bool)$this->scopeConfig->getValue( 'mfblog/design/publication_date', @@ -947,7 +949,7 @@ public function isPublishDateEnabled() * @param string $format * @return string */ - public function getUpdateDate($format = 'Y-m-d H:i:s') + public function getUpdateDate($format = 'Y-m-d H:i:s'): string|array { return \Magefan\Blog\Helper\Data::getTranslatedDate( $format, @@ -975,7 +977,7 @@ public function getPostImage() * @return self * @deprecated replaced with getDynamicData */ - public function initDinamicData() + public function initDinamicData(): static { $keys = [ 'og_image', @@ -1164,7 +1166,7 @@ public function getShortContentExtractor() * Retrieve reading time * @return int */ - public function getReadingTime() + public function getReadingTime(): int { if (!$this->getData('reading_time')) { $wpm = 250; diff --git a/Model/PostManagement.php b/Model/PostManagement.php index aaa14c55..1d24ec33 100644 --- a/Model/PostManagement.php +++ b/Model/PostManagement.php @@ -1,11 +1,13 @@ postResourceModel->delete($post); @@ -160,7 +163,7 @@ public function delete(Post $post) * @throws NoSuchEntityException * @throws StateException */ - public function deleteById($postId) + public function deleteById($postId): bool { return $this->delete($this->getById($postId)); } diff --git a/Model/PreviewUrl.php b/Model/PreviewUrl.php index a29f96db..cdba1ed1 100644 --- a/Model/PreviewUrl.php +++ b/Model/PreviewUrl.php @@ -1,11 +1,13 @@ getStoreIds(); if (count($storeIds)) { diff --git a/Model/ResourceModel/Author.php b/Model/ResourceModel/Author.php index 75c6097b..2648cf78 100755 --- a/Model/ResourceModel/Author.php +++ b/Model/ResourceModel/Author.php @@ -1,11 +1,13 @@ getData('identifier')); } @@ -220,7 +222,7 @@ protected function isNumericPageIdentifier(\Magento\Framework\Model\AbstractMode * @param \Magento\Framework\Model\AbstractModel $object * @return bool */ - protected function isValidPageIdentifier(\Magento\Framework\Model\AbstractModel $object) + protected function isValidPageIdentifier(\Magento\Framework\Model\AbstractModel $object): int|false { return preg_match('/^([^?#<>@!&*()$%^\\+=,{}"\']+)?$/', (string)$object->getData('identifier')); } @@ -233,7 +235,7 @@ protected function isValidPageIdentifier(\Magento\Framework\Model\AbstractModel * @param int|array $storeId * @return false|string */ - public function checkIdentifier($identifier, $storeIds) + public function checkIdentifier($identifier, $storeIds): string|false { if (!is_array($storeIds)) { $storeIds = [$storeIds]; @@ -288,7 +290,7 @@ public function lookupStoreIds($categoryId, $useCache = true) /** * @return string */ - public function getEntityType() + public function getEntityType(): string { return 'category'; } diff --git a/Model/ResourceModel/Category/Collection.php b/Model/ResourceModel/Category/Collection.php index 2aa36383..f262b399 100755 --- a/Model/ResourceModel/Category/Collection.php +++ b/Model/ResourceModel/Category/Collection.php @@ -1,11 +1,13 @@ getConnection(); diff --git a/Model/ResourceModel/Comment/Collection.php b/Model/ResourceModel/Comment/Collection.php index 9a1a34c9..2770c399 100755 --- a/Model/ResourceModel/Comment/Collection.php +++ b/Model/ResourceModel/Comment/Collection.php @@ -1,11 +1,13 @@ getFlag('post_filter_added')) { if ($post instanceof \Magefan\Blog\Model\Post) { diff --git a/Model/ResourceModel/Comment/Collection/Grid.php b/Model/ResourceModel/Comment/Collection/Grid.php index bd65f6c1..a948f8e9 100755 --- a/Model/ResourceModel/Comment/Collection/Grid.php +++ b/Model/ResourceModel/Comment/Collection/Grid.php @@ -1,11 +1,13 @@ getData('identifier')) { return; diff --git a/Model/ResourceModel/Post.php b/Model/ResourceModel/Post.php index cab04d1d..cf48cc79 100755 --- a/Model/ResourceModel/Post.php +++ b/Model/ResourceModel/Post.php @@ -1,11 +1,13 @@ getConnection()->update( $this->getMainTable(), @@ -232,7 +234,7 @@ public function updateLinks( array $newRelatedIds, array $oldRelatedIds, $tableName, - $field, + string $field, $rowData = [] ) { return $this->_updateLinks($object, $newRelatedIds, $oldRelatedIds, $tableName, $field, $rowData); @@ -253,7 +255,7 @@ protected function _updateLinks( array $newRelatedIds, array $oldRelatedIds, $tableName, - $field, + string $field, $rowData = [] ) { $table = $this->getTable($tableName); @@ -377,7 +379,7 @@ protected function _getLoadByIdentifierSelect($identifier, $storeIds) * @param \Magento\Framework\Model\AbstractModel $object * @return bool */ - protected function isNumericPageIdentifier(\Magento\Framework\Model\AbstractModel $object) + protected function isNumericPageIdentifier(\Magento\Framework\Model\AbstractModel $object): int|false { return preg_match('/^[0-9]+$/', (string)$object->getData('identifier')); } @@ -388,7 +390,7 @@ protected function isNumericPageIdentifier(\Magento\Framework\Model\AbstractMode * @param \Magento\Framework\Model\AbstractModel $object * @return bool */ - protected function isValidPageIdentifier(\Magento\Framework\Model\AbstractModel $object) + protected function isValidPageIdentifier(\Magento\Framework\Model\AbstractModel $object): int|false { return preg_match('/^([^?#<>@!&*()$%^\\+=,{}"\']+)?$/', (string)$object->getData('identifier')); } @@ -401,7 +403,7 @@ protected function isValidPageIdentifier(\Magento\Framework\Model\AbstractModel * @param int|array $storeId * @return false|string */ - public function checkIdentifier($identifier, $storeIds) + public function checkIdentifier($identifier, $storeIds): string|false { if (!is_array($storeIds)) { $storeIds = [$storeIds]; @@ -531,7 +533,7 @@ protected function _lookupAll($postId, $tableName, $field) /** * @return string */ - public function getEntityType() + public function getEntityType(): string { return 'post'; } diff --git a/Model/ResourceModel/Post/Collection.php b/Model/ResourceModel/Post/Collection.php index 20a8d646..10a6e4b0 100755 --- a/Model/ResourceModel/Post/Collection.php +++ b/Model/ResourceModel/Post/Collection.php @@ -1,11 +1,13 @@ getSelect() ->where('YEAR(main_table.publish_time) = ?', $year); @@ -367,7 +369,7 @@ public function addArchiveFilter($year, $month) * @param string $term * @return $this */ - public function addSearchFilter($term) + public function addSearchFilter($term): static { if (!$term) { $term = '__EMPTY_SEARCH_VALUE__'; @@ -452,7 +454,7 @@ public function getSearchRateExpression($term, array $columns): string * @param array|int|string|\Magefan\Blog\Model\Tag $tag * @return $this */ - public function addTagFilter($tag) + public function addTagFilter($tag): static { if (!$this->getFlag('tag_filter_added')) { if ($tag instanceof \Magefan\Blog\Model\Tag) { @@ -530,7 +532,7 @@ public function addTagFilter($tag) * @param array|int|\Magefan\Blog\Model\Author $author * @return $this */ - public function addAuthorFilter($author) + public function addAuthorFilter($author): static { if (!$this->getFlag('author_filter_added')) { if ($author instanceof \Magefan\Blog\Model\Author) { @@ -575,7 +577,7 @@ public function addAuthorFilter($author) * @param $product * @return $this */ - public function addRelatedProductFilter($product) + public function addRelatedProductFilter($product): static { if (!$this->getFlag('author_filter_added')) { if ($product instanceof \Magento\Catalog\Api\Data\ProductInterface) { diff --git a/Model/ResourceModel/Tag.php b/Model/ResourceModel/Tag.php index 42df0172..c447a5ad 100755 --- a/Model/ResourceModel/Tag.php +++ b/Model/ResourceModel/Tag.php @@ -1,11 +1,13 @@ getData('identifier')); } @@ -160,7 +162,7 @@ protected function isNumericPageIdentifier(\Magento\Framework\Model\AbstractMode * @param \Magento\Framework\Model\AbstractModel $object * @return bool */ - protected function isValidPageIdentifier(\Magento\Framework\Model\AbstractModel $object) + protected function isValidPageIdentifier(\Magento\Framework\Model\AbstractModel $object): int|false { return preg_match('/^([^?#<>@!&*()$%^\\+=,{}"\']+)?$/', (string)$object->getData('identifier')); } @@ -173,7 +175,7 @@ protected function isValidPageIdentifier(\Magento\Framework\Model\AbstractModel * @param int|array $storeId * @return false|string */ - public function checkIdentifier($identifier, $storeIds) + public function checkIdentifier($identifier, $storeIds): string|false { if (!is_array($storeIds)) { $storeIds = [$storeIds]; @@ -267,7 +269,7 @@ protected function _updateLinks( array $newRelatedIds, array $oldRelatedIds, $tableName, - $field, + string $field, $rowData = [] ) { $table = $this->getTable($tableName); @@ -344,7 +346,7 @@ protected function _lookupAll($tagId, $tableName, $field) /** * @return string */ - public function getEntityType() + public function getEntityType(): string { return 'tag'; } diff --git a/Model/ResourceModel/Tag/Collection.php b/Model/ResourceModel/Tag/Collection.php index 41973f45..a7b0c62b 100755 --- a/Model/ResourceModel/Tag/Collection.php +++ b/Model/ResourceModel/Tag/Collection.php @@ -1,11 +1,13 @@ scopeConfig->getValue(Config::XML_PATH_EXTENSION_ENABLED, ScopeInterface::SCOPE_STORE); diff --git a/Model/Tag.php b/Model/Tag.php index a4bf9cc6..a2df625f 100755 --- a/Model/Tag.php +++ b/Model/Tag.php @@ -1,11 +1,13 @@ getIsActive() == self::STATUS_ENABLED); } @@ -109,7 +111,7 @@ public function isActive() * Retrieve if is visible on store * @return bool */ - public function isVisibleOnStore($storeId) + public function isVisibleOnStore($storeId): bool { return $this->getIsActive() && (null === $storeId || array_intersect([0, $storeId], $this->getStoreIds())); @@ -120,7 +122,7 @@ public function isVisibleOnStore($storeId) * @param boolean $plural * @return string */ - public function getOwnTitle($plural = false) + public function getOwnTitle($plural = false): string { return $plural ? 'Tags' : 'Tag'; } @@ -133,7 +135,7 @@ public function getOwnTitle($plural = false) * @param int $storeId * @return int */ - public function checkIdentifier($identifier, $storeId) + public function checkIdentifier($identifier, $storeId): string|false { return $this->_getResource()->checkIdentifier($identifier, $storeId); } @@ -166,7 +168,7 @@ public function getTagUrl() * Retrieve meta title * @return string */ - public function getMetaTitle() + public function getMetaTitle(): string { $title = $this->getData('meta_title'); if (!$title) { @@ -180,7 +182,7 @@ public function getMetaTitle() * Retrieve meta description * @return string */ - public function getMetaDescription() + public function getMetaDescription(): string { $desc = $this->getData('meta_description'); if (!$desc) { @@ -218,7 +220,7 @@ public function getIdentities() * * @return string */ - public function getIdentifier() + public function getIdentifier(): string { return (string)$this->getData('identifier'); } diff --git a/Model/Tag/AutocompleteData.php b/Model/Tag/AutocompleteData.php index 4b9951bb..ce48def5 100644 --- a/Model/Tag/AutocompleteData.php +++ b/Model/Tag/AutocompleteData.php @@ -1,11 +1,13 @@ collectionFactory->create(); $collection diff --git a/Model/TagRepository.php b/Model/TagRepository.php index d298dea9..42174b53 100644 --- a/Model/TagRepository.php +++ b/Model/TagRepository.php @@ -1,4 +1,7 @@ tagResourceModel->delete($tag); @@ -159,7 +162,7 @@ public function delete(Tag $tag) * @throws NoSuchEntityException * @throws StateException */ - public function deleteById($tagId) + public function deleteById($tagId): bool { return $this->delete($this->getById($tagId)); } diff --git a/Model/Url.php b/Model/Url.php index cbd31c40..53f17db1 100644 --- a/Model/Url.php +++ b/Model/Url.php @@ -1,11 +1,13 @@ _getConfig($controllerName . '_sufix')); } @@ -383,7 +385,7 @@ public function getUrlSufix($controllerName) * @param string $file * @return string */ - public function getMediaUrl($file) + public function getMediaUrl(string $file): string { return $this->_storeManager->getStore() ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $file; @@ -401,7 +403,7 @@ public function getStoreId() * @param $storeId * @return $this */ - public function setStoreId($storeId) + public function setStoreId($storeId): static { $this->storeId = $storeId; return $this; @@ -412,7 +414,7 @@ public function setStoreId($storeId) * @param $store * @throws \Exception */ - public function startStoreEmulation($store) + public function startStoreEmulation($store): void { if (null !== $this->originalStore) { throw new \Exception('Cannot start Blog URL store emulation, emulation already started.'); @@ -426,7 +428,7 @@ public function startStoreEmulation($store) /** * Stop blog URL store emulation */ - public function stopStoreEmulation() + public function stopStoreEmulation(): void { if ($this->originalStore) { $this->setStoreId($this->originalStore->getId()); @@ -443,7 +445,7 @@ public function stopStoreEmulation() * @param string $key * @return string || null || int */ - protected function _getConfig($key) + protected function _getConfig(string $key) { return $this->_scopeConfig->getValue( 'mfblog/permalink/'.$key, diff --git a/Model/UrlResolver.php b/Model/UrlResolver.php index 5bdd59a0..c499d6d9 100644 --- a/Model/UrlResolver.php +++ b/Model/UrlResolver.php @@ -1,4 +1,7 @@ storeId = $storeId; } @@ -227,7 +230,7 @@ public function setStoreId($storeId) * @param string $identifier * @return int */ - protected function _getPostId($identifier, $checkSufix = true) + protected function _getPostId(string $identifier, $checkSufix = true) { return $this->getObjectId( $this->postFactory, @@ -242,7 +245,7 @@ protected function _getPostId($identifier, $checkSufix = true) * @param string $identifier * @return int */ - protected function _getCategoryId($identifier, $checkSufix = true) + protected function _getCategoryId(string $identifier, $checkSufix = true) { return $this->getObjectId( $this->categoryFactory, @@ -258,7 +261,7 @@ protected function _getCategoryId($identifier, $checkSufix = true) * @param bool $checkSufix * @return int */ - protected function _getAuthorId($identifier, $checkSufix = true) + protected function _getAuthorId(string $identifier, $checkSufix = true) { return $this->getObjectId( $this->authorFactory, @@ -274,7 +277,7 @@ protected function _getAuthorId($identifier, $checkSufix = true) * @param bool $checkSufix * @return int */ - protected function _getTagId($identifier, $checkSufix = true) + protected function _getTagId(string $identifier, $checkSufix = true) { return $this->getObjectId( $this->tagFactory, @@ -291,7 +294,7 @@ protected function _getTagId($identifier, $checkSufix = true) * @param bool $checkSufix * @return mixed */ - protected function getObjectId($factory, $controllerName, $identifier, $checkSufix) + protected function getObjectId($factory, string $controllerName, string $identifier, $checkSufix) { $storeId = $this->storeId ?: $this->storeManager->getStore()->getId(); $key = $storeId . '-' . $controllerName . '-' .$identifier . ($checkSufix ? '-checksufix' : ''); @@ -319,7 +322,7 @@ protected function getObjectId($factory, $controllerName, $identifier, $checkSuf * @param string $identifier * @return boolean */ - protected function _isArchiveIdentifier($identifier) + protected function _isArchiveIdentifier($identifier): bool { $info = explode('-', $identifier); if (!empty($info[1])) { diff --git a/Observer/InvalidateCache.php b/Observer/InvalidateCache.php index 6c3f74db..58dd9634 100755 --- a/Observer/InvalidateCache.php +++ b/Observer/InvalidateCache.php @@ -1,11 +1,13 @@ _config->isEnabled()) { $this->_typeList->invalidate( diff --git a/Observer/LayoutGenerateBlocksAfter.php b/Observer/LayoutGenerateBlocksAfter.php index c8368e71..7f93a8dd 100644 --- a/Observer/LayoutGenerateBlocksAfter.php +++ b/Observer/LayoutGenerateBlocksAfter.php @@ -1,11 +1,13 @@ config->isEnabled()) { $post = $this->registry->registry('current_blog_post'); diff --git a/Observer/PageBlockHtmlTopmenuBethtmlBeforeObserver.php b/Observer/PageBlockHtmlTopmenuBethtmlBeforeObserver.php index 624e853b..8293cffe 100644 --- a/Observer/PageBlockHtmlTopmenuBethtmlBeforeObserver.php +++ b/Observer/PageBlockHtmlTopmenuBethtmlBeforeObserver.php @@ -1,11 +1,13 @@ getMenu(); diff --git a/Observer/PredispathFrontendBlogActionControllerObserver.php b/Observer/PredispathFrontendBlogActionControllerObserver.php index 7cd3157e..28ccb211 100644 --- a/Observer/PredispathFrontendBlogActionControllerObserver.php +++ b/Observer/PredispathFrontendBlogActionControllerObserver.php @@ -1,4 +1,7 @@ scopeConfig->getValue( Config::XML_PATH_ADVANCED_PERMALINK_ENABLED, diff --git a/Plugin/Magento/AdminGws/Model/ModelsPlugin.php b/Plugin/Magento/AdminGws/Model/ModelsPlugin.php index 3ffe401f..f6157f0a 100644 --- a/Plugin/Magento/AdminGws/Model/ModelsPlugin.php +++ b/Plugin/Magento/AdminGws/Model/ModelsPlugin.php @@ -1,11 +1,13 @@ state->setAreaCode('adminhtml'); diff --git a/Setup/Patch/Data/TagInStore.php b/Setup/Patch/Data/TagInStore.php index 00b4e50e..f25844df 100644 --- a/Setup/Patch/Data/TagInStore.php +++ b/Setup/Patch/Data/TagInStore.php @@ -55,7 +55,7 @@ public static function getVersion() /** * {@inheritdoc} */ - public function apply() + public function apply(): void { $connection = $this->resourceConnection->getConnection(); diff --git a/Setup/Patch/Data/UpdatePostCommentsCount.php b/Setup/Patch/Data/UpdatePostCommentsCount.php index feedfac3..9491527e 100644 --- a/Setup/Patch/Data/UpdatePostCommentsCount.php +++ b/Setup/Patch/Data/UpdatePostCommentsCount.php @@ -40,7 +40,7 @@ public function __construct( /** * {@inheritdoc} */ - public function apply() + public function apply(): void { $connection = $this->commentResource->getConnection(); $postSelect = $connection->select()->from( diff --git a/Ui/DataProvider/Category/Form/CategoryDataProvider.php b/Ui/DataProvider/Category/Form/CategoryDataProvider.php index 276b5978..8bc744e1 100644 --- a/Ui/DataProvider/Category/Form/CategoryDataProvider.php +++ b/Ui/DataProvider/Category/Form/CategoryDataProvider.php @@ -1,4 +1,7 @@ config->getIncludeBootstrapCustomMini()) { return '';