-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies, add Psalm and PHP-CS-Fixer
- Loading branch information
Showing
10 changed files
with
164 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
composer.lock | ||
vendor | ||
|
||
.phpunit.result.cache |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php declare(strict_types=1); | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->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); |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<files psalm-version="5.22.2@d768d914152dbbf3486c36398802f74e80cfde48"> | ||
<file src="src/Commands/FindMissingTranslations.php"> | ||
<MissingPropertyType> | ||
<code><![CDATA[$exitCode]]></code> | ||
</MissingPropertyType> | ||
<NonInvariantDocblockPropertyType> | ||
<code><![CDATA[$description]]></code> | ||
</NonInvariantDocblockPropertyType> | ||
<PossiblyInvalidArgument> | ||
<code><![CDATA[$pathToLocates]]></code> | ||
<code><![CDATA[$this->option('dir')]]></code> | ||
<code><![CDATA[$this->option('dir')]]></code> | ||
<code><![CDATA[$this->option('dir')]]></code> | ||
</PossiblyInvalidArgument> | ||
<PossiblyInvalidCast> | ||
<code><![CDATA[$baseLocale]]></code> | ||
<code><![CDATA[$pathToLocates]]></code> | ||
<code><![CDATA[$this->option('dir')]]></code> | ||
<code><![CDATA[$this->option('dir')]]></code> | ||
<code><![CDATA[$this->option('dir')]]></code> | ||
<code><![CDATA[$this->option('dir')]]></code> | ||
</PossiblyInvalidCast> | ||
<PropertyNotSetInConstructor> | ||
<code><![CDATA[FindMissingTranslations]]></code> | ||
<code><![CDATA[FindMissingTranslations]]></code> | ||
<code><![CDATA[FindMissingTranslations]]></code> | ||
<code><![CDATA[FindMissingTranslations]]></code> | ||
<code><![CDATA[FindMissingTranslations]]></code> | ||
</PropertyNotSetInConstructor> | ||
<RiskyTruthyFalsyComparison> | ||
<code><![CDATA[$this->option('base')]]></code> | ||
</RiskyTruthyFalsyComparison> | ||
</file> | ||
</files> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0"?> | ||
<psalm | ||
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" | ||
errorLevel="2" | ||
findUnusedBaselineEntry="true" | ||
findUnusedCode="false" | ||
findUnusedVariablesAndParams="true" | ||
resolveFromConfigFile="true" | ||
useDocblockPropertyTypes="true" | ||
errorBaseline="psalm-baseline.xml" | ||
> | ||
<projectFiles> | ||
<directory name="src"/> | ||
<directory name="tests"/> | ||
<ignoreFiles> | ||
<directory name="vendor"/> | ||
</ignoreFiles> | ||
</projectFiles> | ||
|
||
<issueHandlers> | ||
</issueHandlers> | ||
</psalm> |
This file contains 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