Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility 2 4 6 #51

Merged
merged 9 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <aurelien.foucret@smile.fr>
* @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 <aurelien.foucret@smile.fr>
* 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 <aurelien.foucret@smile.fr>
* @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 <aurelien.foucret@smile.fr>
*/
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 <aurelien.foucret@smile.fr>
* @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 <aurelien.foucret@smile.fr>
*/
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