There is no way to express that Title::castFromPageIdentity(), Title::castFromPageReference() and Title::castFromLinkTarget() can only return null when the parameter is null. We need to add Phan suppressions or explicit types almost everywhere that these methods are used with parameters that are known to not be null. Instead, introduce new methods Title::newFromPageIdentity() and Title::newFromPageReference() (Title::newFromLinkTarget() already exists), without the null-coalescing behavior, and use them when the parameter is not null. This lets static analysis tools, and humans, easily understand where nulls can't appear. Do the same with the corresponding TitleFactory methods. Change the obvious uses of castFrom*() to newFrom*() (if there is a Phan suppression, a type check, or a method call on the result). Change-Id: Ida4da75953cf3bca372a40dc88022443109ca0cb |
||
|---|---|---|
| .. | ||
| Hook | ||
| ImportableOldRevision.php | ||
| ImportableOldRevisionImporter.php | ||
| ImportableUploadRevision.php | ||
| ImportableUploadRevisionImporter.php | ||
| ImportSource.php | ||
| ImportStreamSource.php | ||
| ImportStringSource.php | ||
| OldRevisionImporter.php | ||
| UploadRevisionImporter.php | ||
| UploadSourceAdapter.php | ||
| WikiImporter.php | ||
| WikiImporterFactory.php | ||
| WikiRevision.php | ||