Skip to content

Fix raw input formatting - #766

Merged
giggsey merged 6 commits into
giggsey:masterfrom
itartel:master
Sep 24, 2026
Merged

giggsey merged 6 commits into
giggsey:masterfrom
itartel:master

Conversation

@itartel

@itartel itartel commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

@giggsey

giggsey commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Can you add a test case and description to the PR showing what this is fixing?

@itartel

itartel commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

add test

Comment thread src/MetadataSourceInterface.php Outdated
* Gets phone metadata for a non-geographical region.
*/
public function getMetadataForNonGeographicalRegion(int $countryCallingCode): PhoneMetadata;
public function getMetadataForNonGeographicalRegion(?int $countryCallingCode): PhoneMetadata;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the function declarations being changed?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The interface change is backward-incompatible, and null may be forwarded to a non-nullable parameter.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Updates phone number formatting for raw-input-only instances and adds regression coverage.

Changes:

  • Preserve raw input when the national number is unset.
  • Add nullable country-code handling.
  • Add regression tests.
File Description
tests/​core/​PhoneNumberUtilTest.php Adds raw-input formatting coverage.
src/​PhoneNumberUtil.php Handles unset national numbers and nullable metadata lookups.
src/​MultiFileMetadataSourceImpl.php Updates metadata lookup parameter handling.
src/​MetadataSourceInterface.php Updates the metadata source contract.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/MetadataSourceInterface.php Resolved
Comment thread src/MultiFileMetadataSourceImpl.php Resolved
@giggsey giggsey changed the title Update PhoneNumberUtil.php Fix raw input formatting Sep 24, 2026
@giggsey
giggsey requested a lite review from Copilot September 24, 2026 10:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The fix is covered by regression tests and no unresolved issues were identified.

Review effort: Lite
Findings: None

Resolved since last review (2)

@codecov

codecov Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.86%. Comparing base (5a1cbbd) to head (e18ff52).
⚠️ Report is 43 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #766      +/-   ##
============================================
- Coverage     85.94%   85.86%   -0.09%     
- Complexity     1304     1318      +14     
============================================
  Files            31       31              
  Lines          3430     3445      +15     
============================================
+ Hits           2948     2958      +10     
- Misses          482      487       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@giggsey

giggsey commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix. I've reduced the changes slightly whilst maintaining the passing test case you added.

@giggsey
giggsey merged commit 98f72d6 into giggsey:master Sep 24, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in 4.2.x: PhoneNumber::setRawInput() persists empty string

4 participants