Skip to content

Commit

Permalink
chore: increases phpstan level to 1 (algolia#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro authored and damcou committed Oct 24, 2019
1 parent bd00c4b commit 4f2960f
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Block/LandingPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use Magento\Cms\Model\Template\FilterProvider;
use Magento\Search\Model\QueryFactory;

/**
* @method int getPageId()
*/
class LandingPage extends Result
{
/** @var FilterProvider */
Expand Down
2 changes: 1 addition & 1 deletion Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ private function getCategoryRecords($storeId, $collection, $potentiallyDeletedCa
unset($potentiallyDeletedCategoriesIds[$categoryId]);
}

if (isset($categorysToIndex[$categoryId]) || isset($categorysToRemove[$categoryId])) {
if (isset($categoriesToIndex[$categoryId]) || isset($categoriesToRemove[$categoryId])) {
continue;
}

Expand Down
1 change: 1 addition & 0 deletions Model/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @method int getMaxRetries()
* @method array getDecodedData()
* @method array getMergedIds()
* @method $this setErrorLog(string $message)
* @method $this setPid($pid)
* @method $this setRetries($retries)
* @method $this setStoreId($storeId)
Expand Down
6 changes: 6 additions & 0 deletions Model/Layer/Filter/Decimal.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

use Algolia\AlgoliaSearch\Helper\ConfigHelper;

/**
* @method $this setMinValue(float $value)
* @method $this setMaxValue(float $value)
* @method string getFrom(string $value)
* @method string getTo(string $value)
*/
class Decimal extends \Magento\CatalogSearch\Model\Layer\Filter\Decimal
{
/** @var \Magento\Catalog\Model\Layer\Filter\DataProvider\Price */
Expand Down
9 changes: 9 additions & 0 deletions Model/Layer/Filter/Item/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

namespace Algolia\AlgoliaSearch\Model\Layer\Filter\Item;

/**
* @method bool getIsSelected()
* @method mixed getValue()
* @method mixed getApplyFilterValue()
* @method string getLabel()
*/
class Attribute extends \Magento\Catalog\Model\Layer\Filter\Item
{
/**
Expand Down Expand Up @@ -41,9 +47,12 @@ public function getRemoveUrl()
}
}

$resetValue = null;

if (!is_null($idToRemove)) {
$resetValue = array_diff($this->getApplyValue(), [$idToRemove]);
}

$query = [$this->getFilter()->getRequestVar() => implode('~', $resetValue)];
}

Expand Down
5 changes: 5 additions & 0 deletions Model/Layer/Filter/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

use Algolia\AlgoliaSearch\Helper\ConfigHelper;

/**
* @method $this setMinValue(float $value)
* @method $this setMaxValue(float $value)
* @method $this setCurrentValue(array<string, float> $value)
*/
class Price extends \Magento\CatalogSearch\Model\Layer\Filter\Price
{
/** @var \Magento\Catalog\Model\Layer\Filter\DataProvider\Price */
Expand Down
7 changes: 5 additions & 2 deletions ViewModel/Adminhtml/Analytics/Overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ public function getDailySearchData()
$searches = $this->getSearchesByDates();
$users = $this->getUsersCountByDates();
$rates = $this->getResultRateByDates();
$clickPosition = null;
$conversion = null;
$ctr = null;

if ($this->isClickAnalyticsEnabled()) {
$clickPosition = $this->getClickPositionByDates();
Expand Down Expand Up @@ -452,10 +455,10 @@ public function getMessagesHtml()
->createBlock(\Magento\Framework\View\Element\Messages::class);

if (!$this->checkIsValidDateRange() && $this->isAnalyticsApiEnabled()) {
$noticeHtml = __('The selected date is out of your analytics retention window (%1 days),
$noticeHtml = __('The selected date is out of your analytics retention window (%1 days),
your data might not be present anymore.', $this->getAnalyticRetentionDays());
$noticeHtml .= '<br/>';
$noticeHtml .= __('To increase your retention and access more data, you could switch to a
$noticeHtml .= __('To increase your retention and access more data, you could switch to a
<a href="%1" target="_blank">higher plan.</a>', 'https://www.algolia.com/billing/overview/');

$messagesBlock->addNotice($noticeHtml);
Expand Down
5 changes: 1 addition & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 0
level: 1
reportUnmatchedIgnoredErrors: false
paths:
- vendor/algolia/algoliasearch-magento-2/Adapter
Expand All @@ -18,7 +18,4 @@ parameters:
- vendor/algolia/algoliasearch-magento-2/ViewModel
- vendor/algolia/algoliasearch-magento-2/registration.php
ignoreErrors:
- '#(class|type) Magento\\\S*Factory#i'
- '#(class|type) Algolia\\\S*Factory#i'
- '#Call to static method getObjectManager\(\) on an unknown class Magento\\TestFramework\\Helper\\Bootstrap.#'
- '#Parameter \$clientFactory of method Algolia\\AlgoliaSearch\\Helper\\AlgoliaHelper::__construct\(\) has invalid typehint type AlgoliaSearch\\ClientFactory.#'

0 comments on commit 4f2960f

Please sign in to comment.