Skip to content

Commit

Permalink
Fix compatibility 2 4 6 (#40)
Browse files Browse the repository at this point in the history
Fix compatibility Magento 2.4.6

---------

Co-authored-by: guvra <[email protected]>
  • Loading branch information
livca-smile and guvra authored Sep 21, 2023
1 parent 2260c2e commit 3d7aeb6
Show file tree
Hide file tree
Showing 58 changed files with 736 additions and 1,409 deletions.
25 changes: 0 additions & 25 deletions .codeclimate.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/CHANGELOG.md export-ignore
/phpcs.xml.dist export-ignore
/phpmd.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/README.md export-ignore
66 changes: 66 additions & 0 deletions .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: 'Static Analysis'

on:
pull_request: ~
push:
branches:
- 'master'

jobs:
static-analysis:
runs-on: 'ubuntu-latest'

strategy:
matrix:
php-version:
- '8.1'

steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'

- name: 'Install PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php-version }}'
coverage: 'none'
tools: 'composer:v2'
env:
COMPOSER_AUTH_JSON: |
{
"http-basic": {
"repo.magento.com": {
"username": "${{ secrets.MAGENTO_USERNAME }}",
"password": "${{ secrets.MAGENTO_PASSWORD }}"
}
}
}
- name: 'Get composer cache directory'
id: 'composer-cache'
run: 'echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'

- name: 'Cache dependencies'
uses: 'actions/cache@v3'
with:
path: '${{ steps.composer-cache.outputs.dir }}'
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: '${{ runner.os }}-composer-'

- name: 'Install dependencies'
run: 'composer install --prefer-dist'

- name: 'Run composer audit'
run: 'composer audit --format=plain'

- name: 'Run Parallel Lint'
run: 'vendor/bin/parallel-lint --exclude vendor .'

- name: 'Run PHP CodeSniffer'
run: 'vendor/bin/phpcs --extensions=php,phtml'

- name: 'Run PHPMD'
run: 'vendor/bin/phpmd . xml phpmd.xml.dist'

- name: 'Run PHPStan'
run: 'vendor/bin/phpstan analyse'
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/.fleet
/.idea
/vendor
/composer.lock
/phpcs.xml
/phpstan.neon
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

35 changes: 13 additions & 22 deletions Api/Data/RetailerInterface.php
Original file line number Diff line number Diff line change
@@ -1,43 +1,34 @@
<?php
/**
* DISCLAIMER
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future.
*
* @category Smile
* @package Smile\Retailer
* @author Romain Ruaud <[email protected]>
* @copyright 2016 Smile
* @license Open Software License ("OSL") v. 3.0
*/

declare(strict_types=1);

namespace Smile\Retailer\Api\Data;

use Smile\Seller\Api\Data\SellerInterface;

/**
* Retailer Interface
*
* @category Smile
* @package Smile\Retailer
* @author Romain Ruaud <[email protected]>
* @api
* @method mixed getData(...$key)
* @method mixed setData(...$data)
* @phpcs:disable SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName
* @phpcs:disable Generic.Files.LineLength.TooLong
*/
interface RetailerInterface extends SellerInterface
{
const ATTRIBUTE_SET_RETAILER = "retailer";
public const ATTRIBUTE_SET_RETAILER = "retailer";

/**
* Retrieve existing extension attributes object or create a new one.
* Retrieve existing extension attributes object or create a new one. - need concrete type declaration to generate RetailerExtensionInterface
*
* @return \Smile\Retailer\Api\Data\RetailerExtensionInterface|null
*/
public function getExtensionAttributes();
public function getExtensionAttributes(): ?RetailerExtensionInterface;

/**
* Set an extension attributes object.
*
* @param \Smile\Retailer\Api\Data\RetailerExtensionInterface $extensionAttributes The additional attributes
*
* @param \Smile\Retailer\Api\Data\RetailerExtensionInterface $extensionAttributes The additional attributes - need concrete type declaration
* @return $this
*/
public function setExtensionAttributes(\Smile\Retailer\Api\Data\RetailerExtensionInterface $extensionAttributes);
public function setExtensionAttributes(\Smile\Retailer\Api\Data\RetailerExtensionInterface $extensionAttributes): self;
}
34 changes: 12 additions & 22 deletions Api/Data/RetailerSearchResultsInterface.php
Original file line number Diff line number Diff line change
@@ -1,39 +1,29 @@
<?php
/**
* DISCLAIMER
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future.
*
* @category Smile
* @package Smile\Retailer
* @author De Cramer Oliver <[email protected]>
* @copyright 2017 Smile
* @license Open Software License ("OSL") v. 3.0
*/

declare(strict_types=1);

namespace Smile\Retailer\Api\Data;

use Magento\Framework\Api\SearchResultsInterface;
use Magento\Framework\DataObject;

/**
* Class RetailerSearchResultsInterface
*
* @category Smile
* @package Smile\Retailer\Api\Data
* @author De Cramer Oliver <[email protected]>
* @api
*/
interface RetailerSearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface
interface RetailerSearchResultsInterface extends SearchResultsInterface
{
/**
* Get Retailers list.
*
* @return RetailerInterface[]
* @return RetailerInterface[]|DataObject[]
*/
public function getItems();
public function getItems(): array;

/**
* Set Retailers list.
*
* @param RetailerInterface[] $items List of retailers
*
* @param RetailerInterface[]|DataObject[] $items List of retailers
* @return $this
*/
public function setItems(array $items);
public function setItems(array $items): self;
}
60 changes: 19 additions & 41 deletions Api/RetailerRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -1,97 +1,75 @@
<?php
/**
* DISCLAIMER
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future.
*
* @category Smile
* @package Smile\Retailer
* @author Romain Ruaud <[email protected]>
* @copyright 2016 Smile
* @license Open Software License ("OSL") v. 3.0
*/

declare(strict_types=1);

namespace Smile\Retailer\Api;

use Magento\Framework\Api\SearchCriteriaInterface;
use Smile\Retailer\Api\Data\RetailerInterface;
use Smile\Retailer\Api\Data\RetailerSearchResultsInterface;
use Smile\Seller\Api\Data\SellerInterface;

/**
* Retailer Repository interface
*
* @category Smile
* @package Smile\Retailer
* @author Romain Ruaud <[email protected]>
* @api
*/
interface RetailerRepositoryInterface
{
/**
* Create retailer service
*
* @param \Smile\Retailer\Api\Data\RetailerInterface $retailer The retailer
*
* @return \Smile\Retailer\Api\Data\RetailerInterface
*
* @param RetailerInterface|SellerInterface $retailer The retailer
* @return RetailerInterface|SellerInterface
* @throws \Magento\Framework\Exception\CouldNotSaveException
*/
public function save(\Smile\Retailer\Api\Data\RetailerInterface $retailer);
public function save(RetailerInterface|SellerInterface $retailer);

/**
* Get info about retailer by retailer id
*
* @param int $retailerId The retailer Id
* @param int $storeId The store Id
*
* @return \Smile\Retailer\Api\Data\RetailerInterface
*
* @param ?int $storeId The store Id
* @return RetailerInterface|SellerInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function get($retailerId, $storeId = null);
public function get(int $retailerId, ?int $storeId = null);

/**
* Get info about retailer by retailer code
*
* @param int $retailerCode The retailer Code
* @param int $storeId The store Id
*
* @return \Smile\Retailer\Api\Data\RetailerInterface
*
* @param string $retailerCode The retailer Code
* @param ?int $storeId The store Id
* @return RetailerInterface|SellerInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getByCode($retailerCode, $storeId = null);
public function getByCode(string $retailerCode, ?int $storeId = null);

/**
* Get relation list
*
* @param SearchCriteriaInterface $criteria Search criterai for collection
*
* @return RetailerSearchResultsInterface
*/
public function getList(SearchCriteriaInterface $criteria);
public function getList(SearchCriteriaInterface $criteria): RetailerSearchResultsInterface;

/**
* Delete retailer by identifier
*
* @param \Smile\Retailer\Api\Data\RetailerInterface $retailer retailer which will deleted
*
* @param RetailerInterface|SellerInterface $retailer retailer which will deleted
* @return bool Will returned True if deleted
*
* @throws \Magento\Framework\Exception\InputException
* @throws \Magento\Framework\Exception\StateException
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function delete(\Smile\Retailer\Api\Data\RetailerInterface $retailer);
public function delete(RetailerInterface|SellerInterface $retailer): bool;

/**
* Delete retailer by identifier
*
* @param int $retailerId The retailer id
*
* @return bool Will returned True if deleted
*
* @throws \Magento\Framework\Exception\InputException
* @throws \Magento\Framework\Exception\StateException
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function deleteByIdentifier($retailerId);
public function deleteByIdentifier(int $retailerId): bool;
}
Loading

0 comments on commit 3d7aeb6

Please sign in to comment.