Repository navigation
Commit 9dd0446
committed
Code Quality: Document properties accessible via magic methods.
Code outside of `wpdb`, `WP_List_Table`, and `WP_Object_Cache` reads several of their protected properties, which the classes' magic `__get()` methods allow for backward compatibility. Since PHPStan cannot see this, each such read was reported as a `property.protected` error. Class-level `@property` tags now document these properties, and the `property.protected` PHPStan baseline is removed. The tags are writable to match the classes' `__set()` methods, except for `wpdb::$check_current_query`, which `__set()` blocks.
Beyond the properties that core itself reads, the `wpdb` tags also cover properties that plugins are known to read, while the database password is not documented, to avoid encouraging access to it. The documented types of `wpdb::$col_info` and `WP_Object_Cache::$global_groups` are also corrected: the former can be `null`, and the latter maps group names to `true` rather than listing them.
Developed in WordPress#14265.
Follow-up to r21472, r31146, r63020.
Props mukesh27, westonruter.
See #65817.
git-svn-id: https://develop.svn.wordpress.org/trunk@64868 602fd350-edb4-49c9-b593-d223f7449a821 parent 94f5ebb commit 9dd0446
7 files changed
Lines changed: 24 additions & 70 deletions
File tree
- src
- wp-admin/includes
- wp-includes
- tests/phpstan/baselines
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
52 | | - | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
| |||
193 | 202 | | |
194 | 203 | | |
195 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
196 | 211 | | |
197 | 212 | | |
198 | | - | |
| 213 | + | |
199 | 214 | | |
200 | 215 | | |
201 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | 91 | | |
97 | 92 | | |
98 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| |||
This file was deleted.
0 commit comments