Skip to content

Commit 7c37ab7

Browse files
committed
Improve phpDoc class docs
1 parent 4f4ba98 commit 7c37ab7

9 files changed

+67
-32
lines changed

src/ArrayAssertsTrait.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
* This trait implements an assertion method and constraint creation method per
3838
* implemented constraint, namely
3939
*
40-
* - the `assertAssociativeArray` and `associativeArray` methods for
41-
* {@class PhrozenByte\PHPUnitArrayAsserts\Constraint\AssociativeArray},
42-
* - the `assertArrayHasKeyWith` and `arrayHasKeyWith` methods for
43-
* {@class PhrozenByte\PHPUnitArrayAsserts\Constraint\ArrayHasKeyWith},
44-
* - the `assertSequentialArray` and `sequentialArray` methods for
45-
* {@class PhrozenByte\PHPUnitArrayAsserts\Constraint\SequentialArray}, and
46-
* - the `assertArrayHasItemWith` and `arrayHasItemWith` methods for
47-
* {@class PhrozenByte\PHPUnitArrayAsserts\Constraint\ArrayHasItemWith}.
40+
* - the `assertAssociativeArray()` and `associativeArray()` methods for
41+
* {@see AssociativeArray},
42+
* - the `assertArrayHasKeyWith()` and `arrayHasKeyWith()` methods for
43+
* {@see ArrayHasKeyWith},
44+
* - the `assertSequentialArray()` and `sequentialArray()` methods for
45+
* {@see SequentialArray}, and
46+
* - the `assertArrayHasItemWith()` and `arrayHasItemWith()` methods for
47+
* {@see ArrayHasItemWith}.
4848
*/
4949
trait ArrayAssertsTrait
5050
{

src/Assert.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
/**
2323
* A set of array-related assertion methods.
2424
*
25-
* This static class just uses the `ArrayAssertsTrait` trait. Refer to
26-
* {@class PhrozenByte\PHPUnitArrayAsserts\ArrayAssertsTrait} for more info.
25+
* This static class just uses the {@see ArrayAssertsTrait} trait. Refer to
26+
* {@see ArrayAssertsTrait} for more info.
2727
*/
2828
class Assert
2929
{

src/Constraint/ArrayHasItemWith.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public function __construct(int $index, Constraint $constraint)
5757
}
5858

5959
/**
60-
* {@inheritDoc}
60+
* Returns a human-readable string representation of this Constraint.
61+
*
62+
* @return string string representation of the Constraint
6163
*/
6264
public function toString(): string
6365
{
@@ -66,7 +68,11 @@ public function toString(): string
6668
}
6769

6870
/**
69-
* {@inheritDoc}
71+
* Returns whether the given value matches the Constraint.
72+
*
73+
* @param mixed $other the value to evaluate
74+
*
75+
* @return bool boolean indicating whether the value matches the Constraint
7076
*/
7177
protected function matches($other): bool
7278
{
@@ -87,7 +93,7 @@ protected function matches($other): bool
8793
}
8894

8995
/**
90-
* {@inheritDoc}
96+
* Returns the number of assertions performed by this Constraint.
9197
*/
9298
public function count(): int
9399
{

src/Constraint/ArrayHasKeyWith.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public function __construct($key, Constraint $constraint)
6060
}
6161

6262
/**
63-
* {@inheritDoc}
63+
* Returns a human-readable string representation of this Constraint.
64+
*
65+
* @return string string representation of the Constraint
6466
*/
6567
public function toString(): string
6668
{
@@ -69,7 +71,11 @@ public function toString(): string
6971
}
7072

7173
/**
72-
* {@inheritDoc}
74+
* Returns whether the given value matches the Constraint.
75+
*
76+
* @param mixed $other the value to evaluate
77+
*
78+
* @return bool boolean indicating whether the value matches the Constraint
7379
*/
7480
protected function matches($other): bool
7581
{
@@ -88,7 +94,7 @@ protected function matches($other): bool
8894
}
8995

9096
/**
91-
* {@inheritDoc}
97+
* Returns the number of assertions performed by this Constraint.
9298
*/
9399
public function count(): int
94100
{

src/Constraint/AssociativeArray.php

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ public function __construct(array $constraints, bool $allowMissing = false, bool
7171
}
7272

7373
/**
74-
* {@inheritDoc}
74+
* Returns a human-readable string representation of this Constraint.
75+
*
76+
* @return string string representation of the Constraint
7577
*/
7678
public function toString(): string
7779
{
@@ -105,7 +107,11 @@ public function toString(): string
105107
}
106108

107109
/**
108-
* {@inheritDoc}
110+
* Returns whether the given value matches the Constraint.
111+
*
112+
* @param mixed $other the value to evaluate
113+
*
114+
* @return bool boolean indicating whether the value matches the Constraint
109115
*/
110116
protected function matches($other): bool
111117
{
@@ -130,7 +136,7 @@ protected function matches($other): bool
130136
}
131137

132138
/**
133-
* {@inheritDoc}
139+
* Returns the number of assertions performed by this Constraint.
134140
*/
135141
public function count(): int
136142
{
@@ -143,7 +149,14 @@ public function count(): int
143149
}
144150

145151
/**
146-
* {@inheritDoc}
152+
* Returns the description of the failure.
153+
*
154+
* The beginning of failure messages is "Failed asserting that" in most
155+
* cases. This method should return the second part of that sentence.
156+
*
157+
* @param mixed $other evaluated value
158+
*
159+
* @return string the failure description
147160
*/
148161
protected function failureDescription($other): string
149162
{
@@ -155,7 +168,11 @@ protected function failureDescription($other): string
155168
}
156169

157170
/**
158-
* {@inheritDoc}
171+
* Returns additional failure description.
172+
*
173+
* @param mixed $other the evaluated value
174+
*
175+
* @return string the failure description
159176
*/
160177
protected function additionalFailureDescription($other): string
161178
{

src/Constraint/SequentialArray.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ public function __construct(int $minItems = 0, int $maxItems = null, Constraint
8585
}
8686

8787
/**
88-
* {@inheritDoc}
88+
* Returns a human-readable string representation of this Constraint.
89+
*
90+
* @return string string representation of the Constraint
8991
*/
9092
public function toString(): string
9193
{
@@ -121,7 +123,11 @@ public function toString(): string
121123
}
122124

123125
/**
124-
* {@inheritDoc}
126+
* Returns whether the given value matches the Constraint.
127+
*
128+
* @param mixed $other the value to evaluate
129+
*
130+
* @return bool boolean indicating whether the value matches the Constraint
125131
*/
126132
protected function matches($other): bool
127133
{
@@ -250,7 +256,7 @@ protected function inspectData($other): array
250256
}
251257

252258
/**
253-
* {@inheritDoc}
259+
* Returns the number of assertions performed by this Constraint.
254260
*/
255261
public function count(): int
256262
{

tests/Utils/ArrayAccessible.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,31 @@ public function __construct(array $data = [])
4040
}
4141

4242
/**
43-
* @inheritDoc
43+
* {@inheritDoc}
4444
*/
4545
public function offsetExists($offset): bool
4646
{
4747
return isset($this->data[$offset]);
4848
}
4949

5050
/**
51-
* @inheritDoc
51+
* {@inheritDoc}
5252
*/
5353
public function offsetGet($offset)
5454
{
5555
return $this->data[$offset] ?? null;
5656
}
5757

5858
/**
59-
* @inheritDoc
59+
* {@inheritDoc}
6060
*/
6161
public function offsetSet($offset, $value): void
6262
{
6363
$this->data[$offset] = $value;
6464
}
6565

6666
/**
67-
* @inheritDoc
67+
* {@inheritDoc}
6868
*/
6969
public function offsetUnset($offset): void
7070
{

tests/Utils/IteratorAggregated.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(Iterator $iterator)
4343
}
4444

4545
/**
46-
* @inheritDoc
46+
* {@inheritDoc}
4747
*/
4848
public function getIterator(): Traversable
4949
{

tests/Utils/TestConstraint.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,23 @@ public function __construct(array $options = [])
4848
}
4949

5050
/**
51-
* @inheritDoc
51+
* {@inheritDoc}
5252
*/
5353
public function toString(): string
5454
{
5555
return $this->toString;
5656
}
5757

5858
/**
59-
* @inheritDoc
59+
* {@inheritDoc}
6060
*/
6161
protected function matches($other): bool
6262
{
6363
return $this->matches;
6464
}
6565

6666
/**
67-
* @inheritDoc
67+
* {@inheritDoc}
6868
*/
6969
public function count(): int
7070
{

0 commit comments

Comments
 (0)