Update composer installed packages

This commit is contained in:
Clemens Schwaighofer
2022-09-06 11:16:33 +09:00
parent 4b3fbaa309
commit a8e75d158b
285 changed files with 1916 additions and 25069 deletions

View File

@@ -2,11 +2,11 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [4.0.0] - 2022-MM-DD
## [3.1.0] - 2022-08-29
### Removed
### Added
* This component is no longer supported on PHP 7.3 and PHP 7.4
* [#21](https://github.com/sebastianbergmann/type/issues/21): Support `true` as stand-alone type
## [3.0.0] - 2022-03-15
@@ -130,7 +130,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* Initial release based on [code contributed by Michel Hartmann to PHPUnit](https://github.com/sebastianbergmann/phpunit/pull/3673)
[4.0.0]: https://github.com/sebastianbergmann/type/compare/3.0...master
[3.1.0]: https://github.com/sebastianbergmann/type/compare/3.0.0...3.1.0
[3.0.0]: https://github.com/sebastianbergmann/type/compare/2.3.4...3.0.0
[2.3.4]: https://github.com/sebastianbergmann/type/compare/ca39369c41313ed12c071ed38ecda8fcdb248859...2.3.4
[2.3.3]: https://github.com/sebastianbergmann/type/compare/2.3.2...ca39369c41313ed12c071ed38ecda8fcdb248859

View File

@@ -44,7 +44,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
"dev-master": "3.1-dev"
}
}
}

View File

@@ -41,6 +41,10 @@ final class SimpleType extends Type
return true;
}
if ($this->name === 'bool' && $other->name() === 'true') {
return true;
}
if ($this->name === 'bool' && $other->name() === 'false') {
return true;
}

View File

@@ -0,0 +1,39 @@
<?php declare(strict_types=1);
/*
* This file is part of sebastian/type.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\Type;
final class TrueType extends Type
{
public function isAssignable(Type $other): bool
{
if ($other instanceof self) {
return true;
}
return $other instanceof SimpleType &&
$other->name() === 'bool' &&
$other->value() === true;
}
public function name(): string
{
return 'true';
}
public function allowsNull(): bool
{
return false;
}
public function isTrue(): bool
{
return true;
}
}

View File

@@ -19,8 +19,14 @@ abstract class Type
{
public static function fromValue($value, bool $allowsNull): self
{
if ($value === false) {
return new FalseType;
if ($allowsNull === false) {
if ($value === true) {
return new TrueType;
}
if ($value === false) {
return new FalseType;
}
}
$typeName = gettype($value);
@@ -48,6 +54,9 @@ abstract class Type
case 'callable':
return new CallableType($allowsNull);
case 'true':
return new TrueType;
case 'false':
return new FalseType;
@@ -94,6 +103,11 @@ abstract class Type
return false;
}
public function isTrue(): bool
{
return false;
}
public function isFalse(): bool
{
return false;