Commit ea0608f
committed
refactor: add PHP 8.3 types to BC-safe class constants
PHP 8.3 allows class constants to declare a type. Adopt it where doing so
cannot break third-party apps.
Typing an inheritable constant is a hard BC break: a subclass that
redeclares it untyped fails to load with "Type of C::FOO must be
compatible with P::FOO of type string". Changes are therefore limited to
constants that cannot be redeclared by a subclass:
- private const (not inherited)
- final public/protected const
- constants declared in a final class or an enum
Interface constants, trait constants, and public/protected constants in
non-final (including abstract) classes are left untyped, as is all of
lib/public (OCP) and lib/unstable (NCU).
One review-requested exception: the public OBJECT_PREFIX/OBJECT_SUFFIX
constants of the app-internal CalDAV import helpers (TextImporter,
XmlImporter) are typed as well; these classes are not public API and
have no subclasses.
Only string, int and array are used. float is avoided because it would
silently coerce an int literal and change === comparisons. No constant
name or value is modified: every changed line adds only the type token,
so runtime behaviour is unchanged.
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>1 parent 1e92a39 commit ea0608f
130 files changed
Lines changed: 249 additions & 249 deletions
File tree
- apps
- contactsinteraction/lib/Migration
- dav
- lib
- BackgroundJob
- CalDAV
- Federation
- ICSExportPlugin
- Import
- Integration
- Schedule
- CardDAV
- Integration
- Connector
- Sabre
- DAV
- Db
- Listener
- Migration
- Paginate
- Search
- Service
- Settings
- Upload
- UserMigration
- tests
- integration/UserMigration
- unit
- CalDAV
- Reminder
- DAV
- files_external/lib/Lib/Auth/Password
- files_sharing/lib
- Command
- Controller
- External
- Listener
- Repair
- files_trashbin
- lib
- BackgroundJob
- Command
- tests
- files_versions
- lib
- Sabre
- tests
- files/lib
- Command/Object
- Service
- oauth2/lib/Command
- settings
- lib
- Controller
- SetupChecks
- UserMigration
- tests/UserMigration
- testing/lib/Command
- theming/lib/Listener
- twofactor_backupcodes/lib/Service
- user_status/lib/Service
- webhook_listeners/lib/Db
- workflowengine/lib/Entity
- core
- Command/Db/Migrations
- Controller
- Db
- Migrations
- lib/private
- AppFramework/Routing
- App
- Authentication
- Login
- Token
- Avatar
- BackgroundJob
- Blurhash/Listener
- Config
- DB
- DirectEditing
- FilesMetadata
- Files
- Cache
- Config
- Stream
- Type
- Group
- Memcache
- Net
- OCM
- OpenMetrics
- Preview
- Db
- Storage
- Profile
- Repair/NC29
- Search
- Security
- Bruteforce/Backend
- RateLimiting/Backend
- Signature
- Model
- Rfc9421
- Snowflake
- TaskProcessing
- TextProcessing
- User
- tests/lib
- AppFramework/Services
- Avatar
- OCM
- Preview/Storage
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
0 commit comments