Skip to content

Commit ef7e9c0

Browse files
committed
chore: regenerate docs-phpstan-baseline thru --generate-baseline
1 parent 394be30 commit ef7e9c0

4 files changed

Lines changed: 308 additions & 133 deletions

File tree

‎.github/workflows/test-phpstan.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,8 @@ jobs:
9898

9999
- name: Run static analysis on the user guide samples
100100
run: php admin/lint-docs-samples.php --phpstan
101+
102+
- name: Check that the baseline of the user guide samples is up to date
103+
run: |
104+
php admin/lint-docs-samples.php --generate-baseline
105+
git diff --exit-code admin/docs-phpstan-baseline.php

‎admin/docs-phpstan-baseline.php‎

Lines changed: 159 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,20 @@
1717
* An entry is a page relative to the project root, for all of its samples, or `page:line`, for the sample
1818
* whose opening ```php fence is on that line.
1919
*
20-
* - `excludePaths`: samples that are skipped, for errors that PHPStan does not allow to be ignored.
2120
* - `ignoreErrors`: an error identifier, optionally narrowed by a `message` pattern, ignored in the samples of the
22-
* listed `paths` or, without them, in all samples.
21+
* listed `paths` or, without them, in all samples. This list is written by hand.
22+
* - `baseline`: the samples that are skipped, for errors that PHPStan does not allow to be ignored, and the errors
23+
* that are ignored in a sample. It is written by `php admin/lint-docs-samples.php --phpstan --generate-baseline`.
2324
*
2425
* @return array{
25-
* excludePaths: list<string>,
26-
* ignoreErrors: list<array{identifier: string, message?: string, paths?: list<string>}>
26+
* ignoreErrors: list<array{identifier: string, message?: string, paths?: list<string>}>,
27+
* baseline: array{
28+
* excludePaths: list<string>,
29+
* ignoreErrors: list<array{identifier: string, paths: list<string>}>
30+
* }
2731
* }
2832
*/
2933
return [
30-
'excludePaths' => [
31-
'docs/cli/cli_signals.md:201',
32-
'docs/cli/cli_signals.md:413',
33-
'docs/cli/cli_signals.md:608',
34-
'docs/cli/cli_signals.md:654',
35-
'docs/cli/cli_signals.md:700',
36-
'docs/concepts/services.md:135',
37-
'docs/dbmgmt/migration.md:78',
38-
'docs/extending/core_classes.md:64',
39-
'docs/guides/api/controller.md:21',
40-
'docs/guides/first-app/static_pages.md:55',
41-
'docs/incoming/filters.md:18',
42-
'docs/incoming/filters.md:59',
43-
'docs/installation/upgrade_412.md:37',
44-
'docs/libraries/encryption.md:182',
45-
'docs/models/entities.md:659',
46-
'docs/models/model.md:73',
47-
'docs/models/model.md:562',
48-
'docs/testing/fabricator.md:9',
49-
],
5034
'ignoreErrors' => [
5135
// Samples are fragments: they leave out code, and the classes and functions that they refer to.
5236
['identifier' => 'class.notFound'],
@@ -68,109 +52,167 @@
6852
'identifier' => 'property.notFound',
6953
'message' => '#^Access to an undefined property (App\\\\|Config\\\\|SampleCommand::)#',
7054
],
55+
],
7156

72-
// A value that PHP coerces, a function or class that the sample does not define, or the Session of CodeIgniter 3.
73-
[
74-
'identifier' => 'argument.type',
75-
'paths' => [
76-
'docs/cli/cli_commands.md:78',
77-
'docs/cli/cli_library.md:240',
78-
'docs/extending/events.md:25',
79-
'docs/extending/events.md:50',
80-
'docs/extending/events.md:89',
81-
'docs/outgoing/api_responses.md:510',
82-
'docs/outgoing/api_transformers.md:118',
83-
'docs/outgoing/api_transformers.md:415',
84-
'docs/testing/controllers.md:285',
57+
// Everything below is @autogenerated by --generate-baseline.
58+
'baseline' => [
59+
'excludePaths' => [
60+
'docs/cli/cli_signals.md:201',
61+
'docs/cli/cli_signals.md:413',
62+
'docs/cli/cli_signals.md:608',
63+
'docs/cli/cli_signals.md:654',
64+
'docs/cli/cli_signals.md:700',
65+
'docs/concepts/services.md:135',
66+
'docs/dbmgmt/migration.md:78',
67+
'docs/extending/core_classes.md:64',
68+
'docs/guides/api/controller.md:21',
69+
'docs/guides/first-app/static_pages.md:55',
70+
'docs/incoming/filters.md:59',
71+
'docs/installation/upgrade_412.md:37',
72+
'docs/libraries/encryption.md:182',
73+
'docs/models/model.md:73',
74+
'docs/models/model.md:562',
75+
],
76+
'ignoreErrors' => [
77+
[
78+
'identifier' => 'argument.type',
79+
'paths' => [
80+
'docs/cli/cli_commands.md:78',
81+
'docs/cli/cli_library.md:240',
82+
'docs/extending/events.md:25',
83+
'docs/extending/events.md:50',
84+
'docs/extending/events.md:89',
85+
'docs/outgoing/api_responses.md:510',
86+
'docs/outgoing/api_transformers.md:118',
87+
'docs/outgoing/api_transformers.md:415',
88+
'docs/testing/controllers.md:285',
89+
],
8590
],
86-
],
87-
[
88-
'identifier' => 'method.nonObject',
89-
'paths' => [
90-
'docs/outgoing/api_transformers.md:235',
91-
'docs/outgoing/api_transformers.md:309',
92-
'docs/outgoing/api_transformers.md:684',
93-
'docs/outgoing/view_cells.md:324',
94-
'docs/outgoing/view_cells.md:347',
91+
92+
[
93+
'identifier' => 'catch.neverThrown',
94+
'paths' => [
95+
'docs/cli/cli_commands.md:144',
96+
'docs/general/logging.md:125',
97+
],
9598
],
96-
],
97-
[
98-
'identifier' => 'property.notFound',
99-
'paths' => ['docs/installation/upgrade_sessions.md:39'],
100-
],
10199

102-
// Samples that write the array of CodeIgniter 3 or of a configuration in the way that the page describes.
103-
[
104-
'identifier' => 'variable.implicitArray',
105-
'paths' => [
106-
'docs/general/configuration.md:245',
107-
'docs/incoming/routing.md:621',
108-
'docs/installation/upgrade_localization.md:45',
100+
[
101+
'identifier' => 'deadCode.unreachable',
102+
'paths' => [
103+
'docs/installation/upgrade_localization.md:61',
104+
'docs/outgoing/localization.md:271',
105+
'docs/outgoing/localization.md:310',
106+
'docs/outgoing/localization.md:377',
107+
'docs/outgoing/response.md:31',
108+
'docs/outgoing/view_parser.md:273',
109+
],
109110
],
110-
],
111111

112-
// Samples that show alternatives one after the other, or code that a sample does not complete.
113-
[
114-
'identifier' => 'catch.neverThrown',
115-
'paths' => ['docs/cli/cli_commands.md:144', 'docs/general/logging.md:125'],
116-
],
117-
[
118-
'identifier' => 'deadCode.unreachable',
119-
'paths' => [
120-
'docs/installation/upgrade_localization.md:61',
121-
'docs/outgoing/localization.md:271',
122-
'docs/outgoing/localization.md:310',
123-
'docs/outgoing/localization.md:377',
124-
'docs/outgoing/response.md:31',
125-
'docs/outgoing/view_parser.md:273',
112+
[
113+
'identifier' => 'if.alwaysFalse',
114+
'paths' => [
115+
'docs/cli/cli_signals.md:527',
116+
],
126117
],
127-
],
128-
[
129-
'identifier' => 'if.alwaysFalse',
130-
'paths' => ['docs/cli/cli_signals.md:527'],
131-
],
132-
[
133-
'identifier' => 'outOfClass.self',
134-
'paths' => ['docs/testing/overview.md:293'],
135-
],
136-
[
137-
'identifier' => 'property.onlyWritten',
138-
'paths' => ['docs/installation/deployment.md:78'],
139-
],
140118

141-
// Samples that use a class that the samples declare differently, or a name that they do not define.
142-
[
143-
'identifier' => 'new.noConstructor',
144-
'paths' => [
145-
'docs/concepts/services.md:150',
146-
'docs/concepts/services.md:204',
147-
'docs/extending/core_classes.md:81',
148-
'docs/testing/fabricator.md:50',
119+
[
120+
'identifier' => 'method.nonObject',
121+
'paths' => [
122+
'docs/outgoing/api_transformers.md:235',
123+
'docs/outgoing/api_transformers.md:309',
124+
'docs/outgoing/api_transformers.md:684',
125+
'docs/outgoing/view_cells.md:324',
126+
'docs/outgoing/view_cells.md:347',
127+
],
149128
],
150-
],
151-
[
152-
'identifier' => 'parameterByRef.type',
153-
'paths' => ['docs/libraries/validation.md:1041'],
154-
],
155-
[
156-
'identifier' => 'return.type',
157-
'paths' => [
158-
'docs/concepts/services.md:150',
159-
'docs/concepts/services.md:204',
160-
'docs/extending/core_classes.md:81',
129+
130+
[
131+
'identifier' => 'new.noConstructor',
132+
'paths' => [
133+
'docs/concepts/services.md:150',
134+
'docs/concepts/services.md:204',
135+
'docs/extending/core_classes.md:81',
136+
'docs/testing/fabricator.md:50',
137+
],
138+
],
139+
140+
[
141+
'identifier' => 'outOfClass.self',
142+
'paths' => [
143+
'docs/testing/overview.md:293',
144+
],
145+
],
146+
147+
[
148+
'identifier' => 'parameterByRef.type',
149+
'paths' => [
150+
'docs/libraries/validation.md:1041',
151+
],
152+
],
153+
154+
[
155+
'identifier' => 'property.defaultValue',
156+
'paths' => [
157+
'docs/outgoing/view_parser.md:518',
158+
'docs/testing/database.md:73',
159+
],
160+
],
161+
162+
[
163+
'identifier' => 'property.nonObject',
164+
'paths' => [
165+
'docs/testing/fabricator.md:87',
166+
],
167+
],
168+
169+
[
170+
'identifier' => 'property.notFound',
171+
'paths' => [
172+
'docs/installation/upgrade_sessions.md:39',
173+
],
174+
],
175+
176+
[
177+
'identifier' => 'property.onlyWritten',
178+
'paths' => [
179+
'docs/installation/deployment.md:78',
180+
],
181+
],
182+
183+
[
184+
'identifier' => 'property.protected',
185+
'paths' => [
186+
'docs/libraries/time.md:417',
187+
],
188+
],
189+
190+
[
191+
'identifier' => 'return.missing',
192+
'paths' => [
193+
'docs/incoming/filters.md:18',
194+
'docs/models/entities.md:659',
195+
'docs/testing/fabricator.md:9',
196+
],
197+
],
198+
199+
[
200+
'identifier' => 'return.type',
201+
'paths' => [
202+
'docs/concepts/services.md:150',
203+
'docs/concepts/services.md:204',
204+
'docs/extending/core_classes.md:81',
205+
],
206+
],
207+
208+
[
209+
'identifier' => 'variable.implicitArray',
210+
'paths' => [
211+
'docs/general/configuration.md:245',
212+
'docs/incoming/routing.md:621',
213+
'docs/installation/upgrade_localization.md:45',
214+
],
161215
],
162-
],
163-
[
164-
'identifier' => 'property.defaultValue',
165-
'paths' => ['docs/outgoing/view_parser.md:518', 'docs/testing/database.md:73'],
166-
],
167-
[
168-
'identifier' => 'property.nonObject',
169-
'paths' => ['docs/testing/fabricator.md:87'],
170-
],
171-
[
172-
'identifier' => 'property.protected',
173-
'paths' => ['docs/libraries/time.md:417'],
174216
],
175217
],
176218
];

0 commit comments

Comments
 (0)