Skip to content

Commit

Permalink
Merge pull request #240 from Nosto/hotfix/2.4.5
Browse files Browse the repository at this point in the history
Hotfix 2.4.5 - Bump require dev min PHP version and upgrade dependencies
  • Loading branch information
supercid authored Mar 31, 2020
2 parents ae36b42 + 6b48079 commit 7cb7bab
Show file tree
Hide file tree
Showing 16 changed files with 1,644 additions and 718 deletions.
9 changes: 6 additions & 3 deletions Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
class Shopware_Plugins_Frontend_NostoTagging_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{
const PLATFORM_NAME = 'shopware';
const PLUGIN_VERSION = '2.4.4';
const PLUGIN_VERSION = '2.4.5';
const MENU_PARENT_ID = 23; // Configuration
const NEW_ENTITY_MANAGER_VERSION = '5.0.0';
const NEW_ATTRIBUTE_MANAGER_VERSION = '5.2.0';
Expand Down Expand Up @@ -382,7 +382,7 @@ private function addMyAttribute(array $attribute)
$attribute['type']
);
} else {
/** @noinspection PhpDeprecationInspection */
/** @phan-suppress-next-line PhanUndeclaredMethod */
Shopware()->Models()->addAttribute(
$attribute['table'],
$attribute['prefix'],
Expand Down Expand Up @@ -462,6 +462,7 @@ protected function createMyMenu()
* @return mixed|string
* @throws InvalidArgumentException
* @throws NostoException in case version cannot be determined
* @suppress PhanUndeclaredConstantOfClass
*/
public function getShopwareVersion()
{
Expand Down Expand Up @@ -604,6 +605,7 @@ protected function registerMyEvents()
*/
public function getAllActiveShops()
{
/** @phan-suppress-next-line UndeclaredTypeInInlineVar */
/** @var \Shopware_Proxies_ShopwareModelsShopRepositoryProxy $repository */
$repository = Shopware()->Container()->get('models')->getRepository('Shopware\Models\Shop\Shop');
return $repository->getActiveShops();
Expand Down Expand Up @@ -779,7 +781,7 @@ private function removeMyAttribute(array $attribute)
$fieldName
);
} else {
/** @noinspection PhpDeprecationInspection */
/** @phan-suppress-next-line PhanUndeclaredMethod */
Shopware()->Models()->removeAttribute(
$attribute['table'],
$attribute['prefix'],
Expand Down Expand Up @@ -1300,6 +1302,7 @@ protected function addOrderTagging(Enlight_View_Default $view)
// number was not present in the order variables.
// This will be the case for Shopware <= 4.2.
$customerId = Shopware()->Session()->offsetGet('sUserId');
/** @phan-suppress-next-line PhanParamTooMany */
$order = Shopware()
->Models()
->getRepository('\Shopware\Models\Order\Order')
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## 2.4.5
- Update dependencies
- Upgrade Phan and fix inspections
- Bump minimal PHP version for require dev packages to 7.2

## 2.4.4
- Update composer dependencies

Expand Down
2 changes: 1 addition & 1 deletion Components/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Account
* @param Locale|null $locale the locale or null.
* @param stdClass|null $identity the user identity.
* @param string|null $email (optional) the account owner email if different than the active admin user.
* @param array|stdClass $details (optional) the account details.
* @param array|stdClass|null $details (optional) the account details.
* @return AccountCustomModel the newly created account.
* @throws NostoException if the account cannot be created for any reason.
* @suppress PhanTypeMismatchArgument
Expand Down
9 changes: 5 additions & 4 deletions Components/Helper/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,15 @@ public static function getAlternativeImageUrls(Article $article, Shop $shop)
* Assembles the product image url based on article.
*
* @param Image $image
* @param MediaServiceInterface|null $mediaService
* @param Shop $shop
* @param MediaServiceInterface|null $mediaService
* @return null|?string the url of the Image or null if image not found.
* @suppress PhanUndeclaredMethod $shop getters
*/
private static function buildUrl(
Image $image,
MediaServiceInterface $mediaService = null,
Shop $shop
Shop $shop,
MediaServiceInterface $mediaService = null
) {
$url = null;

Expand Down Expand Up @@ -160,7 +161,7 @@ private static function getImageUrls(Article $article, Shop $shop)

/** @var Shopware\Models\Article\Image $image */
foreach ($article->getImages() as $image) {
$imageUrl = self::buildUrl($image, $mediaService, $shop);
$imageUrl = self::buildUrl($image, $shop, $mediaService);
if ($imageUrl !== null) {
$imageUrls[] = $imageUrl;
if ($mainImageUrl === null || $image->getMain() === 1) {
Expand Down
4 changes: 2 additions & 2 deletions Components/Helper/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function generatePricePerUnit(Article $article, Shop $shop)
{
$mainDetail = $article->getMainDetail();
$unit = $mainDetail->getUnit();
$price = self::calcArticlePriceInclTax(
$price = (double)self::calcArticlePriceInclTax(
$article,
$shop,
self::PRICE_TYPE_NORMAL
Expand Down Expand Up @@ -339,7 +339,7 @@ private static function getProductPriceRateAfterDiscountForArticle(Article $arti
/**
* Get a price rate after discount
*
* @param ArrayCollection|[] $discounts
* @param ArrayCollection $discounts | [] $discounts
* @param Shop $shop
* @return float|int price rate after discount
*/
Expand Down
2 changes: 1 addition & 1 deletion Components/Meta/Account/Owner.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Meta_Account_Owner
/**
* Loads the data for the account owner.
*
* @param stdClass|null the user identity.
* @param stdClass $identity|null $identity the user identity.
*/
public function loadData($identity = null)
{
Expand Down
6 changes: 5 additions & 1 deletion Components/Model/Order/Buyer.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order_Buyer extend
*
* @param Customer $customer the customer model.
* @throws Enlight_Event_Exception
* @suppress PhanUndeclaredClassInstanceof
* @suppress PhanUndeclaredClassMethod
*/
public function loadData(Customer $customer)
{
Expand All @@ -81,9 +84,10 @@ public function loadData(Customer $customer)
$this->setCountry($address->getCountry()->getName());
}
} else {
/** @phan-suppress-next-line UndeclaredTypeInInlineVar */
/** @var Billing $address */
/** @noinspection PhpDeprecationInspection */
$address = $customer->getBilling();
$address = $customer->getBilling(); /** @phan-suppress-current-line PhanUndeclaredMethod */
/** @noinspection PhpDeprecationInspection */
if ($address instanceof Billing) {
$this->setFirstName($address->getFirstName());
Expand Down
2 changes: 1 addition & 1 deletion Components/Model/Order/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function loadData(Order $order)
$description = $status->getName();
} else {
/** @noinspection PhpDeprecationInspection */
$description = $status->getDescription();
$description = $status->getDescription(); /** @phan-suppress-current-line PhanUndeclaredMethod */
}
$this->setCode($this->convertDescriptionToCode($description));
$this->setLabel($description);
Expand Down
2 changes: 1 addition & 1 deletion Components/Model/Sku.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Model_Sku extends NostoS
*
* @param Detail $detail Article Detail to load the SKU information
* @param Shop|null $shop the shop the product belongs to
* @suppress PhanTypeMismatchArgumentNullable
*/
public function loadData(Detail $detail, Shop $shop = null)
{
if ($shop === null) {
$shop = Shopware()->Shop();
}

$this->setUrl(
Product::assembleProductUrl(
$detail->getArticle(),
Expand Down
4 changes: 2 additions & 2 deletions Components/Operation/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected function getAccounts(Article $article, $allStores = false)
/**
* Sends info to Nosto about a newly updated product.
*
* @param \Shopware\Models\Article\Article $article the product.
* @param Article $article the product.
* @throws Exception
* @suppress PhanDeprecatedFunction
*/
Expand All @@ -139,7 +139,7 @@ public function update(Article $article)
continue;
}
/** @noinspection PhpDeprecationInspection */
$shop->registerResources(Shopware()->Bootstrap());
$shop->registerResources(Shopware()->Bootstrap()); /** @phan-suppress-current-line PhanParamTooMany */
$model = new Product();
$model->loadData($article, $shop);
if ($model->getProductId()) {
Expand Down
2 changes: 1 addition & 1 deletion Controllers/backend/NostoTagging.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function getAccountsAction()
continue;
}
/** @noinspection PhpDeprecationInspection */
$shop->registerResources(Shopware()->Bootstrap());
$shop->registerResources(Shopware()->Bootstrap()); /** @phan-suppress-current-line PhanParamTooMany */
$account = NostoComponentAccount::findAccount($shop);
if (isset($oauthParams[$shop->getId()])) {
/** @noinspection PhpUndefinedVariableInspection */
Expand Down
5 changes: 4 additions & 1 deletion Controllers/frontend/NostoTagging.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,15 @@ class Shopware_Controllers_Frontend_NostoTagging extends Enlight_Controller_Acti
* Shopware_Controllers_Frontend_NostoTagging constructor.
* @param Enlight_Controller_Request_Request|null $request
* @param Enlight_Controller_Response_Response|null $response
* @throws Enlight_Event_Exception
* @throws Enlight_Exception
*/
public function __construct(
Enlight_Controller_Request_Request $request = null,
Enlight_Controller_Response_Response $response = null
) {
if ($request && $response) {
parent::__construct($request, $response);
parent::__construct($request, $response); /** @phan-suppress-current-line PhanParamTooMany */
}
$this->productRepository = new ProductRepository();
$this->accountRepository = new AccountRepository();
Expand Down Expand Up @@ -185,6 +187,7 @@ public function oauthAction()
$this->redirect($redirectParams, array('code' => 302));
} else {
/** @noinspection PhpUndefinedClassInspection */
/** @phan-suppress-next-line PhanUndeclaredClassMethod */
throw new Zend_Controller_Action_Exception('Not Found', 404);
}
}
Expand Down
18 changes: 10 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,22 @@ RUN apt-get update && apt-get -y -q install zip unzip wget libfreetype6-
apt-get -y clean

# Install Apache, MySQL and all the required development and prod PHP modules
RUN apt-get -y -qq install apache2 php7.1 php7.1-common default-mysql-client-core \
default-mysql-server-core default-mysql-server php7.1-dev \
php7.1-mcrypt php7.1-xsl php7.1-zip php7.1-bcmath php7.1-intl php7.1-gd \
php7.1-curl php7.1-mbstring php7.1-mysql php7.1-soap php-xml php7.1-xml && \
RUN apt-get -y -qq install apache2 php7.2 php7.2-common default-mysql-client-core \
default-mysql-server-core default-mysql-server php7.2-dev \
php7.2-xsl php7.2-zip php7.2-bcmath php7.2-intl php7.2-gd \
php7.2-curl php7.2-mbstring php7.2-mysql php7.2-soap php-xml php7.2-xml && \
apt-get -y clean

# Upgrade AST extension
# Upgrade AST & mcrypt extensions
RUN apt-get -y -qq install build-essential php-pear && \
pecl install ast-0.1.6 && \
pecl install ast && \
pecl install mcrypt-1.0.1 && \
apt-get purge -y build-essential && \
apt-get -y clean

# Enable AST extension
RUN echo "extension=ast.so" >> /etc/php/7.1/cli/php.ini
# Enable AST & mcrypt extensions
RUN echo "extension=ast.so" >> /etc/php/7.2/cli/php.ini
RUN echo "extension=mcrypt.so" >> /etc/php/7.2/cli/php.ini

RUN a2enmod rewrite && phpenmod ast soap && \
a2dissite 000-default.conf
Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
"license": [
"BSD-3-Clause"
],
"version": "2.4.4",
"version": "2.4.5",
"require": {
"php": ">=5.4.0",
"nosto/php-sdk": "3.15.0"
},
"require-dev": {
"php": ">=7.1.0",
"php": ">=7.2.0",
"squizlabs/php_codesniffer": "2.8.1",
"phan/phan": "0.8.9",
"phan/phan": "2.6.*",
"phpmd/phpmd": "^2.6",
"sebastian/phpcpd": "4.1.0",
"phing/phing": "2.*",
"shopware/shopware": "5.5.*",
"wimg/php-compatibility": "^9.0"
"shopware/shopware": "~5.6",
"wimg/php-compatibility": "^9.0",
"drenso/phan-extensions": "^2.5"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 7cb7bab

Please sign in to comment.