Skip to content

Commit

Permalink
CS
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptouuuu committed Jan 28, 2024
1 parent 90fec23 commit 2795c91
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 40 deletions.
50 changes: 25 additions & 25 deletions proofs/runner/assert.php
Expand Up @@ -19,7 +19,7 @@ static function($assert, $message) {

try {
$sut->fail($message);
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand All @@ -41,7 +41,7 @@ static function($assert, $message) {

try {
$sut->that(static fn() => true);
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert->fail('it should not throw');
}

Expand All @@ -62,7 +62,7 @@ static function($assert, $message) {
yield proof(
'Assert->throws()',
given(
Set\Elements::of(\RuntimeException::class, \LogicException::class, \DomainException::class),
Set\Elements::of(RuntimeException::class, LogicException::class, DomainException::class),
Set\Strings::any(),
),
static function($assert, $kind, $message) {
Expand All @@ -89,7 +89,7 @@ static function($assert, $kind, $message) {
yield proof(
'Assert->not()->throws()',
given(
Set\Elements::of(\RuntimeException::class, \LogicException::class, \DomainException::class),
Set\Elements::of(RuntimeException::class, LogicException::class, DomainException::class),
Set\Strings::any(),
),
static function($assert, $kind, $message) {
Expand Down Expand Up @@ -124,7 +124,7 @@ static function($assert, $values, $count, $message) {
$sut = Assert::of($stats = Stats::new());

$sut->count(\count($values), $values);
$sut->count(\count($values), new \ArrayObject($values));
$sut->count(\count($values), new ArrayObject($values));

try {
$sut->count($count, $values);
Expand Down Expand Up @@ -155,7 +155,7 @@ static function($assert, $values, $count, $message) {
$sut = Assert::of($stats = Stats::new());

$sut->not()->count($count, $values);
$sut->not()->count($count, new \ArrayObject($values));
$sut->not()->count($count, new ArrayObject($values));

try {
$sut->not()->count(\count($values), $values);
Expand Down Expand Up @@ -648,11 +648,11 @@ static function($assert, $value, $message) {
static function($assert, $message) {
$sut = Assert::of($stats = Stats::new());

$sut->object(new \stdClass)->instance(\stdClass::class);
$sut->object(new \LogicException)->instance(\LogicException::class);
$sut->object(new stdClass)->instance(stdClass::class);
$sut->object(new LogicException)->instance(LogicException::class);

try {
$sut->object(new \stdClass)->instance(\LogicException::class);
$sut->object(new stdClass)->instance(LogicException::class);
$assert->fail($message);
} catch (Failure $e) {
$assert
Expand All @@ -675,10 +675,10 @@ static function($assert, $message) {
static function($assert, $message) {
$sut = Assert::of($stats = Stats::new());

$sut->object(new \stdClass)->not()->instance(\LogicException::class);
$sut->object(new stdClass)->not()->instance(LogicException::class);

try {
$sut->object(new \stdClass)->not()->instance(\stdClass::class);
$sut->object(new stdClass)->not()->instance(stdClass::class);
$assert->fail($message);
} catch (Failure $e) {
$assert
Expand All @@ -698,7 +698,7 @@ static function($assert, $message) {
yield proof(
'Assert->number()',
given(
Set\Elements::of(new \stdClass, null, true, false, \tmpfile(), []),
Set\Elements::of(new stdClass, null, true, false, \tmpfile(), []),
Set\Either::any(
Set\Integers::any(),
Set\RealNumbers::any(),
Expand Down Expand Up @@ -915,7 +915,7 @@ static function($assert, $int, $diff, $message) {
'Assert->string()',
given(
Set\Strings::any(),
Set\Elements::of([], true, null, new \ArrayObject),
Set\Elements::of([], true, null, new ArrayObject),
Set\Strings::any(),
),
static function($assert, $string, $value, $message) {
Expand Down Expand Up @@ -1237,7 +1237,7 @@ static function($assert, $prefix, $string, $message) {
'Assert->array()',
given(
Set\Sequence::of(Set\Type::any()),
Set\Elements::of('', true, null, new \ArrayObject),
Set\Elements::of('', true, null, new ArrayObject),
Set\Strings::any(),
),
static function($assert, $array, $value, $message) {
Expand Down Expand Up @@ -1338,7 +1338,7 @@ static function($assert, $value, $message) {

try {
$sut->matches(static fn($sut) => $sut->fail($message));
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand Down Expand Up @@ -1375,7 +1375,7 @@ static function($assert, $microseconds, $message) {
->inLessThan()
->milliseconds(1, $message);
$assert->fail('it should throw');
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand Down Expand Up @@ -1412,7 +1412,7 @@ static function($assert, $microseconds, $message) {
->inLessThan()
->seconds(1, $message);
$assert->fail('it should throw');
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand Down Expand Up @@ -1449,7 +1449,7 @@ static function($assert, $microseconds, $message) {
->inMoreThan()
->milliseconds(2, $message);
$assert->fail('it should throw');
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand Down Expand Up @@ -1486,7 +1486,7 @@ static function($assert, $microseconds, $message) {
->inMoreThan()
->seconds(2, $message);
$assert->fail('it should throw');
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand Down Expand Up @@ -1522,7 +1522,7 @@ static function($assert, $message) {
->inLessThan()
->bytes(1, $message);
$assert->fail('it should throw');
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand Down Expand Up @@ -1556,7 +1556,7 @@ static function($assert, $message) {
->inLessThan()
->kiloBytes(1, $message);
$assert->fail('it should throw');
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand Down Expand Up @@ -1590,7 +1590,7 @@ static function($assert, $message) {
->inLessThan()
->megaBytes(1, $message);
$assert->fail('it should throw');
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand Down Expand Up @@ -1624,7 +1624,7 @@ static function($assert, $message) {
->inMoreThan()
->bytes(1, $message);
$assert->fail('it should throw');
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand Down Expand Up @@ -1658,7 +1658,7 @@ static function($assert, $message) {
->inMoreThan()
->kiloBytes(1, $message);
$assert->fail('it should throw');
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand Down Expand Up @@ -1692,7 +1692,7 @@ static function($assert, $message) {
->inMoreThan()
->megaBytes(1, $message);
$assert->fail('it should throw');
} catch (\Throwable $e) {
} catch (Throwable $e) {
$assert
->object($e)
->instance(Failure::class);
Expand Down
6 changes: 3 additions & 3 deletions proofs/set/call.php
Expand Up @@ -11,7 +11,7 @@
yield test(
'Set\Call always return a new value',
static function($assert) {
$set = Set\Call::of(static fn() => new \stdClass)->values(Random::default);
$set = Set\Call::of(static fn() => new stdClass)->values(Random::default);
$current = $set->current()->unwrap();
$set->next();

Expand All @@ -24,7 +24,7 @@ static function($assert) {
yield test(
'Set\Call is not shrinkable',
static function($assert) {
$set = Set\Call::of(static fn() => new \stdClass)->values(Random::default);
$set = Set\Call::of(static fn() => new stdClass)->values(Random::default);
$current = $set->current();

$assert->false($current->shrinkable());
Expand All @@ -34,7 +34,7 @@ static function($assert) {
yield test(
'Set\Call regenerate the value each time it is accessed',
static function($assert) {
$set = Set\Call::of(static fn() => new \stdClass)->values(Random::default);
$set = Set\Call::of(static fn() => new stdClass)->values(Random::default);
$current = $set->current();

$assert
Expand Down
12 changes: 6 additions & 6 deletions src/Set/Email.php
Expand Up @@ -60,16 +60,16 @@ private static function domain(): Set
private static function string(int $maxLength, string ...$extra): Set
{
/** @var Set<non-empty-string> */
return Set\Either::any(
return Either::any(
// either only with simple characters
Set\Sequence::of(self::letter())
Sequence::of(self::letter())
->between(1, $maxLength)
->map(static fn(array $chars): string => \implode('', $chars)),
// or with some extra ones in the middle
Set\Composite::immutable(
Composite::immutable(
static fn(string ...$parts): string => \implode('', $parts),
self::letter(),
Set\Sequence::of(self::letter(...$extra))
Sequence::of(self::letter(...$extra))
->between(1, $maxLength - 2)
->map(static fn(array $chars): string => \implode('', $chars)),
self::letter(),
Expand All @@ -89,7 +89,7 @@ private static function tld(): Set
/**
* @var Set<non-empty-string>
*/
return Set\Sequence::of(Set\Elements::of(...\range('a', 'z'), ...\range('A', 'Z')))
return Sequence::of(Elements::of(...\range('a', 'z'), ...\range('A', 'Z')))
->between(1, 63)
->map(static fn(array $chars): string => \implode('', $chars));
}
Expand All @@ -104,7 +104,7 @@ private static function tld(): Set
private static function letter(string ...$extra): Set
{
/** @var Set<non-empty-string> */
return Set\Elements::of(
return Elements::of(
...\range('a', 'z'),
...\range('A', 'Z'),
...\array_map(
Expand Down
2 changes: 1 addition & 1 deletion src/Set/MutuallyExclusive.php
Expand Up @@ -23,7 +23,7 @@ public static function of(
Set ...$rest,
): Set {
/** @var Set<list<string>> */
return Set\Composite::immutable(
return Composite::immutable(
static fn(string ...$args) => $args,
$first,
$second,
Expand Down
4 changes: 2 additions & 2 deletions src/Set/Type.php
Expand Up @@ -16,7 +16,7 @@ final class Type
public static function any(): Set
{
/** @var Set<mixed> */
return Set\Either::any(
return Either::any(
self::primitives(),
Sequence::of(self::primitives())->between(0, 1), // no more needed to prove type indifference
Sequence::of(self::primitives())
Expand All @@ -36,7 +36,7 @@ private static function primitives(): Set
* @psalm-suppress InvalidArgument Don't why it complains
* @var Set<mixed>
*/
return Set\Either::any(
return Either::any(
Elements::of(true, false, null),
Integers::any(),
RealNumbers::any(),
Expand Down
2 changes: 1 addition & 1 deletion src/Set/Unicode.php
Expand Up @@ -40,7 +40,7 @@ public static function any(): Set
$methods,
);

return Set\Either::any(...$sets);
return Either::any(...$sets);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Set/Uuid.php
Expand Up @@ -14,14 +14,14 @@ final class Uuid
*/
public static function any(): Set
{
$chars = Set\Elements::of(...\range('a', 'f'), ...\range(0, 9));
$chars = Elements::of(...\range('a', 'f'), ...\range(0, 9));
/** @psalm-suppress ArgumentTypeCoercion */
$part = static fn(int $length): Set => Sequence::of($chars)
->between($length, $length)
->map(static fn(array $chars): string => \implode('', $chars));

/** @var Set<non-empty-string> */
return Set\Composite::immutable(
return Composite::immutable(
static fn(string ...$parts): string => \implode('-', $parts),
$part(8),
$part(4),
Expand Down

0 comments on commit 2795c91

Please sign in to comment.