composer update

This commit is contained in:
2020-12-06 10:28:55 +00:00
parent 69d92960d9
commit 09413522bb
1596 changed files with 60456 additions and 39587 deletions
+23
View File
@@ -0,0 +1,23 @@
install:
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:7.4-base update
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:7.4-base bin all update
phpunit:
@rm -f bootstrap/cache/*.php && docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:7.4-cli
phpstan-analyze-src:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze src -c phpstan.src.neon.dist
phpstan-analyze-tests:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze tests -c phpstan.tests.neon.dist
psalm-analyze:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm --rm registry.gitlab.com/grahamcampbell/php:7.4-cli
psalm-show-info:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm --rm registry.gitlab.com/grahamcampbell/php:7.4-cli --show-info=true
test: phpunit phpstan-analyze-src phpstan-analyze-tests psalm-analyze
clean:
@rm -rf .phpunit.result.cache composer.lock vendor vendor-bin/*/composer.lock vendor-bin/*/vendor
+8 -3
View File
@@ -17,8 +17,8 @@
"php": "^5.5.9 || ^7.0 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0",
"bamarni/composer-bin-plugin": "^1.3"
"bamarni/composer-bin-plugin": "^1.4.1",
"phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0 || ^8.0 || ^9.0"
},
"autoload": {
"psr-4": {
@@ -30,9 +30,14 @@
"PhpOption\\Tests\\": "tests/PhpOption/Tests/"
}
},
"config": {
"preferred-install": "dist"
},
"extra": {
"branch-alias": {
"dev-master": "1.7-dev"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
+7 -6
View File
@@ -97,7 +97,7 @@ final class LazyOption extends Option
public function ifDefined($callable)
{
$this->option()->ifDefined($callable);
$this->option()->forAll($callable);
}
public function forAll($callable)
@@ -156,11 +156,12 @@ final class LazyOption extends Option
private function option()
{
if (null === $this->option) {
$this->option = call_user_func_array($this->callback, $this->arguments);
if (!$this->option instanceof Option) {
$this->option = null;
throw new \RuntimeException(sprintf('Expected instance of \%s', Option::class));
/** @var mixed */
$option = call_user_func_array($this->callback, $this->arguments);
if ($option instanceof Option) {
$this->option = $option;
} else {
throw new \RuntimeException(sprintf('Expected instance of %s', Option::class));
}
}
+7 -7
View File
@@ -61,8 +61,8 @@ abstract class Option implements IteratorAggregate
*
* @template S
*
* @param array<string,S>|ArrayAccess<string,S>|null $array A potential array or \ArrayAccess value.
* @param string $key The key to check.
* @param array<string|int,S>|ArrayAccess<string|int,S>|null $array A potential array or \ArrayAccess value.
* @param string $key The key to check.
*
* @return Option<S>
*/
@@ -93,7 +93,7 @@ abstract class Option implements IteratorAggregate
*/
public static function fromReturn($callback, array $arguments = [], $noneValue = null)
{
return new LazyOption(function () use ($callback, $arguments, $noneValue) {
return new LazyOption(static function () use ($callback, $arguments, $noneValue) {
/** @var mixed */
$return = call_user_func_array($callback, $arguments);
@@ -126,7 +126,7 @@ abstract class Option implements IteratorAggregate
if ($value instanceof self) {
return $value;
} elseif (is_callable($value)) {
return new LazyOption(function () use ($value, $noneValue) {
return new LazyOption(static function () use ($value, $noneValue) {
/** @var mixed */
$return = $value();
@@ -159,14 +159,14 @@ abstract class Option implements IteratorAggregate
*/
public static function lift($callback, $noneValue = null)
{
return function () use ($callback, $noneValue) {
return static function () use ($callback, $noneValue) {
/** @var array<int, mixed> */
$args = func_get_args();
$reduced_args = array_reduce(
$args,
/** @param bool $status */
function ($status, self $o) {
static function ($status, self $o) {
return $o->isEmpty() ? true : $status;
},
false
@@ -178,7 +178,7 @@ abstract class Option implements IteratorAggregate
$args = array_map(
/** @return T */
function (self $o) {
static function (self $o) {
// it is safe to do so because the fold above checked
// that all arguments are of type Some
/** @var T */
+2 -1
View File
@@ -87,7 +87,7 @@ final class Some extends Option
public function ifDefined($callable)
{
$callable($this->value);
$this->forAll($callable);
}
public function forAll($callable)
@@ -104,6 +104,7 @@ final class Some extends Option
public function flatMap($callable)
{
/** @var mixed */
$rs = $callable($this->value);
if (!$rs instanceof Option) {
throw new \RuntimeException('Callables passed to flatMap() must return an Option. Maybe you should use map() instead?');