Skip to content

Trim stray trailing whitespace in pl_PL provider data - #1069

Open
AleksanderSzutBackupAccount wants to merge 1 commit into
FakerPHP:1.24from
AleksanderSzutBackupAccount:fix/pl-pl-trailing-whitespace
Open

Trim stray trailing whitespace in pl_PL provider data#1069
AleksanderSzutBackupAccount wants to merge 1 commit into
FakerPHP:1.24from
AleksanderSzutBackupAccount:fix/pl-pl-trailing-whitespace

Conversation

@AleksanderSzutBackupAccount

Copy link
Copy Markdown

What is the reason for this PR?

  • A new feature
  • Fixed an issue

Three entries in the pl_PL provider carry an accidental trailing space:

Location Value
Provider/pl_PL/Address.php:172 'Staffa '
Provider/pl_PL/Payment.php:41 'BNP Paribas S.A. Oddział w Polsce '
Provider/pl_PL/Payment.php:67 'John Deere Bank S.A. Spółka Akcyjna Oddział w Polsce '

They are the only padded values in the locale — every one of the other 534 street names and 100+ bank names is clean — so this is a typo rather than intentional data.

The street name is the one that actually bites. When a seeded value is sent through an application that trims request input (Laravel, for instance, ships TrimStrings in its default global middleware stack), the framework persists Staffa while the test still asserts against the raw Staffa it generated, and the test fails for a reason that has nothing to do with the code under test. It took a while to trace that back to the fixture data.

Author's checklist

Summary of changes

  • Trimmed the trailing space from the three values above.
  • Added regression tests asserting that no pl_PL street name or bank name is padded with whitespace (AddressTest::testStreetNamesAreNotPaddedWithWhitespace, new PaymentTest::testBankNamesAreNotPaddedWithWhitespace). Both fail on 1.24 before the fix and pass after it.
  • Added a CHANGELOG.md entry under Unreleased.

On "avoid changing existing sets of data": no entry is added, removed or reordered, so seeded generators keep producing the same element at the same index — only the stray space at the end of three strings goes away.

Verified locally on PHP 8.4: vendor/bin/phpunit → 2464 tests, 12988 assertions, 0 failures (100 skips are the pre-existing PHP-version-gated ones), and php-cs-fixer --dry-run reports 0 of 691 files to fix.

The same 'Staffa ' typo exists on the 2.0 branch (src/Provider/pl_PL/Address.php:172); happy to open the equivalent PR there if you'd like it in the same pass.

Three entries in the pl_PL provider carried an accidental trailing
space: the street name "Staffa " and the bank names
"BNP Paribas S.A. Oddział w Polsce " and
"John Deere Bank S.A. Spółka Akcyjna Oddział w Polsce ".

The padded street name in particular breaks round-trip assertions in
consumer test suites: a framework that trims request input (for
example Laravel's TrimStrings middleware) stores "Staffa" while the
test still compares against the raw "Staffa " it fed in.

No entries are added or removed, so seeded generators keep producing
the same sequence.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants