Skip to content

Commit 6af029a

Browse files
pradeepkanakaPradeep Kanaka
andauthored
Fix App Assurance Remediation: PHPStan issues (#793)
* Fix phpstan issues * Fix: Kodiak: Security Findings * Fix Console Error logs --------- Co-authored-by: Pradeep Kanaka <[email protected]>
1 parent 41a59c4 commit 6af029a

27 files changed

+56
-43
lines changed

app/code/Meta/BusinessExtension/Model/MBEInstalls.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ private function savePixelId($pixelId, $storeId)
172172
$storeId
173173
);
174174
$this->fbeHelper->fetchAndSaveAAMSettings($pixelId, $storeId);
175-
$this->fbeHelper->log("Saved fbe_installs pixel_id --- {$pixelId} for storeId: {$storeId}");
175+
$this->fbeHelper->log(
176+
"Saved fbe_installs pixel_id --- " . json_encode($pixelId) . " for storeId: {$storeId}"
177+
);
176178
} else {
177179
$this->systemConfig->saveConfig(
178180
SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_PIXEL_ID,

app/code/Meta/BusinessExtension/Model/System/Config.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ class Config
166166
private ?string $version = '1.3.5-dev';
167167

168168
/**
169-
* @method __construct
169+
* Config class constructor
170+
*
170171
* @param StoreManagerInterface $storeManager
171172
* @param ScopeConfigInterface $scopeConfig
172173
* @param ResourceConfig $resourceConfig
@@ -279,7 +280,6 @@ public function getPromotionsUrl($storeId = null): string
279280
/**
280281
* Is single store mode
281282
*
282-
* @method isSingleStoreMode
283283
* @return bool
284284
*/
285285
public function isSingleStoreMode(): bool
@@ -413,7 +413,7 @@ public function shouldUseDefaultFulfillmentAddress($scopeId = null, $scope = nul
413413
* Get fulfillment address
414414
*
415415
* @param int $scopeId
416-
* @param int $scope
416+
* @param string $scope
417417
* @return array
418418
*/
419419
public function getFulfillmentAddress($scopeId = null, $scope = ScopeInterface::SCOPE_STORES): array
@@ -622,7 +622,7 @@ public function getExternalBusinessId($scopeId = null, $scope = null)
622622
* Get pixel id
623623
*
624624
* @param int $scopeId
625-
* @param int $scope
625+
* @param string $scope
626626
* @return mixed
627627
*/
628628
public function getPixelId($scopeId = null, $scope = ScopeInterface::SCOPE_STORES)
@@ -714,7 +714,7 @@ public function getCommerceAccountId($scopeId = null, $scope = null)
714714
* Get commerce partner integration ID
715715
*
716716
* @param int $scopeId
717-
* @param int $scope
717+
* @param string $scope
718718
* @return mixed|null
719719
*/
720720
public function getCommercePartnerIntegrationId($scopeId = null, $scope = ScopeInterface::SCOPE_STORES)
@@ -789,7 +789,7 @@ public function getShippingMethodsMap($storeId = null): array
789789
* Get shipping methods label map
790790
*
791791
* @param int|null $storeId
792-
* @return array|null
792+
* @return array
793793
*/
794794
public function getShippingMethodsLabelMap($storeId = null): array
795795
{

app/code/Meta/BusinessExtension/Setup/Patch/Data/ModifyMetaCronjobExecution.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public function apply()
6565
);
6666

6767
$this->moduleDataSetup->getConnection()->endSetup();
68+
69+
return $this;
6870
}
6971

7072
/**

app/code/Meta/Catalog/Model/Product/Feed/Builder/AdditionalAttributes.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
use Exception;
2424
use Magento\Catalog\Model\Product;
25-
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
25+
use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory;
2626
use Magento\Catalog\Setup\CategorySetup;
2727
use Meta\BusinessExtension\Helper\FBEHelper;
2828

@@ -35,18 +35,18 @@ class AdditionalAttributes
3535
private $fbeHelper;
3636

3737
/**
38-
* @var Attribute
38+
* @var AttributeFactory
3939
*/
4040
private $attributeFactory;
4141

4242
/**
4343
* Constructor
4444
*
45-
* @param Attribute $attributeFactory
45+
* @param AttributeFactory $attributeFactory
4646
* @param FBEHelper $fbeHelper
4747
*/
4848
public function __construct(
49-
Attribute $attributeFactory,
49+
AttributeFactory $attributeFactory,
5050
FBEHelper $fbeHelper
5151
) {
5252
$this->fbeHelper = $fbeHelper;
@@ -183,7 +183,7 @@ function ($attributeList) {
183183
private function getAttributeList(callable $attributeFilterFn): array
184184
{
185185
$attributes = [];
186-
$attributeList = $this->attributeFactory->getCollection();
186+
$attributeList = $this->attributeFactory->create()->getCollection();
187187
if ($attributeList) {
188188
if ($attributeFilterFn) {
189189
$attributeFilterFn($attributeList);

app/code/Meta/Catalog/Observer/ProcessCategoryAfterSaveEventObserver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Magento\Framework\Event\Observer;
2525
use Magento\Framework\Event\ObserverInterface;
2626
use Magento\Framework\Message\ManagerInterface;
27+
use Magento\Catalog\Model\Category;
2728
use Meta\BusinessExtension\Helper\FBEHelper;
2829
use Meta\BusinessExtension\Model\System\Config as SystemConfig;
2930
use Meta\Catalog\Model\Category\CategoryCollection;

app/code/Meta/Catalog/Plugin/FacebookCatalogDeletePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class FacebookCatalogDeletePlugin
3131
{
3232

3333
/**
34-
* @var FacebokoCatalogUpdate
34+
* @var FacebookCatalogUpdate
3535
*/
3636
private $catalogUpdateResourceModel;
3737

app/code/Meta/Catalog/Setup/Patch/Data/AddCategoryAttributes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Magento\Catalog\Model\Category;
88
use Magento\Framework\Setup\Patch\DataPatchInterface;
99
use Magento\Eav\Setup\EavSetupFactory;
10+
use Magento\Eav\Setup\EavSetup;
1011
use Magento\Framework\Setup\ModuleDataSetupInterface;
1112
use Meta\Catalog\Setup\MetaCatalogAttributes;
1213

app/code/Meta/Conversion/Block/Pixel/InitiateCheckout.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,12 @@ public function getQuote(): Quote
180180
public function getContentCategory(): string
181181
{
182182
$items = $this->getQuote()->getAllVisibleItems();
183+
$contentCategory = '';
183184
foreach ($items as $item) {
184185
$product = $item->getProduct();
185186
$contentCategory = $this->magentoDataHelper->getCategoriesForProduct($product);
186187
}
187-
return $contentCategory;/** @phpstan-ignore-line */
188+
return $contentCategory;
188189
}
189190

190191
/**

app/code/Meta/Conversion/Block/Pixel/Purchase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function getContentName()
178178
if ($order) {
179179
$items = $order->getAllVisibleItems();
180180
foreach ($items as $item) {
181-
/** @var Product $product */
181+
/** @var Product $item */
182182
$productName[] = $item->getName();
183183
}
184184
}

app/code/Meta/Conversion/Block/Pixel/ViewContent.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
namespace Meta\Conversion\Block\Pixel;
2222

2323
use Exception;
24+
use Magento\Catalog\Block\Product\View;
2425
use Magento\Catalog\Helper\Data as CatalogHelper;
2526
use Magento\Catalog\Model\Product;
2627
use Meta\BusinessExtension\Helper\FBEHelper;
@@ -205,6 +206,7 @@ public function getProductId()
205206
public function getCurrentProduct()
206207
{
207208
try {
209+
/** @var View $block */
208210
$block = $this->getLayout()->getBlock('product.info');
209211
return $block ? $block->getProduct() : $this->catalogHelper->getProduct();
210212
} catch (Exception $e) {

0 commit comments

Comments
 (0)