Fix undefined array key in Syllables by normalizing whitespace before explode#4
Draft
Fix undefined array key in Syllables by normalizing whitespace before explode#4
Conversation
… explode Co-authored-by: pattonwebz <3902039+pattonwebz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix undefined array key in Syllables methods by normalizing whitespace
Fix undefined array key in Syllables by normalizing whitespace before explode
Feb 22, 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.
averageSyllablesPerWord()andwordsWithThreeSyllables()iterated up toText::wordCount()(which collapses\s+→ single space internally) but split viaexplode(' ', $strText)— meaning inputs with\n,\t, or\r\nproduced fewer array elements than the loop bound, triggering "Undefined array key" warnings.Changes
Syllables.php— normalize whitespace in both affected methods beforeexplode, aligning the split withwordCount's behavior:TextStatisticsTest.php— regression assertions confirming\n,\t, and\n\nseparators produce identical results to space-separated input for bothaverageSyllablesPerWordandwordsWithThreeSyllables.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uK1Qbg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uK1Qbg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uK1Qbg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uK1Qbg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/phpunit/zipball/32c2c2d6580b1d8ab3c10b1e9e4dc263cc69bb04/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uK1Qbg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uK1Qbg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uK1Qbg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uK1Qbg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/6OMz6G /usr/bin/composer install --no-interaction --prefer-dist(http block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.