feat: add PHPStan level 9, PHP CS Fixer, Pest; fix docker user=1000 to avoid root-owned files
This commit is contained in:
parent
e249c3d80f
commit
f204233509
11 changed files with 4500 additions and 8 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -5,3 +5,5 @@
|
||||||
/public/bundles/
|
/public/bundles/
|
||||||
/.php-cs-fixer.cache
|
/.php-cs-fixer.cache
|
||||||
/.phpunit.result.cache
|
/.phpunit.result.cache
|
||||||
|
/phpunit.xml
|
||||||
|
/.phpunit.cache/
|
||||||
|
|
|
||||||
19
.php-cs-fixer.php
Normal file
19
.php-cs-fixer.php
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$finder = PhpCsFixer\Finder::create()
|
||||||
|
->in(__DIR__.'/src')
|
||||||
|
->in(__DIR__.'/tests');
|
||||||
|
|
||||||
|
return (new PhpCsFixer\Config())
|
||||||
|
->setRules([
|
||||||
|
'@Symfony' => true,
|
||||||
|
'@Symfony:risky' => true,
|
||||||
|
'declare_strict_types' => true,
|
||||||
|
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced'],
|
||||||
|
'ordered_imports' => true,
|
||||||
|
'no_unused_imports' => true,
|
||||||
|
'array_syntax' => ['syntax' => 'short'],
|
||||||
|
'phpdoc_align' => false,
|
||||||
|
])
|
||||||
|
->setRiskyAllowed(true)
|
||||||
|
->setFinder($finder);
|
||||||
|
|
@ -28,7 +28,9 @@
|
||||||
"allow-plugins": {
|
"allow-plugins": {
|
||||||
"php-http/discovery": true,
|
"php-http/discovery": true,
|
||||||
"symfony/flex": true,
|
"symfony/flex": true,
|
||||||
"symfony/runtime": true
|
"symfony/runtime": true,
|
||||||
|
"pestphp/pest-plugin": true,
|
||||||
|
"phpstan/extension-installer": true
|
||||||
},
|
},
|
||||||
"bump-after-update": true,
|
"bump-after-update": true,
|
||||||
"sort-packages": true
|
"sort-packages": true
|
||||||
|
|
@ -75,5 +77,14 @@
|
||||||
"allow-contrib": false,
|
"allow-contrib": false,
|
||||||
"require": "8.0.*"
|
"require": "8.0.*"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"friendsofphp/php-cs-fixer": "^3",
|
||||||
|
"pestphp/pest": "^3",
|
||||||
|
"phpstan/extension-installer": "*",
|
||||||
|
"phpstan/phpstan": "^2",
|
||||||
|
"phpstan/phpstan-doctrine": "^2",
|
||||||
|
"phpstan/phpstan-symfony": "^2",
|
||||||
|
"phpunit/phpunit": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4393
composer.lock
generated
4393
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -3,8 +3,6 @@ doctrine:
|
||||||
url: '%env(resolve:DATABASE_URL)%'
|
url: '%env(resolve:DATABASE_URL)%'
|
||||||
schema_filter: ~^(?!logs\.|logs_archive\.)~
|
schema_filter: ~^(?!logs\.|logs_archive\.)~
|
||||||
orm:
|
orm:
|
||||||
auto_generate_proxy_classes: true
|
|
||||||
enable_lazy_ghost_objects: true
|
|
||||||
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
||||||
auto_mapping: true
|
auto_mapping: true
|
||||||
mappings:
|
mappings:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
framework:
|
framework:
|
||||||
router:
|
router:
|
||||||
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
|
default_uri: 'http://localhost'
|
||||||
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
|
|
||||||
default_uri: '%env(DEFAULT_URI)%'
|
|
||||||
|
|
||||||
when@prod:
|
when@prod:
|
||||||
framework:
|
framework:
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/app/Dockerfile
|
dockerfile: docker/app/Dockerfile
|
||||||
|
user: "1000:1000"
|
||||||
|
environment:
|
||||||
|
HOME: /tmp
|
||||||
volumes:
|
volumes:
|
||||||
- .:/var/www
|
- .:/var/www
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
@ -47,6 +50,9 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/app/Dockerfile
|
dockerfile: docker/app/Dockerfile
|
||||||
|
user: "1000:1000"
|
||||||
|
environment:
|
||||||
|
HOME: /tmp
|
||||||
command: php bin/console messenger:consume ai_pipeline --time-limit=3600 --memory-limit=256M
|
command: php bin/console messenger:consume ai_pipeline --time-limit=3600 --memory-limit=256M
|
||||||
volumes:
|
volumes:
|
||||||
- .:/var/www
|
- .:/var/www
|
||||||
|
|
@ -60,6 +66,9 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/app/Dockerfile
|
dockerfile: docker/app/Dockerfile
|
||||||
|
user: "1000:1000"
|
||||||
|
environment:
|
||||||
|
HOME: /tmp
|
||||||
command: php bin/console messenger:consume orders --time-limit=3600 --memory-limit=256M
|
command: php bin/console messenger:consume orders --time-limit=3600 --memory-limit=256M
|
||||||
volumes:
|
volumes:
|
||||||
- .:/var/www
|
- .:/var/www
|
||||||
|
|
@ -73,6 +82,9 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/app/Dockerfile
|
dockerfile: docker/app/Dockerfile
|
||||||
|
user: "1000:1000"
|
||||||
|
environment:
|
||||||
|
HOME: /tmp
|
||||||
command: php bin/console messenger:consume channel_sync --time-limit=3600 --memory-limit=256M
|
command: php bin/console messenger:consume channel_sync --time-limit=3600 --memory-limit=256M
|
||||||
volumes:
|
volumes:
|
||||||
- .:/var/www
|
- .:/var/www
|
||||||
|
|
@ -86,6 +98,9 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/app/Dockerfile
|
dockerfile: docker/app/Dockerfile
|
||||||
|
user: "1000:1000"
|
||||||
|
environment:
|
||||||
|
HOME: /tmp
|
||||||
command: >
|
command: >
|
||||||
sh -c "while true; do
|
sh -c "while true; do
|
||||||
php bin/console app:logs:rotate;
|
php bin/console app:logs:rotate;
|
||||||
|
|
|
||||||
13
phpstan.neon
Normal file
13
phpstan.neon
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
includes:
|
||||||
|
- vendor/phpstan/phpstan-symfony/extension.neon
|
||||||
|
- vendor/phpstan/phpstan-doctrine/extension.neon
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
level: 9
|
||||||
|
paths:
|
||||||
|
- src
|
||||||
|
- tests
|
||||||
|
symfony:
|
||||||
|
containerXmlPath: var/cache/dev/App_KernelDevDebugContainer.xml
|
||||||
|
doctrine:
|
||||||
|
objectManagerLoader: tests/bootstrap.php
|
||||||
29
phpunit.xml.dist
Normal file
29
phpunit.xml.dist
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
|
bootstrap="vendor/autoload.php"
|
||||||
|
colors="true"
|
||||||
|
failOnWarning="true"
|
||||||
|
failOnRisky="true"
|
||||||
|
>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Unit">
|
||||||
|
<directory>tests/Unit</directory>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="Integration">
|
||||||
|
<directory>tests/Integration</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
|
||||||
|
<coverage>
|
||||||
|
<include>
|
||||||
|
<directory suffix=".php">src</directory>
|
||||||
|
</include>
|
||||||
|
</coverage>
|
||||||
|
|
||||||
|
<php>
|
||||||
|
<ini name="error_reporting" value="-1"/>
|
||||||
|
<server name="APP_ENV" value="test" force="true"/>
|
||||||
|
<server name="SHELL_VERBOSITY" value="-1"/>
|
||||||
|
</php>
|
||||||
|
</phpunit>
|
||||||
5
tests/Pest.php
Normal file
5
tests/Pest.php
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
uses(PHPUnit\Framework\TestCase::class)->in('Unit');
|
||||||
13
tests/bootstrap.php
Normal file
13
tests/bootstrap.php
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Symfony\Component\Dotenv\Dotenv;
|
||||||
|
|
||||||
|
require dirname(__DIR__).'/vendor/autoload.php';
|
||||||
|
|
||||||
|
if (method_exists(Dotenv::class, 'bootEnv')) {
|
||||||
|
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER['APP_DEBUG']) {
|
||||||
|
umask(0000);
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue