Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
os: >-
['ubuntu-latest', 'windows-latest']
php: >-
['8.0', '8.1', '8.2', '8.3']
['8.0', '8.1', '8.2', '8.3', '8.4']
phpunit-with-intl:
uses: yiisoft/actions/.github/workflows/phpunit.yml@master
secrets:
Expand All @@ -45,4 +45,4 @@ jobs:
os: >-
['ubuntu-latest', 'windows-latest']
php: >-
['8.0', '8.1', '8.2', '8.3']
['8.0', '8.1', '8.2', '8.3', '8.4']
2 changes: 1 addition & 1 deletion .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3']
['8.1', '8.2', '8.3', '8.4']
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.3']
['8.4']
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3']
['8.1', '8.2', '8.3', '8.4']
psalm80:
uses: yiisoft/actions/.github/workflows/psalm.yml@master
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 3.1.1 under development

- New #149: Add `InMemoryMessageSource` (@vjik)
- Chg #150: Change PHP constraint in `composer.json` to `8.0 - 8.4` (@vjik)

## 3.1.0 December 26, 2024

Expand Down
17 changes: 9 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
}
],
"require": {
"php": "^8.0",
"php": "8.0 - 8.4",
"psr/event-dispatcher": "1.0.0",
"yiisoft/files": "^1.0|^2.0",
"yiisoft/files": "^1.0 || ^2.0",
"yiisoft/i18n": "^1.0"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.2",
"phpunit/phpunit": "^9.6",
"rector/rector": "^2.0.3",
"maglnet/composer-require-checker": "^4.4",
"phpunit/phpunit": "^9.6.22",
"rector/rector": "^2.0.10",
"roave/infection-static-analysis-plugin": "^1.25",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.21",
"yiisoft/di": "^1.2"
"spatie/phpunit-watcher": "^1.23.6",
"vimeo/psalm": "^4.30 || ^5.26.1 || ^6.8.9",
"yiisoft/di": "^1.2.1"
},
"suggest": {
"ext-intl": "Allows using intl message formatter",
Expand Down Expand Up @@ -68,6 +68,7 @@
},
"config": {
"sort-packages": true,
"bump-after-update": "dev",
"allow-plugins": {
"infection/extension-installer": true,
"composer/package-versions-deprecated": true
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="false"
ensureOverrideAttribute="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
3 changes: 3 additions & 0 deletions src/Extractor/TranslationExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public function extract(string $defaultCategory = 'app', ?string $translatorCall
]);

foreach ($files as $file) {
/**
* @var string $fileContent We assume that `file_get_contents` can always read the file.
*/
$fileContent = file_get_contents($file);
$messages = array_merge_recursive($messages, $parser->extract($fileContent));
if ($parser->hasSkippedLines()) {
Expand Down
3 changes: 3 additions & 0 deletions src/SimpleMessageFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use function in_array;
use function is_int;

/**
* @final
*/
class SimpleMessageFormatter implements MessageFormatterInterface
{
/**
Expand Down
4 changes: 2 additions & 2 deletions src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ final class Translator implements TranslatorInterface

/**
* @var array Array of category message sources indexed by category names.
* @psalm-var array<string,CategorySource[]>
* @psalm-var array<string, non-empty-list<CategorySource>>
*/
private array $categorySources = [];

/**
* @psalm-var array<string,true>
* @psalm-var array<string, true>
*/
private array $dispatchedMissingTranslationCategoryEvents = [];

Expand Down