fix(model): hydrate nullable fields via BaseModel helpers - #289
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #289 +/- ##
============================================
- Coverage 95.19% 95.18% -0.00%
+ Complexity 2540 2510 -30
============================================
Files 217 217
Lines 6959 6925 -34
============================================
- Hits 6624 6591 -33
+ Misses 335 334 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The broad public hydration changes across 74 files warrant final human validation against the API specifications.
Review effort: Balanced
Findings: None
What changed in this PR
Standardizes nullable model hydration while preserving valid falsy API values and removes redundant model method docblocks.
Changes:
- Uses
BaseModelnullable helpers across affected models. - Adds helper and regression tests.
- Removes PHPDoc that duplicates native signatures.
| File | Description |
|---|---|
tests/CrowdinApiClient/Model/TaskCommentTest.php |
Tests zero and null time values. |
tests/CrowdinApiClient/Model/DistributionReleaseTest.php |
Tests absent nullable fields. |
tests/CrowdinApiClient/Model/BaseModelTest.php |
Tests all nullable helpers. |
src/CrowdinApiClient/Model/WordAlignment.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/Webhook.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/Vote.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/UserReportSettingsTemplate.php |
Standardizes nullable timestamp hydration. |
src/CrowdinApiClient/Model/User.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/TranslationProjectDirectory.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/TranslationMemorySegmentRecord.php |
Preserves nullable timestamps. |
src/CrowdinApiClient/Model/TranslationMemorySegment.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/TranslationMemoryImport.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/TranslationMemoryExport.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/TranslationMemoryConcordance.php |
Casts nullable strings consistently. |
src/CrowdinApiClient/Model/TranslationMemory.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/Term.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/TaskSettingsTemplate.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/TaskForUpdate.php |
Standardizes nullable date hydration. |
src/CrowdinApiClient/Model/TaskComment.php |
Preserves zero time spent. |
src/CrowdinApiClient/Model/Task.php |
Standardizes optional task fields. |
src/CrowdinApiClient/Model/Tag.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/StyleGuide.php |
Casts optional fields consistently. |
src/CrowdinApiClient/Model/StringUpload.php |
Standardizes nullable job timestamps. |
src/CrowdinApiClient/Model/StringTranslationApproval.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/StringTranslation.php |
Standardizes nullable identifiers. |
src/CrowdinApiClient/Model/StringsExporterSetting.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/StringCorrection.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/StringComment.php |
Normalizes PHPDoc and formatting. |
src/CrowdinApiClient/Model/Storage.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/SourceString.php |
Preserves nullable numeric identifiers. |
src/CrowdinApiClient/Model/SecurityLog.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/Screenshot.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/ReportSettingsTemplate.php |
Standardizes nullable update timestamp. |
src/CrowdinApiClient/Model/Report.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/QaCheck.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/Project.php |
Preserves nullable pseudo-language ID. |
src/CrowdinApiClient/Model/ProgressLanguage.php |
Preserves nullable ETag. |
src/CrowdinApiClient/Model/ProgressFile.php |
Standardizes nullable ETag hydration. |
src/CrowdinApiClient/Model/Progress.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/OrganizationWebhook.php |
Cleans PHPDoc and formatting. |
src/CrowdinApiClient/Model/MachineTranslationEngine.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/MachineTranslation.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/LanguageTranslation.php |
Preserves falsy optional values. |
src/CrowdinApiClient/Model/Language.php |
Preserves nullable dialect relation. |
src/CrowdinApiClient/Model/Issue.php |
Cleans PHPDoc and formatting. |
src/CrowdinApiClient/Model/HourlyUserReportSettingsTemplate.php |
Standardizes nullable update timestamp. |
src/CrowdinApiClient/Model/Group.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/GlossaryImport.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/GlossaryExport.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/FileRevision.php |
Preserves zero restore revision. |
src/CrowdinApiClient/Model/File.php |
Preserves empty language exclusions. |
src/CrowdinApiClient/Model/Enterprise/Vendor.php |
Cleans PHPDoc and formatting. |
src/CrowdinApiClient/Model/Enterprise/User.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/Enterprise/Group.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/DownloadFileTranslation.php |
Standardizes nullable ETag hydration. |
src/CrowdinApiClient/Model/DownloadFilePreview.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/DownloadFile.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/DistributionRelease.php |
Preserves absent fields as null. |
src/CrowdinApiClient/Model/Directory.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/DeleteJob.php |
Casts nullable job fields consistently. |
src/CrowdinApiClient/Model/BranchMerge.php |
Standardizes nullable job timestamps. |
src/CrowdinApiClient/Model/BranchClone.php |
Standardizes nullable job timestamps. |
src/CrowdinApiClient/Model/Branch.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/ApplicationInstallation.php |
Casts optional installation fields. |
src/CrowdinApiClient/Model/ApplicationConsent.php |
Casts optional consent fields. |
src/CrowdinApiClient/Model/Alignment.php |
Removes redundant PHPDoc. |
src/CrowdinApiClient/Model/AiSettings.php |
Casts nullable prompt IDs. |
src/CrowdinApiClient/Model/AiRequestLog.php |
Casts nullable log metadata. |
src/CrowdinApiClient/Model/AiReport.php |
Standardizes nullable timestamps. |
src/CrowdinApiClient/Model/AiProviderModel.php |
Casts optional provider metadata. |
src/CrowdinApiClient/Model/AiProvider.php |
Casts nullable credentials. |
src/CrowdinApiClient/Model/AiPromptCompletion.php |
Standardizes nullable timestamps. |
src/CrowdinApiClient/Model/AiPrompt.php |
Casts optional prompt metadata. |
src/CrowdinApiClient/Model/AiFileTranslation.php |
Standardizes nullable timestamps. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
andrii-bodnar
approved these changes
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BaseModel::nullable*()instead of a mix of uncast assignments, truthy ternaries and plain casts.Model/that only repeated the native signature. Docblocks that add information (element types, descriptions,@deprecated) are kept.Behavior changes
Getter signatures are unchanged; returned values differ in two cases:
null, e.g.TaskComment::getTimeSpent()returns0,File::getExcludedTargetLanguages()returns[].nullinstead of''/0when missing:DistributionRelease,Language::getDialectOf(),Project::getInContextPseudoLanguageId(),ProgressLanguage::getEtag(),Task::getHash(),TranslationMemorySegmentRecordtimestamps.Field nullability was checked against the Crowdin and Enterprise API specs.