dependencies-upgrade

This commit is contained in:
RafficMohammed
2023-01-08 02:20:59 +05:30
parent 7870479b18
commit 49021a4497
1711 changed files with 74994 additions and 70803 deletions

View File

@@ -1,23 +0,0 @@
name: Check & fix styling
on: [push]
jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php_cs.dist --allow-risky=yes
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling

View File

@@ -1,37 +0,0 @@
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.0, 7.4, 7.3]
stability: [prefer-lowest, prefer-stable]
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit

View File

@@ -11,7 +11,7 @@
"php": "^7.3|^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0"
"phpunit/phpunit": "^9.5"
},
"scripts": {
"cs-review": "php-cs-fixer fix --verbose --diff --dry-run",

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/*
* (c) Rob Bast <rob.bast@gmail.com>
*

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/*
* (c) Rob Bast <rob.bast@gmail.com>
*

View File

@@ -1,14 +0,0 @@
<?php
/*
* (c) Rob Bast <rob.bast@gmail.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace League\ISO3166\Exception;
final class InvalidArgumentException extends \InvalidArgumentException implements ISO3166Exception
{
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/*
* (c) Rob Bast <rob.bast@gmail.com>
*

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/*
* (c) Rob Bast <rob.bast@gmail.com>
*
@@ -10,39 +12,17 @@
namespace League\ISO3166;
use League\ISO3166\Exception\DomainException;
use League\ISO3166\Exception\InvalidArgumentException;
final class Guards
{
/**
* Assert that input looks like a name key.
*
* @param string $name
*
* @throws \League\ISO3166\Exception\InvalidArgumentException if input is not a string
*/
public static function guardAgainstInvalidName($name)
{
if (!is_string($name)) {
throw new InvalidArgumentException(sprintf('Expected $name to be of type string, got: %s', gettype($name)));
}
}
/**
* Assert that input looks like an alpha2 key.
*
* @param string $alpha2
*
* @throws \League\ISO3166\Exception\InvalidArgumentException if input is not a string
* @throws \League\ISO3166\Exception\DomainException if input does not look like an alpha2 key
*/
public static function guardAgainstInvalidAlpha2($alpha2)
public static function guardAgainstInvalidAlpha2(string $alpha2): void
{
if (!is_string($alpha2)) {
throw new InvalidArgumentException(sprintf('Expected $alpha2 to be of type string, got: %s', gettype($alpha2)));
}
if (!preg_match('/^[a-zA-Z]{2}$/', $alpha2)) {
if (1 !== preg_match('/^[a-zA-Z]{2}$/', $alpha2)) {
throw new DomainException(sprintf('Not a valid alpha2 key: %s', $alpha2));
}
}
@@ -50,18 +30,11 @@ final class Guards
/**
* Assert that input looks like an alpha3 key.
*
* @param string $alpha3
*
* @throws \League\ISO3166\Exception\InvalidArgumentException if input is not a string
* @throws \League\ISO3166\Exception\DomainException if input does not look like an alpha3 key
*/
public static function guardAgainstInvalidAlpha3($alpha3)
public static function guardAgainstInvalidAlpha3(string $alpha3): void
{
if (!is_string($alpha3)) {
throw new InvalidArgumentException(sprintf('Expected $alpha3 to be of type string, got: %s', gettype($alpha3)));
}
if (!preg_match('/^[a-zA-Z]{3}$/', $alpha3)) {
if (1 !== preg_match('/^[a-zA-Z]{3}$/', $alpha3)) {
throw new DomainException(sprintf('Not a valid alpha3 key: %s', $alpha3));
}
}
@@ -69,18 +42,11 @@ final class Guards
/**
* Assert that input looks like a numeric key.
*
* @param string $numeric
*
* @throws \League\ISO3166\Exception\InvalidArgumentException if input is not a string
* @throws \League\ISO3166\Exception\DomainException if input does not look like a numeric key
*/
public static function guardAgainstInvalidNumeric($numeric)
public static function guardAgainstInvalidNumeric(string $numeric): void
{
if (!is_string($numeric)) {
throw new InvalidArgumentException(sprintf('Expected $numeric to be of type string, got: %s', gettype($numeric)));
}
if (!preg_match('/^[0-9]{3}$/', $numeric)) {
if (1 !== preg_match('/^\d{3}$/', $numeric)) {
throw new DomainException(sprintf('Not a valid numeric key: %s', $numeric));
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/*
* (c) Rob Bast <rob.bast@gmail.com>
*
@@ -12,43 +14,42 @@ namespace League\ISO3166;
use League\ISO3166\Exception\DomainException;
use League\ISO3166\Exception\OutOfBoundsException;
/** @implements \IteratorAggregate<string, array> */
final class ISO3166 implements \Countable, \IteratorAggregate, ISO3166DataProvider
{
/** @var string */
const KEY_ALPHA2 = 'alpha2';
public const KEY_ALPHA2 = 'alpha2';
/** @var string */
const KEY_ALPHA3 = 'alpha3';
public const KEY_ALPHA3 = 'alpha3';
/** @var string */
const KEY_NUMERIC = 'numeric';
public const KEY_NUMERIC = 'numeric';
/** @var string */
const KEY_NAME = 'name';
public const KEY_NAME = 'name';
/** @var string[] */
private $keys = [self::KEY_ALPHA2, self::KEY_ALPHA3, self::KEY_NUMERIC, self::KEY_NAME];
/**
* @param array[] $countries replace default dataset with given array
* @param array<array{name: string, alpha2: string, alpha3: string, numeric: numeric-string, currency: string[]}> $countries replace default dataset with given array
*/
public function __construct(array $countries = [])
{
if ($countries) {
if ([] !== $countries) {
$this->countries = $countries;
}
}
/**
* {@inheritdoc}
* @return array{name: string, alpha2: string, alpha3: string, numeric: numeric-string, currency: string[]}
*/
public function name($name)
public function name(string $name): array
{
Guards::guardAgainstInvalidName($name);
return $this->lookup(self::KEY_NAME, $name);
}
/**
* {@inheritdoc}
* @return array{name: string, alpha2: string, alpha3: string, numeric: numeric-string, currency: string[]}
*/
public function alpha2($alpha2)
public function alpha2(string $alpha2): array
{
Guards::guardAgainstInvalidAlpha2($alpha2);
@@ -56,9 +57,9 @@ final class ISO3166 implements \Countable, \IteratorAggregate, ISO3166DataProvid
}
/**
* {@inheritdoc}
* @return array{name: string, alpha2: string, alpha3: string, numeric: numeric-string, currency: string[]}
*/
public function alpha3($alpha3)
public function alpha3(string $alpha3): array
{
Guards::guardAgainstInvalidAlpha3($alpha3);
@@ -66,9 +67,9 @@ final class ISO3166 implements \Countable, \IteratorAggregate, ISO3166DataProvid
}
/**
* {@inheritdoc}
* @return array{name: string, alpha2: string, alpha3: string, numeric: numeric-string, currency: string[]}
*/
public function numeric($numeric)
public function numeric(string $numeric): array
{
Guards::guardAgainstInvalidNumeric($numeric);
@@ -76,24 +77,24 @@ final class ISO3166 implements \Countable, \IteratorAggregate, ISO3166DataProvid
}
/**
* @return array[]
* @return array<array{name: string, alpha2: string, alpha3: string, numeric: numeric-string, currency: string[]}>
*/
public function all()
public function all(): array
{
return $this->countries;
}
/**
* @param string $key
* @param 'name'|'alpha2'|'alpha3'|'numeric' $key
*
* @throws \League\ISO3166\Exception\DomainException if an invalid key is specified
*
* @return \Generator
* @return \Generator<string, array{name: string, alpha2: string, alpha3: string, numeric: numeric-string, currency: string[]}>
*/
public function iterator($key = self::KEY_ALPHA2)
public function iterator(string $key = self::KEY_ALPHA2): \Generator
{
if (!in_array($key, $this->keys, true)) {
throw new DomainException(sprintf('Invalid value for $indexBy, got "%s", expected one of: %s', $key, implode(', ', $this->keys)));
throw new DomainException(sprintf('Invalid value for $key, got "%s", expected one of: %s', $key, implode(', ', $this->keys)));
}
foreach ($this->countries as $country) {
@@ -105,22 +106,20 @@ final class ISO3166 implements \Countable, \IteratorAggregate, ISO3166DataProvid
* @see \Countable
*
* @internal
*
* @return int
*/
public function count()
public function count(): int
{
return count($this->countries);
}
/**
* @return \Generator<array<string, string|array<string>>>
*
* @see \IteratorAggregate
*
* @internal
*
* @return \Generator
*/
public function getIterator()
public function getIterator(): \Generator
{
foreach ($this->countries as $country) {
yield $country;
@@ -132,17 +131,20 @@ final class ISO3166 implements \Countable, \IteratorAggregate, ISO3166DataProvid
*
* Looks for a match against the given key for each entry in the dataset.
*
* @param string $key
* @param string $value
* @param 'name'|'alpha2'|'alpha3'|'numeric' $key
*
* @throws \League\ISO3166\Exception\OutOfBoundsException if key does not exist in dataset
*
* @return array
* @return array{name: string, alpha2: string, alpha3: string, numeric: numeric-string, currency: string[]}
*/
private function lookup($key, $value)
private function lookup(string $key, string $value): array
{
$value = mb_strtolower($value);
foreach ($this->countries as $country) {
if (0 === strcasecmp($value, $country[$key])) {
$comparison = mb_strtolower($country[$key]);
if ($value === $comparison || $value === mb_substr($comparison, 0, mb_strlen($value))) {
return $country;
}
}
@@ -153,7 +155,7 @@ final class ISO3166 implements \Countable, \IteratorAggregate, ISO3166DataProvid
/**
* Default dataset.
*
* @var array[]
* @var array<array{name: string, alpha2: string, alpha3: string, numeric: numeric-string, currency: string[]}>>
*/
private $countries = [
[

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/*
* (c) Rob Bast <rob.bast@gmail.com>
*
@@ -16,57 +18,45 @@ interface ISO3166DataProvider
*
* @api
*
* @param string $name
*
* @throws \League\ISO3166\Exception\InvalidArgumentException if input is not a string
* @throws \League\ISO3166\Exception\OutOfBoundsException if input does not exist in dataset
*
* @return array
* @return array<string, mixed>
*/
public function name($name);
public function name(string $name): array;
/**
* Lookup ISO3166-1 data by alpha2 identifier.
*
* @api
*
* @param string $alpha2
*
* @throws \League\ISO3166\Exception\InvalidArgumentException if input is not a string
* @throws \League\ISO3166\Exception\DomainException if input does not look like an alpha2 key
* @throws \League\ISO3166\Exception\OutOfBoundsException if input does not exist in dataset
*
* @return array
* @return array<string, mixed>
*/
public function alpha2($alpha2);
public function alpha2(string $alpha2): array;
/**
* Lookup ISO3166-1 data by alpha3 identifier.
*
* @api
*
* @param string $alpha3
*
* @throws \League\ISO3166\Exception\InvalidArgumentException if input is not a string
* @throws \League\ISO3166\Exception\DomainException if input does not look like an alpha3 key
* @throws \League\ISO3166\Exception\OutOfBoundsException if input does not exist in dataset
*
* @return array
* @return array<string, mixed>
*/
public function alpha3($alpha3);
public function alpha3(string $alpha3): array;
/**
* Lookup ISO3166-1 data by numeric identifier (numerical string, that is).
*
* @api
*
* @param string $numeric
*
* @throws \League\ISO3166\Exception\InvalidArgumentException if input is not a string
* @throws \League\ISO3166\Exception\DomainException if input does not look like a numeric key
* @throws \League\ISO3166\Exception\OutOfBoundsException if input does not exist in dataset
*
* @return array
* @return array<string, mixed>
*/
public function numeric($numeric);
public function numeric(string $numeric): array;
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/*
* (c) Rob Bast <rob.bast@gmail.com>
*
@@ -14,9 +16,11 @@ use League\ISO3166\Exception\DomainException;
final class ISO3166DataValidator
{
/**
* @return array
* @param array<array<string, mixed>> $data
*
* @return array<array<string, mixed>>
*/
public function validate(array $data)
public function validate(array $data): array
{
foreach ($data as $entry) {
$this->assertEntryHasRequiredKeys($entry);
@@ -26,9 +30,11 @@ final class ISO3166DataValidator
}
/**
* @param array<string, mixed> $entry
*
* @throws \League\ISO3166\Exception\DomainException if given data entry does not have all the required keys
*/
private function assertEntryHasRequiredKeys(array $entry)
private function assertEntryHasRequiredKeys(array $entry): void
{
if (!isset($entry[ISO3166::KEY_ALPHA2])) {
throw new DomainException('Each data entry must have a valid alpha2 key.');

View File

@@ -0,0 +1,5 @@
{
"require": {
"friendsofphp/php-cs-fixer": "*"
}
}

2047
vendor/league/iso3166/tools/php-cs-fixer/composer.lock generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
{
"require": {
"phpstan/phpstan": "*",
"phpstan/phpstan-php-parser": "*",
"phpstan/phpstan-deprecation-rules": "*",
"phpstan/phpstan-strict-rules": "*"
}
}

227
vendor/league/iso3166/tools/phpstan/composer.lock generated vendored Normal file
View File

@@ -0,0 +1,227 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e1ff6a9f4c3da4f73ac5b2ab1e65d70a",
"packages": [
{
"name": "phpstan/phpstan",
"version": "1.8.4",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/eed4c9da531f6ebb4787235b6fb486e2c20f34e5",
"reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
"static analysis"
],
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.8.4"
},
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://github.com/phpstan",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
"type": "tidelift"
}
],
"time": "2022-09-03T13:08:04+00:00"
},
{
"name": "phpstan/phpstan-deprecation-rules",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
"reference": "e5ccafb0dd8d835dd65d8d7a1a0d2b1b75414682"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/e5ccafb0dd8d835dd65d8d7a1a0d2b1b75414682",
"reference": "e5ccafb0dd8d835dd65d8d7a1a0d2b1b75414682",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"phpstan/phpstan": "^1.0"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5"
},
"type": "phpstan-extension",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
},
"phpstan": {
"includes": [
"rules.neon"
]
}
},
"autoload": {
"psr-4": {
"PHPStan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.",
"support": {
"issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues",
"source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.0.0"
},
"time": "2021-09-23T11:02:21+00:00"
},
{
"name": "phpstan/phpstan-php-parser",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-php-parser.git",
"reference": "1c7670dd92da864b5d019f22d9f512a6ae18b78e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-php-parser/zipball/1c7670dd92da864b5d019f22d9f512a6ae18b78e",
"reference": "1c7670dd92da864b5d019f22d9f512a6ae18b78e",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"phpstan/phpstan": "^1.3"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^9.5"
},
"type": "phpstan-extension",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
},
"phpstan": {
"includes": [
"extension.neon"
]
}
},
"autoload": {
"psr-4": {
"PHPStan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHP-Parser extensions for PHPStan",
"support": {
"issues": "https://github.com/phpstan/phpstan-php-parser/issues",
"source": "https://github.com/phpstan/phpstan-php-parser/tree/1.1.0"
},
"time": "2021-12-16T19:43:32+00:00"
},
{
"name": "phpstan/phpstan-strict-rules",
"version": "1.4.3",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
"reference": "431b3d6e8040075de196680cd5bc95735987b4ae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/431b3d6e8040075de196680cd5bc95735987b4ae",
"reference": "431b3d6e8040075de196680cd5bc95735987b4ae",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.8.3"
},
"require-dev": {
"nikic/php-parser": "^4.13.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5"
},
"type": "phpstan-extension",
"extra": {
"phpstan": {
"includes": [
"rules.neon"
]
}
},
"autoload": {
"psr-4": {
"PHPStan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Extra strict and opinionated rules for PHPStan",
"support": {
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.4.3"
},
"time": "2022-08-26T15:05:46+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.2.0"
}