diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml new file mode 100644 index 0000000..2d832ed --- /dev/null +++ b/.github/workflows/psalm.yml @@ -0,0 +1,32 @@ +name: Psalm + +on: + push: + paths: + - '**.php' + - 'psalm*' + +jobs: + psalm: + name: psalm + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + coverage: none + + - name: Cache composer dependencies + uses: actions/cache@v4 + with: + path: vendor + key: composer-${{ hashFiles('composer.lock') }} + + - name: Run composer install + run: composer install -n --prefer-dist + + - name: Run Psalm + run: composer psalm:ci diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index ecb80e0..f247c56 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -1,37 +1,27 @@ -name: Test +name: Check & fix styling -on: [push] +on: + push: + paths: + - '**.php' + - '.composer.lock' + - '.php_cs' + - '.github/workflows/php-cs-fixer.yml' jobs: - test: - + style: runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - php: [ 7.1 ] - dependency-version: [prefer-lowest, prefer-stable] - - name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }} steps: - name: Checkout code - uses: actions/checkout@v1 + uses: actions/checkout@v4 - - name: Setup PHP - uses: shivammathur/setup-php@v1 + - name: Fix style + uses: docker://oskarstark/php-cs-fixer-ga with: - php-version: ${{ matrix.php }} - coverage: none + args: --config=.php-cs-fixer.php --allow-risky=yes - - name: Cache dependencies - uses: actions/cache@v1 + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v5 with: - path: ~/.composer/cache/files - key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} - - - name: Install dependencies - run: | - composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest - - name: Execute tests - run: composer test + commit_message: Fix styling diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db26acc..169b2a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,28 +10,13 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - php: [8.3, 8.0, 7.4] - laravel: [9.*, 8.*, 7.*, 6.*, 5.8.*] + php: [8.3, 8.2, 8.1, 8.0, 7.4] + laravel: [10.*, 9.*] dependency-version: [prefer-lowest] os: [ubuntu-latest] - include: - - laravel: 9.* - testbench: 7.* - - laravel: 8.* - testbench: 6.* - - laravel: 7.* - testbench: 5.* - - laravel: 6.* - testbench: 4.* - - laravel: 5.8.* - testbench: 3.8.* exclude: - php: 7.4 - laravel: 9.* - - php: 8.0 - laravel: 5.8.* - - php: 8.3 - laravel: 5.8.* + laravel: 10.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.os }} diff --git a/.gitignore b/.gitignore index 987e2a2..71bf3a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ composer.lock vendor + +.phpunit.result.cache diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..276c398 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,39 @@ +in([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]) + ->name('*.php') + ->ignoreDotFiles(true) + ->ignoreVCS(true); + +return (new PhpCsFixer\Config()) + ->setRules([ + '@PSR12' => true, + 'array_syntax' => ['syntax' => 'short'], + 'ordered_imports' => ['sort_algorithm' => 'alpha'], + 'no_unused_imports' => true, + 'not_operator_with_successor_space' => true, + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], + 'phpdoc_scalar' => true, + 'unary_operator_spaces' => true, + 'binary_operator_spaces' => true, + 'blank_line_before_statement' => [ + 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], + ], + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_var_without_name' => true, + 'class_attributes_separation' => [ + 'elements' => [ + 'method' => 'one', + ], + ], + 'method_argument_space' => [ + 'on_multiline' => 'ensure_fully_multiline', + 'keep_multiple_spaces_after_comma' => true, + ], + 'single_trait_insert_per_statement' => true, + ]) + ->setFinder($finder); diff --git a/README.md b/README.md index abc2aad..c00af8d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Find missing Laravel Translations Artisan command to find missing translations. -It takes a basic locale and find missing keys/translations in other locales. +It takes a basic locale and finds missing keys/translations in other locales.

Package logo

@@ -15,7 +15,7 @@ composer require diglabby/laravel-find-missing-translations --dev ``` ## Usage -Use default locate as base and default Laravel's path to lang files: +Use default locate as base and default Laravel’s path to lang files: ```sh php artisan translations:missing ``` @@ -39,4 +39,4 @@ composer test ## Thanks -Inspired by [VetonMuhaxhiri/Laravel-find-missing-translations](https://github.com/VetonMuhaxhiri/Laravel-find-missing-translations) \ No newline at end of file +Inspired by [VetonMuhaxhiri/Laravel-find-missing-translations](https://github.com/VetonMuhaxhiri/Laravel-find-missing-translations) diff --git a/composer.json b/composer.json index 1c00217..2e854c0 100644 --- a/composer.json +++ b/composer.json @@ -9,13 +9,15 @@ "translation" ], "require": { - "php": "^7.1.3 || ^8.0", - "illuminate/console": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0", - "illuminate/support": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "php": "^7.4 || ^8.0", + "illuminate/console": "^9.0 || ^10.0 || ^11.0", + "illuminate/support": "^9.0 || ^10.0 || ^11.0" }, "require-dev": { - "orchestra/testbench": "^3.8 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" + "friendsofphp/php-cs-fixer": "^3.50", + "orchestra/testbench": "^7.0 || ^8.0 || ^9.0", + "phpunit/phpunit": "^9.6 || ^10.5 || ^11.0", + "vimeo/psalm": "^5.22" }, "minimum-stability": "dev", "prefer-stable": true, @@ -40,6 +42,9 @@ } }, "scripts": { + "cs": "vendor/bin/php-cs-fixer fix --allow-risky=yes", + "psalm": "vendor/bin/psalm", + "psalm:ci": "vendor/bin/psalm --shepherd", "test": "vendor/bin/phpunit" } } diff --git a/psalm-baseline.xml b/psalm-baseline.xml new file mode 100644 index 0000000..59d83f5 --- /dev/null +++ b/psalm-baseline.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + option('dir')]]> + option('dir')]]> + option('dir')]]> + + + + + option('dir')]]> + option('dir')]]> + option('dir')]]> + option('dir')]]> + + + + + + + + + + option('base')]]> + + + diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000..b71cbbe --- /dev/null +++ b/psalm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + diff --git a/src/Commands/FindMissingTranslations.php b/src/Commands/FindMissingTranslations.php index dbe2f5c..58b485b 100644 --- a/src/Commands/FindMissingTranslations.php +++ b/src/Commands/FindMissingTranslations.php @@ -127,7 +127,6 @@ private function getFilenames(string $directory): array { $fileNames = []; - /** @var \Symfony\Component\Finder\SplFileInfo[] $filesInFolder */ $filesInFolder = File::files($directory); foreach ($filesInFolder as $fileInfo) {