Skip to content

Commit bd48bdc

Browse files
committed
Lint Changelog format in validator docs
Introduces a Markdown linter for checking the Changelog format. "See Also" was transformed into a section to make it easier to handle it with the `Content` class. The "Related" linter was simplified to reflect that change too. An additional "alignment" parameter was added to markdown table generators, allowing the padding and headers to be explicitly marked with a specific left (-1), middle (0) or right(1) alignment. Existing files were fixed using the `fix` option after the changes.
1 parent a915171 commit bd48bdc

167 files changed

Lines changed: 984 additions & 1224 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bin/console

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use Respect\Dev\Markdown\Linters\ValidatorHeaderLinter;
2424
use Respect\Dev\Markdown\Linters\ValidatorIndexLinter;
2525
use Respect\Dev\Markdown\Linters\ValidatorRelatedLinter;
2626
use Respect\Dev\Markdown\Linters\ValidatorTemplatesLinter;
27+
use Respect\Dev\Markdown\Linters\ValidatorChangelogLinter;
2728
use SebastianBergmann\Diff\Differ;
2829
use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder;
2930
use Symfony\Component\Console\Application;
@@ -39,6 +40,7 @@ return (static function () {
3940
new ValidatorIndexLinter(),
4041
new ValidatorRelatedLinter(),
4142
new ValidatorTemplatesLinter(),
43+
new ValidatorChangelogLinter(),
4244
)));
4345
$application->addCommand(new UpdateDomainSuffixesCommand());
4446
$application->addCommand(new UpdateDomainToplevelCommand());

docs/comparing-empty-values.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,7 @@ Choose the validator based on what you consider "empty":
134134

135135
3. **Use `Blank`** when whitespace-only strings, nested empty arrays, and empty objects should also be considered empty.
136136

137-
---
138-
139-
See also:
137+
## See Also
140138

141139
- [Undef](validators/Undef.md)
142140
- [Blank](validators/Blank.md)

docs/validators/All.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ This validator uses [Length](Length.md) with [GreaterThan][GreaterThan.md] inter
2727

2828
### `All::TEMPLATE_STANDARD`
2929

30-
| Mode | Template |
31-
| ---------- | ------------- |
32-
| `default` | Every item in |
30+
| Mode | Template |
31+
| ---------: | :------------ |
32+
| `default` | Every item in |
3333
| `inverted` | Every item in |
3434

3535
## Template as prefix
@@ -52,12 +52,10 @@ v::not(v::all(v::intType()))->assert([1, 2, -3]);
5252
## Changelog
5353

5454
| Version | Description |
55-
| ------: | ----------- |
55+
| ------: | :---------- |
5656
| 3.0.0 | Created |
5757

58-
---
59-
60-
See also:
58+
## See Also
6159

6260
- [Each](Each.md)
6361
- [Length](Length.md)

docs/validators/AllOf.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ v::allOf(v::intVal(), v::positive())->assert(15);
2121

2222
Used when some validators must be failed.
2323

24-
| Mode | Template |
25-
| ---------- | ------------------------------- |
26-
| `default` | {{subject}} must pass the rules |
24+
| Mode | Template |
25+
| ---------: | :------------------------------ |
26+
| `default` | {{subject}} must pass the rules |
2727
| `inverted` | {{subject}} must pass the rules |
2828

2929
### `AllOf::TEMPLATE_ALL`
3030

3131
Used when all validators have failed.
3232

33-
| Mode | Template |
34-
| ---------- | ----------------------------------- |
35-
| `default` | {{subject}} must pass all the rules |
33+
| Mode | Template |
34+
| ---------: | :---------------------------------- |
35+
| `default` | {{subject}} must pass all the rules |
3636
| `inverted` | {{subject}} must pass all the rules |
3737

3838
## Template placeholders
@@ -49,13 +49,11 @@ Used when all validators have failed.
4949
## Changelog
5050

5151
| Version | Description |
52-
| ------: | -------------------------------------------- |
52+
| ------: | :------------------------------------------- |
5353
| 3.0.0 | Require at least two validators to be passed |
5454
| 0.3.9 | Created |
5555

56-
---
57-
58-
See also:
56+
## See Also
5957

6058
- [AnyOf](AnyOf.md)
6159
- [Circuit](Circuit.md)

docs/validators/Alnum.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ of extra chars passed as the parameter.
4545

4646
### `Alnum::TEMPLATE_STANDARD`
4747

48-
| Mode | Template |
49-
| ---------- | ------------------------------------------------------------ |
50-
| `default` | {{subject}} must contain only letters (a-z) and digits (0-9) |
48+
| Mode | Template |
49+
| ---------: | :----------------------------------------------------------- |
50+
| `default` | {{subject}} must contain only letters (a-z) and digits (0-9) |
5151
| `inverted` | {{subject}} must not contain letters (a-z) or digits (0-9) |
5252

5353
### `Alnum::TEMPLATE_EXTRA`
5454

55-
| Mode | Template |
56-
| ---------- | ---------------------------------------------------------------------------------- |
57-
| `default` | {{subject}} must contain only letters (a-z), digits (0-9), and {{additionalChars}} |
55+
| Mode | Template |
56+
| ---------: | :--------------------------------------------------------------------------------- |
57+
| `default` | {{subject}} must contain only letters (a-z), digits (0-9), and {{additionalChars}} |
5858
| `inverted` | {{subject}} must not contain letters (a-z), digits (0-9), or {{additionalChars}} |
5959

6060
## Template placeholders
@@ -71,13 +71,11 @@ of extra chars passed as the parameter.
7171
## Changelog
7272

7373
| Version | Description |
74-
| ------: | ----------------------------------------- |
74+
| ------: | :---------------------------------------- |
7575
| 2.0.0 | Removed support to whitespaces by default |
7676
| 0.3.9 | Created |
7777

78-
---
79-
80-
See also:
78+
## See Also
8179

8280
- [Alpha](Alpha.md)
8381
- [Charset](Charset.md)

docs/validators/Alpha.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ v::alpha()->uppercase()->assert('example');
4040

4141
### `Alpha::TEMPLATE_STANDARD`
4242

43-
| Mode | Template |
44-
| ---------- | ------------------------------------------- |
45-
| `default` | {{subject}} must contain only letters (a-z) |
43+
| Mode | Template |
44+
| ---------: | :------------------------------------------ |
45+
| `default` | {{subject}} must contain only letters (a-z) |
4646
| `inverted` | {{subject}} must not contain letters (a-z) |
4747

4848
### `Alpha::TEMPLATE_EXTRA`
4949

50-
| Mode | Template |
51-
| ---------- | ------------------------------------------------------------------- |
52-
| `default` | {{subject}} must contain only letters (a-z) and {{additionalChars}} |
50+
| Mode | Template |
51+
| ---------: | :------------------------------------------------------------------ |
52+
| `default` | {{subject}} must contain only letters (a-z) and {{additionalChars}} |
5353
| `inverted` | {{subject}} must not contain letters (a-z) or {{additionalChars}} |
5454

5555
## Template placeholders
@@ -66,13 +66,11 @@ v::alpha()->uppercase()->assert('example');
6666
## Changelog
6767

6868
| Version | Description |
69-
| ------: | ----------------------------------------- |
69+
| ------: | :---------------------------------------- |
7070
| 2.0.0 | Removed support to whitespaces by default |
7171
| 0.3.9 | Created |
7272

73-
---
74-
75-
See also:
73+
## See Also
7674

7775
- [Alnum](Alnum.md)
7876
- [Charset](Charset.md)

docs/validators/AlwaysInvalid.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ v::alwaysInvalid()->assert('whatever');
1818

1919
### `AlwaysInvalid::TEMPLATE_STANDARD`
2020

21-
| Mode | Template |
22-
| ---------- | --------------------------- |
23-
| `default` | {{subject}} must be valid |
21+
| Mode | Template |
22+
| ---------: | :-------------------------- |
23+
| `default` | {{subject}} must be valid |
2424
| `inverted` | {{subject}} must be invalid |
2525

2626
### `AlwaysInvalid::TEMPLATE_SIMPLE`
2727

28-
| Mode | Template |
29-
| ---------- | ---------------------- |
30-
| `default` | {{subject}} is invalid |
28+
| Mode | Template |
29+
| ---------: | :--------------------- |
30+
| `default` | {{subject}} is invalid |
3131
| `inverted` | {{subject}} is valid |
3232

3333
## Template placeholders
@@ -43,12 +43,10 @@ v::alwaysInvalid()->assert('whatever');
4343
## Changelog
4444

4545
| Version | Description |
46-
| ------: | ----------- |
46+
| ------: | :---------- |
4747
| 0.5.0 | Created |
4848

49-
---
50-
51-
See also:
49+
## See Also
5250

5351
- [AlwaysValid](AlwaysValid.md)
5452
- [When](When.md)

docs/validators/AlwaysValid.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ v::alwaysValid()->assert('whatever');
1818

1919
### `AlwaysValid::TEMPLATE_STANDARD`
2020

21-
| Mode | Template |
22-
| ---------- | --------------------------- |
23-
| `default` | {{subject}} must be valid |
21+
| Mode | Template |
22+
| ---------: | :-------------------------- |
23+
| `default` | {{subject}} must be valid |
2424
| `inverted` | {{subject}} must be invalid |
2525

2626
## Template placeholders
@@ -36,12 +36,10 @@ v::alwaysValid()->assert('whatever');
3636
## Changelog
3737

3838
| Version | Description |
39-
| ------: | ----------- |
39+
| ------: | :---------- |
4040
| 0.5.0 | Created |
4141

42-
---
43-
44-
See also:
42+
## See Also
4543

4644
- [AlwaysInvalid](AlwaysInvalid.md)
4745
- [KeyExists](KeyExists.md)

docs/validators/AnyOf.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ so `AnyOf()` returns true.
2424

2525
### `AnyOf::TEMPLATE_STANDARD`
2626

27-
| Mode | Template |
28-
| ---------- | ----------------------------------------------- |
29-
| `default` | {{subject}} must pass at least one of the rules |
27+
| Mode | Template |
28+
| ---------: | :---------------------------------------------- |
29+
| `default` | {{subject}} must pass at least one of the rules |
3030
| `inverted` | {{subject}} must pass at least one of the rules |
3131

3232
## Template placeholders
@@ -43,13 +43,11 @@ so `AnyOf()` returns true.
4343
## Changelog
4444

4545
| Version | Description |
46-
| ------: | --------------------------------------------- |
46+
| ------: | :-------------------------------------------- |
4747
| 3.0.0 | Require at least two validators to be defined |
4848
| 2.0.0 | Created |
4949

50-
---
51-
52-
See also:
50+
## See Also
5351

5452
- [AllOf](AllOf.md)
5553
- [Circuit](Circuit.md)

docs/validators/ArrayType.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ v::arrayType()->assert(new ArrayObject());
2424

2525
### `ArrayType::TEMPLATE_STANDARD`
2626

27-
| Mode | Template |
28-
| ---------- | -------------------------------- |
29-
| `default` | {{subject}} must be an array |
27+
| Mode | Template |
28+
| ---------: | :------------------------------- |
29+
| `default` | {{subject}} must be an array |
3030
| `inverted` | {{subject}} must not be an array |
3131

3232
## Template placeholders
@@ -43,12 +43,10 @@ v::arrayType()->assert(new ArrayObject());
4343
## Changelog
4444

4545
| Version | Description |
46-
| ------: | ----------- |
46+
| ------: | :---------- |
4747
| 1.0.0 | Created |
4848

49-
---
50-
51-
See also:
49+
## See Also
5250

5351
- [ArrayVal](ArrayVal.md)
5452
- [BoolType](BoolType.md)

0 commit comments

Comments
 (0)