Update composer dependencies
This commit is contained in:
parent
b4ef98673f
commit
e013ef7abe
139 changed files with 3217 additions and 2779 deletions
47
vendor/dasprid/enum/.github/workflows/tests.yml
vendored
Normal file
47
vendor/dasprid/enum/.github/workflows/tests.yml
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
name: Tests
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
php-tests:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
php: [8.2, 8.1, 8.0, 7.4, 7.3, 7.2, 7.1]
|
||||
dependency-version: [prefer-stable]
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
|
||||
name: ${{ matrix.os }} - PHP${{ matrix.php }} - ${{ matrix.dependency-version }}
|
||||
|
||||
steps:
|
||||
- name: Set git to use LF
|
||||
run: |
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.eol lf
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.composer/cache/files
|
||||
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
coverage: none
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
|
||||
|
||||
- name: Execute tests
|
||||
run: vendor/bin/phpunit
|
||||
|
||||
- name: Code Sniffer
|
||||
run: vendor/bin/phpcs
|
||||
|
||||
30
vendor/dasprid/enum/README.md
vendored
30
vendor/dasprid/enum/README.md
vendored
|
|
@ -1,6 +1,6 @@
|
|||
# PHP 7.1 enums
|
||||
|
||||
[](https://travis-ci.org/DASPRiD/Enum)
|
||||
[](https://github.com/DASPRiD/Enum/actions?query=workflow%3Atests)
|
||||
[](https://coveralls.io/github/DASPRiD/Enum?branch=master)
|
||||
[](https://packagist.org/packages/dasprid/enum)
|
||||
[](https://packagist.org/packages/dasprid/enum)
|
||||
|
|
@ -41,7 +41,7 @@ final class WeekDay extends AbstractEnum
|
|||
protected const SATURDAY = null;
|
||||
protected const SUNDAY = null;
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
If you need to provide constants for either internal use or public use, you can mark them as either private or public,
|
||||
in which case they will be ignored by the enum, which only considers protected constants as valid values. As you can
|
||||
|
|
@ -56,16 +56,16 @@ function tellItLikeItIs(WeekDay $weekDay)
|
|||
case WeekDay::MONDAY():
|
||||
echo 'Mondays are bad.';
|
||||
break;
|
||||
|
||||
|
||||
case WeekDay::FRIDAY():
|
||||
echo 'Fridays are better.';
|
||||
break;
|
||||
|
||||
|
||||
case WeekDay::SATURDAY():
|
||||
case WeekDay::SUNDAY():
|
||||
echo 'Weekends are best.';
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
echo 'Midweek days are so-so.';
|
||||
}
|
||||
|
|
@ -107,14 +107,14 @@ final class Planet extends AbstractEnum
|
|||
protected const SATURN = [5.688e+26, 6.0268e7];
|
||||
protected const URANUS = [8.686e+25, 2.5559e7];
|
||||
protected const NEPTUNE = [1.024e+26, 2.4746e7];
|
||||
|
||||
|
||||
/**
|
||||
* Universal gravitational constant.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private const G = 6.67300E-11;
|
||||
|
||||
|
||||
/**
|
||||
* Mass in kilograms.
|
||||
*
|
||||
|
|
@ -124,32 +124,32 @@ final class Planet extends AbstractEnum
|
|||
|
||||
/**
|
||||
* Radius in meters.
|
||||
*
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
*/
|
||||
private $radius;
|
||||
|
||||
|
||||
protected function __construct(float $mass, float $radius)
|
||||
{
|
||||
$this->mass = $mass;
|
||||
$this->radius = $radius;
|
||||
}
|
||||
|
||||
|
||||
public function mass() : float
|
||||
{
|
||||
return $this->mass;
|
||||
}
|
||||
|
||||
|
||||
public function radius() : float
|
||||
{
|
||||
return $this->radius;
|
||||
return $this->radius;
|
||||
}
|
||||
|
||||
|
||||
public function surfaceGravity() : float
|
||||
{
|
||||
return self::G * $this->mass / ($this->radius * $this->radius);
|
||||
}
|
||||
|
||||
|
||||
public function surfaceWeight(float $otherMass) : float
|
||||
{
|
||||
return $otherMass * $this->surfaceGravity();
|
||||
|
|
|
|||
5
vendor/dasprid/enum/composer.json
vendored
5
vendor/dasprid/enum/composer.json
vendored
|
|
@ -14,9 +14,12 @@
|
|||
"enum",
|
||||
"map"
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1 <9.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7 | ^8 | ^9",
|
||||
"squizlabs/php_codesniffer": "^3.4"
|
||||
"squizlabs/php_codesniffer": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
|
|||
42
vendor/dasprid/enum/src/EnumMap.php
vendored
42
vendor/dasprid/enum/src/EnumMap.php
vendored
|
|
@ -88,6 +88,31 @@ final class EnumMap implements Serializable, IteratorAggregate
|
|||
$this->values = array_fill(0, count($this->keyUniverse), null);
|
||||
}
|
||||
|
||||
public function __serialize(): array
|
||||
{
|
||||
$values = [];
|
||||
|
||||
foreach ($this->values as $ordinal => $value) {
|
||||
if (null === $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$values[$ordinal] = $this->unmaskNull($value);
|
||||
}
|
||||
|
||||
return [
|
||||
'keyType' => $this->keyType,
|
||||
'valueType' => $this->valueType,
|
||||
'allowNullValues' => $this->allowNullValues,
|
||||
'values' => $values,
|
||||
];
|
||||
}
|
||||
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
$this->unserialize(serialize($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the map types match the supplied ones.
|
||||
*
|
||||
|
|
@ -261,22 +286,7 @@ final class EnumMap implements Serializable, IteratorAggregate
|
|||
|
||||
public function serialize() : string
|
||||
{
|
||||
$values = [];
|
||||
|
||||
foreach ($this->values as $ordinal => $value) {
|
||||
if (null === $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$values[$ordinal] = $this->unmaskNull($value);
|
||||
}
|
||||
|
||||
return serialize([
|
||||
'keyType' => $this->keyType,
|
||||
'valueType' => $this->valueType,
|
||||
'allowNullValues' => $this->allowNullValues,
|
||||
'values' => $values,
|
||||
]);
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
public function unserialize($serialized) : void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue