Skip to content

Commit

Permalink
installed psalm & phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
alanbem committed Apr 19, 2022
1 parent 89356c9 commit a9a84e0
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 10 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,49 @@ jobs:
run: docker-compose exec -T php composer install --no-scripts --no-interaction --ansi
- name: Run deptrac
run: docker-compose exec -T php bin/deptrac --no-progress --no-interaction --cache-file=./build/.deptrac/.deptrac.cache --ansi
run-phpstan:
name: phpstan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Docker pull
run: docker-compose pull php
- name: Docker caching
uses: satackey/[email protected]
continue-on-error: true
- name: Composer caching
uses: actions/cache@v2
with:
path: ./build/.composer
key: ${{ runner.os }}-composer-v1-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-v1-
- name: Start PHP container
run: docker-compose up --detach --build --no-deps php
- name: Install dependencies
run: docker-compose exec -T php composer install --no-scripts --no-interaction --ansi
- name: Run phpstan
run: docker-compose exec -T php bin/phpstan analyse -c phpstan.neon
run-psalm:
name: psalm
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Docker pull
run: docker-compose pull php
- name: Docker caching
uses: satackey/[email protected]
continue-on-error: true
- name: Composer caching
uses: actions/cache@v2
with:
path: ./build/.composer
key: ${{ runner.os }}-composer-v1-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-v1-
- name: Start PHP container
run: docker-compose up --detach --build --no-deps php
- name: Install dependencies
run: docker-compose exec -T php composer install --no-scripts --no-interaction --ansi
- name: Run psalm
run: docker-compose exec -T php bin/psalm
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Running checks & tests locally

`docker-compose exec -T php xphp -dxdebug.mode=coverage bin/phpunit --color=always --configuration=phpunit.xml.dist`

`docker-compose run -T php bin/phpunit`

`docker-compose exec -T php bin/rector --dry-run --ansi`

`docker-compose exec -T php bin/deptrac --no-interaction --cache-file=./build/.deptrac/.deptrac.cache --ansi`
Expand Down
Empty file added build/.phpstan/.gitkeep
Empty file.
Empty file added build/.psalm/.gitkeep
Empty file.
16 changes: 9 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,23 @@
},
"require": {
"php": ">=8.0",
"ext-pdo": "*",
"ext-igbinary": "*",
"ext-redis": "*",
"ext-json": "*",
"ext-pdo": "*",
"ext-redis": "*",
"doctrine/dbal": "^2.13",
"psr/log": "^1.1",
"ramsey/uuid": "^4.1"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"friendsofphp/php-cs-fixer": "^3.0",
"php-amqplib/rabbitmq-bundle": "^2.6.0",
"phpunit/phpunit": "^9.5.4",
"rector/rector": "^0.10.19",
"qossmic/deptrac-shim": "^0.13.0"
"php-amqplib/rabbitmq-bundle": "^2.6",
"phpstan/phpstan": "^1.5",
"phpunit/phpunit": "^9.5",
"qossmic/deptrac-shim": "^0.13",
"rector/rector": "^0.12.21",
"roave/security-advisories": "dev-latest",
"vimeo/psalm": "^4.22"
},
"config": {
"bin-dir": "bin",
Expand Down
6 changes: 6 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
level: 1
paths:
- ../src
- ../tests
tmpDir: build/.phpstan
16 changes: 16 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<psalm
errorLevel="8"
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"
cacheDirectory="build/.psalm"
>
<projectFiles>
<directory name="src" />
<directory name="tests"/>
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
10 changes: 9 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector;
use Rector\CodeQuality\Rector\FuncCall\UnwrapSprintfOneArgumentRector;
use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\PhpVersion;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
Expand All @@ -35,6 +36,8 @@
$configurator->import(SetList::PHP_80);
// $configurator->import(SetList::PRIVATIZATION);

$parameters->set(Option::PARALLEL, true);

$parameters->set(Option::SKIP, [
]);

Expand All @@ -48,9 +51,14 @@
]);

// Run Rector only on changed files
$parameters->set(Option::ENABLE_CACHE, true);
$parameters->set(Option::CACHE_DIR, __DIR__ . '/build/.rector');

// is your PHP version different from the one your refactor to? [default: your PHP version], uses PHP_VERSION_ID format
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_80);

// Path to phpstan with extensions, that PHPSTan in Rector uses to determine types
$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, __DIR__ . '/phpstan.neon');

$services = $configurator->services();

$services->set(UnwrapSprintfOneArgumentRector::class);
Expand Down

0 comments on commit a9a84e0

Please sign in to comment.