Skip to content

Commit 7d11afb

Browse files
committed
Update @return descriptions across all traits for consistency
- Unified @return descriptions to 'Enables fluent chaining of assertion methods' - Applied changes to all 8 traits for codebase uniformity
1 parent 00230ea commit 7d11afb

8 files changed

Lines changed: 72 additions & 44 deletions

src/Traits/ArrayAssertions.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ trait ArrayAssertions
2424
* @param int $expectedCount The expected number of elements.
2525
* @param string $message Optional custom error message.
2626
*
27-
* @return ArrayAssertions|FluentAssertions Returns the FluentAssertions instance for method chaining.
27+
* @return self|FluentAssertions Returns the FluentAssertions instance for method chaining.
2828
*/
2929
public function count(int $expectedCount, string $message = ''): self
3030
{
@@ -45,7 +45,7 @@ public function count(int $expectedCount, string $message = ''): self
4545
* @param int $elementsCount The number of elements that should not match.
4646
* @param string $message Optional custom error message.
4747
*
48-
* @return self Enables fluent chaining of assertion methods.
48+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
4949
*/
5050
public function notCount(int $elementsCount, string $message = ''): self
5151
{
@@ -65,13 +65,13 @@ public function notCount(int $elementsCount, string $message = ''): self
6565
*
6666
* @param array $values The associative array that should be contained within the actual array.
6767
*
68-
* @return self Enables fluent chaining of assertion methods.
68+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
6969
*/
7070
public function arrayContainsAssociativeArray(array $values): self
7171
{
7272
Assert::assertTrue(
73-
condition: $this->arrayContainsAssociativeArrayRecursive($this->variable, $values),
74-
message: sprintf(
73+
$this->arrayContainsAssociativeArrayRecursive($this->variable, $values),
74+
sprintf(
7575
"Array does not contain associative array. \n\nArray: '%s' \n\nExpected values: '%s'",
7676
var_export($this->variable, true),
7777
var_export($values, true),
@@ -108,7 +108,7 @@ protected function arrayContainsAssociativeArrayRecursive(array $data, array $va
108108
* @param int|string $key The key to check for existence.
109109
* @param string $message Optional custom error message.
110110
*
111-
* @return self Enables fluent chaining of assertion methods.
111+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
112112
*/
113113
public function arrayHasKey(int|string $key, string $message = ''): self
114114
{
@@ -129,7 +129,7 @@ public function arrayHasKey(int|string $key, string $message = ''): self
129129
* @param int|string $key The key that should not exist.
130130
* @param string $message Optional custom error message.
131131
*
132-
* @return self Enables fluent chaining of assertion methods.
132+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
133133
*/
134134
public function arrayNotHasKey(int|string $key, string $message = ''): self
135135
{
@@ -150,7 +150,7 @@ public function arrayNotHasKey(int|string $key, string $message = ''): self
150150
* @param mixed $value The value to check for.
151151
* @param string $message Optional custom error message.
152152
*
153-
* @return self Enables fluent chaining of assertion methods.
153+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
154154
*/
155155
public function contains(mixed $value, string $message = ''): self
156156
{
@@ -171,7 +171,7 @@ public function contains(mixed $value, string $message = ''): self
171171
* @param mixed $value The value that should not be present.
172172
* @param string $message Optional custom error message.
173173
*
174-
* @return self Enables fluent chaining of assertion methods.
174+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
175175
*/
176176
public function doesNotContain(mixed $value, string $message = ''): self
177177
{
@@ -192,7 +192,7 @@ public function doesNotContain(mixed $value, string $message = ''): self
192192
* @param int $size The expected size.
193193
* @param string $message Optional custom error message.
194194
*
195-
* @return self Enables fluent chaining of assertion methods.
195+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
196196
*/
197197
public function hasSize(int $size, string $message = ''): self
198198
{
@@ -212,7 +212,7 @@ public function hasSize(int $size, string $message = ''): self
212212
*
213213
* @param string $message Optional custom error message.
214214
*
215-
* @return self Enables fluent chaining of assertion methods.
215+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
216216
*/
217217
public function isEmptyArray(string $message = ''): self
218218
{
@@ -232,7 +232,7 @@ public function isEmptyArray(string $message = ''): self
232232
*
233233
* @param string $message Optional custom error message.
234234
*
235-
* @return self Enables fluent chaining of assertion methods.
235+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
236236
*/
237237
public function isNotEmptyArray(string $message = ''): self
238238
{

src/Traits/BooleanAssertions.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
namespace K2gl\PHPUnitFluentAssertions\Traits;
66

7+
use K2gl\PHPUnitFluentAssertions\FluentAssertions;
78
use PHPUnit\Framework\Assert;
89

10+
/**
11+
* @phpstan-require-extends FluentAssertions
12+
*/
913
trait BooleanAssertions
1014
{
1115
/**
@@ -20,7 +24,7 @@ trait BooleanAssertions
2024
*
2125
* @param string $message Optional custom error message.
2226
*
23-
* @return self Enables fluent chaining of assertion methods.
27+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
2428
*/
2529
public function true(string $message = ''): self
2630
{
@@ -41,7 +45,7 @@ public function true(string $message = ''): self
4145
*
4246
* @param string $message Optional custom error message.
4347
*
44-
* @return self Enables fluent chaining of assertion methods.
48+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
4549
*/
4650
public function notTrue(string $message = ''): self
4751
{
@@ -62,7 +66,7 @@ public function notTrue(string $message = ''): self
6266
*
6367
* @param string $message Optional custom error message.
6468
*
65-
* @return self Enables fluent chaining of assertion methods.
69+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
6670
*/
6771
public function false(string $message = ''): self
6872
{
@@ -83,7 +87,7 @@ public function false(string $message = ''): self
8387
*
8488
* @param string $message Optional custom error message.
8589
*
86-
* @return self Enables fluent chaining of assertion methods.
90+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
8791
*/
8892
public function notFalse(string $message = ''): self
8993
{

src/Traits/ComparisonAndEqualityAssertions.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
namespace K2gl\PHPUnitFluentAssertions\Traits;
66

7+
use K2gl\PHPUnitFluentAssertions\FluentAssertions;
78
use PHPUnit\Framework\Assert;
89

10+
/**
11+
* @phpstan-require-extends FluentAssertions
12+
*/
913
trait ComparisonAndEqualityAssertions
1014
{
1115
/**
@@ -21,7 +25,7 @@ trait ComparisonAndEqualityAssertions
2125
* @param mixed $expected The expected value to compare against.
2226
* @param string $message Optional custom error message.
2327
*
24-
* @return self Enables fluent chaining of assertion methods.
28+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
2529
*/
2630
public function is(mixed $expected, string $message = ''): self
2731
{
@@ -42,7 +46,7 @@ public function is(mixed $expected, string $message = ''): self
4246
* @param mixed $expected The expected value to compare against.
4347
* @param string $message Optional custom error message.
4448
*
45-
* @return self Enables fluent chaining of assertion methods.
49+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
4650
*/
4751
public function equals(mixed $expected, string $message = ''): self
4852
{
@@ -64,7 +68,7 @@ public function equals(mixed $expected, string $message = ''): self
6468
* @param mixed $expected The value that the actual value should not be.
6569
* @param string $message Optional custom error message.
6670
*
67-
* @return self Enables fluent chaining of assertion methods.
71+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
6872
*/
6973
public function not(mixed $expected, string $message = ''): self
7074
{

src/Traits/NullAssertions.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
namespace K2gl\PHPUnitFluentAssertions\Traits;
66

7+
use K2gl\PHPUnitFluentAssertions\FluentAssertions;
78
use PHPUnit\Framework\Assert;
89

10+
/**
11+
* @phpstan-require-extends FluentAssertions
12+
*/
913
trait NullAssertions
1014
{
1115
/**
@@ -19,7 +23,7 @@ trait NullAssertions
1923
*
2024
* @param string $message Optional custom error message.
2125
*
22-
* @return self Enables fluent chaining of assertion methods.
26+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
2327
*/
2428
public function null(string $message = ''): self
2529
{
@@ -39,7 +43,7 @@ public function null(string $message = ''): self
3943
*
4044
* @param string $message Optional custom error message.
4145
*
42-
* @return self Enables fluent chaining of assertion methods.
46+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
4347
*/
4448
public function notNull(string $message = ''): self
4549
{

src/Traits/NumericAssertions.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
namespace K2gl\PHPUnitFluentAssertions\Traits;
66

7+
use K2gl\PHPUnitFluentAssertions\FluentAssertions;
78
use PHPUnit\Framework\Assert;
89

10+
/**
11+
* @phpstan-require-extends FluentAssertions
12+
*/
913
trait NumericAssertions
1014
{
1115
// region Comparison Methods
@@ -23,7 +27,7 @@ trait NumericAssertions
2327
* @param int|float $expected The value to compare against.
2428
* @param string $message Optional custom error message.
2529
*
26-
* @return self Enables fluent chaining of assertion methods.
30+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
2731
*/
2832
public function isLowerThan(int|float $expected, string $message = ''): self
2933
{
@@ -45,7 +49,7 @@ public function isLowerThan(int|float $expected, string $message = ''): self
4549
* @param int|float $expected The value to compare against.
4650
* @param string $message Optional custom error message.
4751
*
48-
* @return self Enables fluent chaining of assertion methods.
52+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
4953
*/
5054
public function isGreaterThan(int|float $expected, string $message = ''): self
5155
{
@@ -69,7 +73,7 @@ public function isGreaterThan(int|float $expected, string $message = ''): self
6973
*
7074
* @param string $message Optional custom error message.
7175
*
72-
* @return self Enables fluent chaining of assertion methods.
76+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
7377
*/
7478
public function isPositive(string $message = ''): self
7579
{
@@ -89,7 +93,7 @@ public function isPositive(string $message = ''): self
8993
*
9094
* @param string $message Optional custom error message.
9195
*
92-
* @return self Enables fluent chaining of assertion methods.
96+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
9397
*/
9498
public function isNegative(string $message = ''): self
9599
{
@@ -114,7 +118,7 @@ public function isNegative(string $message = ''): self
114118
*
115119
* @param string $message Optional custom error message.
116120
*
117-
* @return self Enables fluent chaining of assertion methods.
121+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
118122
*/
119123
public function isZero(string $message = ''): self
120124
{
@@ -136,7 +140,7 @@ public function isZero(string $message = ''): self
136140
* @param int|float $max The maximum value.
137141
* @param string $message Optional custom error message.
138142
*
139-
* @return self Enables fluent chaining of assertion methods.
143+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
140144
*/
141145
public function isBetween(int|float $min, int|float $max, string $message = ''): self
142146
{

src/Traits/SpecialAssertions.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
namespace K2gl\PHPUnitFluentAssertions\Traits;
66

7+
use K2gl\PHPUnitFluentAssertions\FluentAssertions;
78
use K2gl\PHPUnitFluentAssertions\Reference\RegularExpressionPattern;
89

10+
/**
11+
* @phpstan-require-extends FluentAssertions
12+
*/
913
trait SpecialAssertions
1014
{
1115
/**
@@ -19,7 +23,7 @@ trait SpecialAssertions
1923
* fact('01ARZ3NDEKTSV4RRFFQ69G5FAV')->ulid(); // Passes (if valid ULID)
2024
* fact('invalid-ulid')->ulid(); // Fails
2125
*
22-
* @return self Enables fluent chaining of assertion methods.
26+
* @return self|fluentAssertions Enables fluent chaining of assertion methods.
2327
*/
2428
public function ulid(): self
2529
{

0 commit comments

Comments
 (0)