diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7392021..a62a999 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: @@ -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'] diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index a857bce..a93390b 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -31,4 +31,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.1', '8.2', '8.3'] + ['8.1', '8.2', '8.3', '8.4'] diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index 457772a..5d6931d 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -21,4 +21,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.3'] + ['8.4'] diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index d2a03af..64b476e 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -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: diff --git a/CHANGELOG.md b/CHANGELOG.md index 14e3357..a855bf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/composer.json b/composer.json index f5867b5..72fde60 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/psalm.xml b/psalm.xml index b48c894..2b2e0b2 100644 --- a/psalm.xml +++ b/psalm.xml @@ -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" diff --git a/src/Extractor/TranslationExtractor.php b/src/Extractor/TranslationExtractor.php index eebf2c6..2bb2541 100644 --- a/src/Extractor/TranslationExtractor.php +++ b/src/Extractor/TranslationExtractor.php @@ -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()) { diff --git a/src/SimpleMessageFormatter.php b/src/SimpleMessageFormatter.php index cab22d6..ed2c8c1 100644 --- a/src/SimpleMessageFormatter.php +++ b/src/SimpleMessageFormatter.php @@ -10,6 +10,9 @@ use function in_array; use function is_int; +/** + * @final + */ class SimpleMessageFormatter implements MessageFormatterInterface { /** diff --git a/src/Translator.php b/src/Translator.php index f496f08..221964a 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -20,12 +20,12 @@ final class Translator implements TranslatorInterface /** * @var array Array of category message sources indexed by category names. - * @psalm-var array + * @psalm-var array> */ private array $categorySources = []; /** - * @psalm-var array + * @psalm-var array */ private array $dispatchedMissingTranslationCategoryEvents = [];