Skip to content

Commit

Permalink
Use a single line to describe return type
Browse files Browse the repository at this point in the history
Signed-off-by: Henrique Moody <[email protected]>
  • Loading branch information
henriquemoody committed Feb 4, 2024
1 parent c079ecb commit b1555fb
Show file tree
Hide file tree
Showing 140 changed files with 552 additions and 1,096 deletions.
8 changes: 2 additions & 6 deletions tests/unit/Rules/AlnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
#[CoversClass(Alnum::class)]
final class AlnumTest extends RuleTestCase
{
/**
* @return array<array{Alnum, mixed}>
*/
/** @return iterable<array{Alnum, mixed}> */
public static function providerForValidInput(): iterable
{
return [
Expand All @@ -42,9 +40,7 @@ public static function providerForValidInput(): iterable
];
}

/**
* @return array<array{Alnum, mixed}>
*/
/** @return iterable<array{Alnum, mixed}> */
public static function providerForInvalidInput(): iterable
{
return [
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/AlphaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
#[CoversClass(Alpha::class)]
final class AlphaTest extends RuleTestCase
{
/**
* @return array<string, array{Alpha, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<string, array{Alpha, mixed}> */
public static function providerForValidInput(): iterable
{
return [
'alphabetic' => [new Alpha(), 'alganet'],
Expand All @@ -33,10 +31,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<string, array{Alpha, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<string, array{Alpha, mixed}> */
public static function providerForInvalidInput(): iterable
{
return [
'empty string' => [new Alpha(), ''],
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Rules/AlwaysInvalidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function itShouldAlwaysBeInvalid(mixed $input): void
/**
* @return mixed[][]
*/
public static function providerForInvalidInput(): array
public static function providerForInvalidInput(): iterable
{
return [
[0],
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Rules/AlwaysValidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function itAlwaysBeValid(mixed $input): void
/**
* @return mixed[][]
*/
public static function providerForValidInput(): array
public static function providerForValidInput(): iterable
{
return [
[0],
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/ArrayTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
#[CoversClass(ArrayType::class)]
final class ArrayTypeTest extends RuleTestCase
{
/**
* @return array<array{ArrayType, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{ArrayType, mixed}> */
public static function providerForValidInput(): iterable
{
$rule = new ArrayType();

Expand All @@ -32,10 +30,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{ArrayType, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{ArrayType, mixed}> */
public static function providerForInvalidInput(): iterable
{
$rule = new ArrayType();

Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/ArrayValTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
#[CoversClass(ArrayVal::class)]
final class ArrayValTest extends RuleTestCase
{
/**
* @return array<array{ArrayVal, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{ArrayVal, mixed}> */
public static function providerForValidInput(): iterable
{
$rule = new ArrayVal();

Expand All @@ -35,10 +33,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{ArrayVal, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{ArrayVal, mixed}> */
public static function providerForInvalidInput(): iterable
{
$rule = new ArrayVal();

Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/Base64Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
#[CoversClass(Base64::class)]
final class Base64Test extends RuleTestCase
{
/**
* @return array<array{Base64, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{Base64, mixed}> */
public static function providerForValidInput(): iterable
{
$rule = new Base64();

Expand Down Expand Up @@ -51,10 +49,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{Base64, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{Base64, mixed}> */
public static function providerForInvalidInput(): iterable
{
$rule = new Base64();

Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
#[CoversClass(Base::class)]
final class BaseTest extends RuleTestCase
{
/**
* @return array<array{Base, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{Base, mixed}> */
public static function providerForValidInput(): iterable
{
return [
[new Base(2), '011010001'],
Expand All @@ -35,10 +33,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{Base, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{Base, mixed}> */
public static function providerForInvalidInput(): iterable
{
return [
[new Base(2), ''],
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/BetweenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ public function minimumValueShouldNotBeEqualsToMaximumValue(): void
new Between(5, 5);
}

/**
* @return array<array{Between, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{Between, mixed}> */
public static function providerForValidInput(): iterable
{
return [
[new Between(0, 1), 1],
Expand All @@ -56,10 +54,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{Between, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{Between, mixed}> */
public static function providerForInvalidInput(): iterable
{
return [
[new Between(10, 20), ''],
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/BoolTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
#[CoversClass(BoolType::class)]
final class BoolTypeTest extends RuleTestCase
{
/**
* @return array<array{BoolType, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{BoolType, mixed}> */
public static function providerForValidInput(): iterable
{
$rule = new BoolType();

Expand All @@ -31,10 +29,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{BoolType, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{BoolType, mixed}> */
public static function providerForInvalidInput(): iterable
{
$rule = new BoolType();

Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/BoolValTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
#[CoversClass(BoolVal::class)]
final class BoolValTest extends RuleTestCase
{
/**
* @return array<array{BoolVal, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{BoolVal, mixed}> */
public static function providerForValidInput(): iterable
{
$rule = new BoolVal();

Expand All @@ -37,10 +35,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{BoolVal, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{BoolVal, mixed}> */
public static function providerForInvalidInput(): iterable
{
$rule = new BoolVal();

Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/BsnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
#[CoversClass(Bsn::class)]
final class BsnTest extends RuleTestCase
{
/**
* @return array<array{Bsn, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{Bsn, mixed}> */
public static function providerForValidInput(): iterable
{
$rule = new Bsn();

Expand All @@ -38,10 +36,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{Bsn, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{Bsn, mixed}> */
public static function providerForInvalidInput(): iterable
{
$rule = new Bsn();

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/Rules/CallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,16 @@ public function itShouldRestorePreviousPhpErrorHandler(): void
trigger_error('Forcing PHP to trigger an error');
}

/** @return array<string, array{Call, mixed}> */
public static function providerForValidInput(): array
/** @return iterable<string, array{Call, mixed}> */
public static function providerForValidInput(): iterable
{
return [
'valid rule and valid callable' => [new Call('trim', Stub::pass(1)), ' input '],
];
}

/** @return array<string, array{Call, mixed}> */
public static function providerForInvalidInput(): array
/** @return iterable<string, array{Call, mixed}> */
public static function providerForInvalidInput(): iterable
{
return [
'PHP error' => [new Call('trim', Stub::pass(1)), []],
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/CallableTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
#[CoversClass(CallableType::class)]
final class CallableTypeTest extends RuleTestCase
{
/**
* @return array<array{CallableType, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{CallableType, mixed}> */
public static function providerForValidInput(): iterable
{
$rule = new CallableType();

Expand All @@ -36,10 +34,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{CallableType, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{CallableType, mixed}> */
public static function providerForInvalidInput(): iterable
{
$rule = new CallableType();

Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/CallbackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
#[CoversClass(Callback::class)]
final class CallbackTest extends RuleTestCase
{
/**
* @return array<array{Callback, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{Callback, mixed}> */
public static function providerForValidInput(): iterable
{
return [
[new Callback('is_a', 'stdClass'), new stdClass()],
Expand All @@ -37,10 +35,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{Callback, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{Callback, mixed}> */
public static function providerForInvalidInput(): iterable
{
return [
[
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/CharsetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ public function itShouldThrowsExceptionWhenCharsetIsNotValid(): void
new Charset('UTF-8', 'UTF-9');
}

/**
* @return array<array{Charset, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{Charset, mixed}> */
public static function providerForValidInput(): iterable
{
return [
[new Charset('UTF-8'), ''],
Expand All @@ -47,10 +45,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{Charset, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{Charset, mixed}> */
public static function providerForInvalidInput(): iterable
{
$rule = new Charset('ASCII');

Expand Down
12 changes: 4 additions & 8 deletions tests/unit/Rules/CnhTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
#[CoversClass(Cnh::class)]
final class CnhTest extends RuleTestCase
{
/**
* @return array<array{Cnh, mixed}>
*/
public static function providerForValidInput(): array
/** @return iterable<array{Cnh, mixed}> */
public static function providerForValidInput(): iterable
{
$rule = new Cnh();

Expand Down Expand Up @@ -53,10 +51,8 @@ public static function providerForValidInput(): array
];
}

/**
* @return array<array{Cnh, mixed}>
*/
public static function providerForInvalidInput(): array
/** @return iterable<array{Cnh, mixed}> */
public static function providerForInvalidInput(): iterable
{
$rule = new Cnh();

Expand Down
Loading

0 comments on commit b1555fb

Please sign in to comment.