Skip to content

Commit

Permalink
Fix compatibility 2 4 6 (#51)
Browse files Browse the repository at this point in the history
Compatibility with Magento 2.4.6
  • Loading branch information
livca-smile authored Sep 19, 2023
1 parent 9f3d7c3 commit c50fef8
Show file tree
Hide file tree
Showing 36 changed files with 469 additions and 909 deletions.
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
81 changes: 31 additions & 50 deletions Api/Data/AddressInterface.php
Original file line number Diff line number Diff line change
@@ -1,130 +1,111 @@
<?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\Map
* @author Aurelien FOUCRET <[email protected]>
* @copyright 2016 Smile
* @license Apache License Version 2.0
*/

declare(strict_types=1);

namespace Smile\Map\Api\Data;

use Magento\Customer\Api\Data\RegionInterface;

/**
* Address interface definition.
*
* @category Smile
* @package Smile\Map
* @author Aurelien FOUCRET <[email protected]>
* Method's return type must be specified using return annotation
*/
interface AddressInterface
{
/**#@+
* Constants for keys of data array. Identical to the name of the getter in snake case
*/
const STREET = 'street';
const POSTCODE = 'postcode';
const CITY = 'city';
const REGION = 'region';
const REGION_ID = 'region_id';
const COUNTRY_ID = 'country_id';
public const STREET = 'street';
public const POSTCODE = 'postcode';
public const CITY = 'city';
public const REGION = 'region';
public const REGION_ID = 'region_id';
public const COUNTRY_ID = 'country_id';

/**
* Get region.
*
* @return \Magento\Customer\Api\Data\RegionInterface|null
* @return RegionInterface|string|null
*/
public function getRegion();
public function getRegion(): RegionInterface|string|null;

/**
* Get region ID.
*
* @return int|null
* @return ?int
*/
public function getRegionId();
public function getRegionId(): ?int;

/**
* Two-letter country code in ISO_3166-2 format.
*
* @return string|null
* @return ?string
*/
public function getCountryId();
public function getCountryId(): ?string;

/**
* Get street.
*
* @return string[]|string|null
* @return array
*/
public function getStreet();
public function getStreet(): array;

/**
* Get postcode.
*
* @return string|null
* @return ?string
*/
public function getPostcode();
public function getPostcode(): ?string;

/**
* Get city name.
*
* @return string|null
* @return ?string
*/
public function getCity();
public function getCity(): ?string;

/**
* Set country id.
*
* @param string $countryId Country id.
*
* @return $this
*/
public function setCountryId($countryId);
public function setCountryId(string $countryId): self;

/**
* Set region.
*
* @param string $region Region.
*
* @param ?string $region Region.
* @return $this
*/
public function setRegion($region = null);
public function setRegion(?string $region = null): self;

/**
* Set region ID.
*
* @param int $regionId Region id.
*
* @return $this
*/
public function setRegionId($regionId);
public function setRegionId(int $regionId): self;

/**
* Set street.
*
* @param string[]|string $street Street.
*
* @return $this
*/
public function setStreet($street);
public function setStreet(array|string $street): self;

/**
* Set postcode.
*
* @param string $postcode Postcode.
*
* @return $this
*/
public function setPostcode($postcode);
public function setPostcode(string $postcode): self;

/**
* Set city name.
*
* @param string $city City name.
*
* @return $this
*/
public function setCity($city);
public function setCity(string $city): self;
}
31 changes: 7 additions & 24 deletions Api/Data/GeoPointInterface.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,28 @@
<?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\Map
* @author Aurelien FOUCRET <[email protected]>
* @copyright 2016 Smile
* @license Apache License Version 2.0
*/

declare(strict_types=1);

namespace Smile\Map\Api\Data;

/**
* Geo point interface definition.
*
* @category Smile
* @package Smile\Map
* @author Aurelien FOUCRET <[email protected]>
*/
interface GeoPointInterface
{
/**#@+
* Constants for keys of data array. Identical to the name of the getter in snake case
*/
const LATITUDE = 'latitude';
const LONGITUDE = 'longitude';
/**#@-*/
public const LATITUDE = 'latitude';
public const LONGITUDE = 'longitude';

/**
* Geopoint latitude.
*
* @return float
*/
public function getLatitude();
public function getLatitude(): float;

/**
* Geopoint longitude.
*
* @return float
*/
public function getLongitude();
public function getLongitude(): float;
}
30 changes: 6 additions & 24 deletions Api/Data/GeolocalizedAddressInterface.php
Original file line number Diff line number Diff line change
@@ -1,46 +1,28 @@
<?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\Map
* @author Aurelien FOUCRET <[email protected]>
* @copyright 2016 Smile
* @license Apache License Version 2.0
*/

declare(strict_types=1);

namespace Smile\Map\Api\Data;

/**
* Geolocalized address interface definition.
*
* @category Smile
* @package Smile\Map
* @author Aurelien FOUCRET <[email protected]>
*/
interface GeolocalizedAddressInterface extends AddressInterface
{
/**#@+
* Constants for keys of data array. Identical to the name of the getter in snake case
*/
const COORDINATES = 'coordinates';
/**#@-*/
public const COORDINATES = 'coordinates';

/**
* Get address coordinates.
*
* @return \Smile\Map\Api\Data\GeoPointInterface
*/
public function getCoordinates();
public function getCoordinates(): ?GeoPointInterface;

/**
* Set address coordinates.
*
* @param \Smile\Map\Api\Data\GeoPointInterface $coordinates Coordinates.
*
* @return $this
*/
public function setCoordinates(\Smile\Map\Api\Data\GeoPointInterface $coordinates);
public function setCoordinates(GeoPointInterface $coordinates): self;
}
Loading

0 comments on commit c50fef8

Please sign in to comment.