Skip to content

Commit 780f2c4

Browse files
committed
chore: regenerate docs-phpstan-baseline thru --generate-baseline
1 parent 53ea187 commit 780f2c4

14 files changed

Lines changed: 349 additions & 156 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: 151 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,159 @@
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:417',
62+
'docs/concepts/services.md:147',
63+
'docs/dbmgmt/migration.md:78',
64+
'docs/extending/core_classes.md:64',
65+
'docs/guides/api/controller.md:21',
66+
'docs/guides/first-app/static_pages.md:55',
67+
'docs/incoming/filters.md:59',
68+
'docs/installation/upgrade_412.md:37',
69+
'docs/models/model.md:75',
70+
],
71+
'ignoreErrors' => [
72+
[
73+
'identifier' => 'argument.type',
74+
'paths' => [
75+
'docs/cli/cli_commands.md:78',
76+
'docs/cli/cli_library.md:240',
77+
'docs/extending/events.md:25',
78+
'docs/extending/events.md:51',
79+
'docs/extending/events.md:92',
80+
'docs/outgoing/api_responses.md:512',
81+
'docs/outgoing/api_transformers.md:118',
82+
'docs/outgoing/api_transformers.md:415',
83+
],
8584
],
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',
85+
86+
[
87+
'identifier' => 'catch.neverThrown',
88+
'paths' => [
89+
'docs/cli/cli_commands.md:145',
90+
'docs/general/logging.md:125',
91+
],
9592
],
96-
],
97-
[
98-
'identifier' => 'property.notFound',
99-
'paths' => ['docs/installation/upgrade_sessions.md:39'],
100-
],
10193

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',
94+
[
95+
'identifier' => 'deadCode.unreachable',
96+
'paths' => [
97+
'docs/installation/upgrade_localization.md:61',
98+
'docs/outgoing/localization.md:271',
99+
'docs/outgoing/localization.md:310',
100+
'docs/outgoing/localization.md:377',
101+
'docs/outgoing/response.md:31',
102+
'docs/outgoing/view_parser.md:275',
103+
],
109104
],
110-
],
111105

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',
106+
[
107+
'identifier' => 'if.alwaysFalse',
108+
'paths' => [
109+
'docs/cli/cli_signals.md:531',
110+
],
126111
],
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-
],
140112

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',
113+
[
114+
'identifier' => 'method.nonObject',
115+
'paths' => [
116+
'docs/outgoing/api_transformers.md:235',
117+
'docs/outgoing/api_transformers.md:309',
118+
'docs/outgoing/api_transformers.md:684',
119+
'docs/outgoing/view_cells.md:324',
120+
'docs/outgoing/view_cells.md:347',
121+
],
149122
],
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',
123+
124+
[
125+
'identifier' => 'new.noConstructor',
126+
'paths' => [
127+
'docs/concepts/services.md:162',
128+
'docs/concepts/services.md:221',
129+
'docs/extending/core_classes.md:81',
130+
'docs/testing/fabricator.md:50',
131+
],
132+
],
133+
134+
[
135+
'identifier' => 'outOfClass.self',
136+
'paths' => [
137+
'docs/testing/overview.md:293',
138+
],
139+
],
140+
141+
[
142+
'identifier' => 'paramOut.type',
143+
'paths' => [
144+
'docs/libraries/validation.md:1045',
145+
],
146+
],
147+
148+
[
149+
'identifier' => 'property.defaultValue',
150+
'paths' => [
151+
'docs/outgoing/view_parser.md:520',
152+
'docs/testing/database.md:73',
153+
],
154+
],
155+
156+
[
157+
'identifier' => 'property.nonObject',
158+
'paths' => [
159+
'docs/testing/fabricator.md:87',
160+
],
161+
],
162+
163+
[
164+
'identifier' => 'property.notFound',
165+
'paths' => [
166+
'docs/installation/upgrade_sessions.md:39',
167+
],
168+
],
169+
170+
[
171+
'identifier' => 'property.onlyWritten',
172+
'paths' => [
173+
'docs/installation/deployment.md:78',
174+
],
175+
],
176+
177+
[
178+
'identifier' => 'property.protected',
179+
'paths' => [
180+
'docs/libraries/time.md:417',
181+
],
182+
],
183+
184+
[
185+
'identifier' => 'return.missing',
186+
'paths' => [
187+
'docs/incoming/filters.md:18',
188+
'docs/testing/fabricator.md:9',
189+
],
190+
],
191+
192+
[
193+
'identifier' => 'return.type',
194+
'paths' => [
195+
'docs/concepts/services.md:162',
196+
'docs/concepts/services.md:221',
197+
'docs/extending/core_classes.md:81',
198+
],
199+
],
200+
201+
[
202+
'identifier' => 'variable.implicitArray',
203+
'paths' => [
204+
'docs/incoming/routing.md:625',
205+
'docs/installation/upgrade_localization.md:45',
206+
],
161207
],
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'],
174208
],
175209
],
176210
];

0 commit comments

Comments
 (0)