Skip to content

Commit

Permalink
FFWEB-2980: Update PHP and composer libraries
Browse files Browse the repository at this point in the history
* FFWEB-2980: Update PHP and composer libraries

* Update composer dependencies
* Add phpcs fixer as dev dependencies
* Fix deprecations from phpcs
* Remove phpcs needless comments
* Remove SSR rendering delay time
  • Loading branch information
Rayn93 authored Mar 14, 2024
1 parent f5b9f92 commit 4b48502
Show file tree
Hide file tree
Showing 102 changed files with 326 additions and 418 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Run Static analysis
run: |
vendor/bin/phpcs --config-set installed_paths vendor/magento/magento-coding-standard,vendor/phpcompatibility/php-compatibility
vendor/bin/phpcs --config-set installed_paths vendor/magento/magento-coding-standard,vendor/magento/php-compatibility-fork
vendor/bin/phpcs --standard=phpcs.xml.dist --extensions=php,phtml src
vendor/bin/phpmd src text phpmd.xml.dist
Expand Down
47 changes: 47 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* PHP Coding Standards fixer configuration
*/

$finder = PhpCsFixer\Finder::create()
->name('*.phtml')
->exclude('dev/tests/integration/tmp')
->exclude('dev/tests/integration/var')
->exclude('lib/internal/Cm')
->exclude('lib/internal/Credis')
->exclude('lib/internal/Less')
->exclude('lib/internal/LinLibertineFont')
->exclude('pub/media')
->exclude('pub/static')
->exclude('setup/vendor')
->exclude('var');

$config = new PhpCsFixer\Config();
$config->setFinder($finder)
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'include' => true,
'new_with_braces' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'multiline_whitespace_before_semicolons' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'ordered_imports' => true,
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
]);
return $config;
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Changelog
## Unreleased
### BREAKING
- Add support for PHP v8.2 and v8.3
- Upgrade magento libraries
- Upgrade composer dependencies
- Fix deprecations for magento/framework

### Remove
- Remove SSR rendering delay time

## [v4.3.0] - 2024.01.16
### Add
- Add landing page campaign
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[![Build status](https://github.com/FACT-Finder-Web-Components/magento2-module/workflows/build/badge.svg)](https://github.com/FACT-Finder-Web-Components/magento2-module/actions)
[![GitHub contributors](https://img.shields.io/github/contributors/FACT-Finder-Web-Components/magento2-module)](https://github.com/FACT-Finder-Web-Components/magento2-module/graphs/contributors)

This is a new version of SDK (not released yet). Support for new WebComponents v. NG

This document helps you integrate the FACT-Finder Web Components SDK into your Magento 2 Shop. In addition, it gives a
concise overview of its primary functions. The first chapter *Installation* walks you through the suggested installation
processes. The second chapter “Backend Configuration” explains the customisation options in the Magento 2 backend. The
Expand Down Expand Up @@ -122,8 +124,6 @@ The module uses [Mustache.php](https://github.com/bobthecow/mustache.php) librar

**Note:** More information about SSR concept you can find in the article [Server Side Rendering](https://web-components.fact-finder.de/documentation/4.x/server-side-rendering) from Web Components documentation.

**Note:** If you have a problem with displaying Fact-Finder campaign while using SSR please set a delay time for loading the SSR component. The number of seconds depends on your website speed.

### Advanced Settings

Advanced Settings contains additional parameters used for the `ff-communication` web component. Each setting is set to a
Expand Down
40 changes: 27 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@
}
],
"require": {
"php": "~8.1.0",
"omikron/factfinder-communication-sdk": "^0.9.5",
"magento/framework": "~103.0.4",
"magento/module-catalog": "~104.0.4",
"magento/module-configurable-product": "~100.4.4",
"magento/module-directory": "~100.4.4",
"magento/module-store": "~101.1.4",
"mustache/mustache": "^2.13",
"ext-json": "*"
"php": "~8.1.0||~8.2.0||~8.3.0",
"omikron/factfinder-communication-sdk": "^0.9.8",
"magento/framework": "^103.0.6",
"magento/module-catalog": "^104.0.6",
"magento/module-configurable-product": "^100.4.6",
"magento/module-directory": "^100.4.6",
"magento/module-store": "^101.1.6",
"mustache/mustache": "^2.14",
"ext-json": "*",
"phpseclib/phpseclib": "~3.0"
},
"require-dev": {
"pdepend/pdepend": "^2.8",
"phpmd/phpmd": "^2.9",
"pdepend/pdepend": "^2.16",
"phpmd/phpmd" : "^2.15",
"phpunit/phpunit": "~9.5.0",
"magento/magento-coding-standard": "*"
"magento/magento-coding-standard": "*",
"friendsofphp/php-cs-fixer": "^3.51"
},
"autoload": {
"files": [
Expand All @@ -38,7 +40,19 @@
"allow-plugins": {
"magento/*": true,
"omikron/*": true,
"mustache/mustache": true
"mustache/mustache": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"minimum-stability": "stable",
"prefer-stable": true,
"repositories": [
{
"type": "composer",
"url": "https://repo.magento.com/"
}
],
"extra": {
"magento-force": "override"
}
}
4 changes: 0 additions & 4 deletions src/Block/Adminhtml/System/Config/Field/ProductsPerPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

namespace Omikron\Factfinder\Block\Adminhtml\System\Config\Field;

use Magento\Backend\Block\Template\Context;
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
use Magento\Config\Model\Config\Source\Yesno;
use Magento\Framework\Data\OptionSourceInterface;
use Magento\Framework\DataObject;

/**
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

use Magento\Framework\App\State;
use Magento\Store\Model\StoreManagerInterface;
use Omikron\Factfinder\Api\StreamInterfaceFactory;
use Omikron\Factfinder\Model\Api\PushImport;
use Omikron\Factfinder\Model\Config\CommunicationConfig;
use Omikron\Factfinder\Model\Export\FeedFactory as FeedGeneratorFactory;
use Omikron\Factfinder\Model\FtpUploader;
use Omikron\Factfinder\Model\StoreEmulation;
use Omikron\Factfinder\Api\StreamInterfaceFactory;
use Omikron\Factfinder\Service\FeedFileService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
Expand Down
3 changes: 1 addition & 2 deletions src/Controller/Adminhtml/Export/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
use Magento\Backend\App\Action\Context;
use Magento\Framework\Controller\Result\JsonFactory;
use Magento\Store\Model\StoreManagerInterface;
use Omikron\FactFinder\Communication\Resource\Builder;
use Omikron\Factfinder\Api\StreamInterfaceFactory;
use Omikron\Factfinder\Model\Api\PushImport;
use Omikron\Factfinder\Model\Config\CommunicationConfig;
use Omikron\Factfinder\Model\Export\FeedFactory as FeedGeneratorFactory;
use Omikron\Factfinder\Model\FtpUploader;
use Omikron\Factfinder\Model\StoreEmulation;
use Omikron\Factfinder\Api\StreamInterfaceFactory;
use Omikron\Factfinder\Service\FeedFileService;

class Feed extends Action
Expand Down
1 change: 0 additions & 1 deletion src/Controller/Adminhtml/FieldRoles/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Omikron\FactFinder\Communication\Client\ClientBuilder;
use Omikron\FactFinder\Communication\Resource\AdapterFactory;
use Omikron\FactFinder\Communication\Version;
use Omikron\Factfinder\Exception\ResponseException;
use Omikron\Factfinder\Model\Api\CredentialsFactory;
use Omikron\Factfinder\Model\Config\CommunicationConfig;
use Omikron\Factfinder\Model\FieldRoles;
Expand Down
2 changes: 0 additions & 2 deletions src/Controller/Export/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Omikron\Factfinder\Controller\Export;

use Omikron\Factfinder\Controller\Export\Product;

class Category extends Product
{
/** @var string */
Expand Down
2 changes: 0 additions & 2 deletions src/Controller/Export/Cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Omikron\Factfinder\Controller\Export;

use Omikron\Factfinder\Controller\Export\Product;

class Cms extends Product
{
protected string $feedType = 'cms';
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Export/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\Response\Http\FileFactory;
use Magento\Store\Model\StoreManagerInterface;
use Omikron\Factfinder\Api\StreamInterfaceFactory;
use Omikron\Factfinder\Model\Config\CommunicationConfig;
use Omikron\Factfinder\Model\Export\FeedFactory as FeedGeneratorFactory;
use Omikron\Factfinder\Model\StoreEmulation;
use Omikron\Factfinder\Api\StreamInterfaceFactory;
use Omikron\Factfinder\Service\FeedFileService;

class Product extends Action
Expand Down
8 changes: 3 additions & 5 deletions src/Controller/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ class Router implements RouterInterface
{
public const FRONT_NAME = 'fact-finder';

/**
* phpcs:disable Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore
* phpcs:disable Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine
*/
public function __construct(private readonly ActionFactory $actionFactory) {}
public function __construct(private readonly ActionFactory $actionFactory)
{
}

/**
* Test the incoming requests for matches to the factfinder url pattern
Expand Down
14 changes: 6 additions & 8 deletions src/Cron/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,21 @@

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\StoreManagerInterface;
use Omikron\FactFinder\Communication\Resource\Builder;
use Omikron\Factfinder\Api\StreamInterfaceFactory;
use Omikron\Factfinder\Model\Api\PushImport;
use Omikron\Factfinder\Model\Config\CommunicationConfig;
use Omikron\Factfinder\Model\Export\FeedFactory as FeedGeneratorFactory;
use Omikron\Factfinder\Model\FtpUploader;
use Omikron\Factfinder\Model\StoreEmulation;
use Omikron\Factfinder\Api\StreamInterfaceFactory;
use Omikron\Factfinder\Service\FeedFileService;

/**
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
class Feed
{
private const PATH_CONFIGURABLE_CRON_IS_ENABLED = 'factfinder/configurable_cron/ff_cron_enabled';

/**
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* phpcs:disable Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore
* phpcs:disable Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine
*/
public function __construct(
private readonly ScopeConfigInterface $scopeConfig,
private readonly StoreManagerInterface $storeManager,
Expand All @@ -35,7 +32,8 @@ public function __construct(
private readonly PushImport $pushImport,
private readonly FeedFileService $feedFileService,
private readonly string $feedType,
) {}
) {
}

public function execute(): void
{
Expand Down
18 changes: 0 additions & 18 deletions src/Helper/ConfigurationHelper.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Model/Adminhtml/System/Config/Source/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(AttributeCollectionFactory $collectionFactory)
public function toOptionArray()
{
$options = array_map(
fn(EavAttribute $attr) => [
fn (EavAttribute $attr) => [
'value' => (string) $attr->getAttributeCode(),
'label' => (string) $attr->getDefaultFrontendLabel()
],
Expand Down
8 changes: 3 additions & 5 deletions src/Model/Export/BasicAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ class BasicAuth
private const CONFIG_PATH_USERNAME = 'factfinder/basic_auth_data_transfer/ff_upload_url_user';
private const CONFIG_PATH_PASSWORD = 'factfinder/basic_auth_data_transfer/ff_upload_url_password';

/**
* phpcs:disable Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore
* phpcs:disable Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine
*/
public function __construct(private readonly ScopeConfigInterface $scopeConfig) {}
public function __construct(private readonly ScopeConfigInterface $scopeConfig)
{
}

public function authenticate(string $username, string $password): bool
{
Expand Down
9 changes: 3 additions & 6 deletions src/Model/Export/Catalog/AttributeValuesExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,20 @@

namespace Omikron\Factfinder\Model\Export\Catalog;

use DateTime;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
use Omikron\Factfinder\Api\Filter\FilterInterface;
use Omikron\Factfinder\Model\Formatter\NumberFormatter;
use UnexpectedValueException;
use DateTime;

class AttributeValuesExtractor
{
/**
* phpcs:disable Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore
* phpcs:disable Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine
*/
public function __construct(
private readonly FilterInterface $filter,
private readonly NumberFormatter $numberFormatter,
) {}
) {
}

/**
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
Expand Down
7 changes: 2 additions & 5 deletions src/Model/Export/Catalog/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@

class DataProvider implements DataProviderInterface
{
/**
* phpcs:disable Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore
* phpcs:disable Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine
*/
public function __construct(
private readonly Products $products,
private readonly ObjectManagerInterface $objectManager,
private readonly array $fields,
private readonly array $entityTypes,
) {}
) {
}

/**
* @return ExportEntityInterface[]
Expand Down
8 changes: 2 additions & 6 deletions src/Model/Export/Catalog/ExportPreviewDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@
use Magento\Framework\ObjectManagerInterface;
use Omikron\Factfinder\Api\Export\DataProviderInterface;
use Omikron\Factfinder\Api\Export\ExportEntityInterface;
use Omikron\Factfinder\Api\Export\FieldInterface;

class ExportPreviewDataProvider implements DataProviderInterface
{
/**
* phpcs:disable Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore
* phpcs:disable Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine
*/
public function __construct(
private readonly ExportPreviewProducts $products,
private readonly ObjectManagerInterface $objectManager,
private readonly array $productFields,
private readonly array $entityTypes,
private readonly array $data,
) {}
) {
}

/**
* @return ExportEntityInterface[]
Expand Down
Loading

0 comments on commit 4b48502

Please sign in to comment.