diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 56841fd..9ced80c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,19 +14,20 @@ jobs: strategy: matrix: php: - - 7.2 - - 7.3 - - 7.4 - - 8.0 - - 8.1 - - 8.2 - - 8.3 - - 8.4 + - "7.2" + - "7.3" + - "7.4" + - "8.0" + - "8.1" + - "8.2" + - "8.3" + - "8.4" + - "8.5" fail-fast: false steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -34,7 +35,7 @@ jobs: php-version: ${{ matrix.php }} - name: Cache PHP dependencies - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: vendor key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} diff --git a/src/Generator/ArrayGenerator.php b/src/Generator/ArrayGenerator.php index 60dfe9f..49843ce 100644 --- a/src/Generator/ArrayGenerator.php +++ b/src/Generator/ArrayGenerator.php @@ -76,8 +76,10 @@ public function generateArray(Translations $translations): array if (self::hasPluralTranslations($translation)) { $messages[$context][$original] = $translation->getPluralTranslations($pluralSize); array_unshift($messages[$context][$original], $translation->getTranslation()); + } elseif ($pluralSize !== null && $pluralSize > 1 && (string) $translation->getPlural() !== '') { + $messages[$context][$original] = array_fill(0, $pluralSize, ''); } else { - $messages[$context][$original] = $translation->getTranslation(); + $messages[$context][$original] = (string) $translation->getTranslation(); } } diff --git a/tests/ArrayGeneratorTest.php b/tests/ArrayGeneratorTest.php index b41d42c..a071a88 100644 --- a/tests/ArrayGeneratorTest.php +++ b/tests/ArrayGeneratorTest.php @@ -66,7 +66,7 @@ public function testArrayGeneratorWithEmptyTranslations() 'messages' => [ '' => [ 'Empty translation included' => '', - 'Inexistent translation included' => null, + 'Inexistent translation included' => '', ], ], ];