-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHP8.1 update, proper Symfony 5.4 support
- Loading branch information
Showing
111 changed files
with
955 additions
and
952 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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
name: Validate push | ||
on: [push] | ||
on: [pull_request] | ||
|
||
jobs: | ||
install: | ||
strategy: | ||
matrix: | ||
symfony-version: [ 4.4, 5.4 ] | ||
php-version: [ 7.4, 8.1 ] | ||
include: | ||
- symfony-version: 5.4 | ||
php-version: 8.1 | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -15,29 +17,32 @@ jobs: | |
uses: actions/cache@v3 | ||
with: | ||
path: vendor/ | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
key: ${{ runner.os }}-composer-s-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
restore-keys: | | ||
${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
${{ runner.os }}-composer-s-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
- name: Setup flex | ||
uses: php-actions/composer@v6 | ||
- name: PHP Setup | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php_version: ${{ matrix.php-version }} | ||
command: global require --no-progress --no-scripts --no-plugins symfony/flex | ||
php-version: ${{ matrix.php-version }} | ||
ini-values: pcov.directory=. | ||
coverage: pcov | ||
tools: composer | ||
|
||
- uses: php-actions/composer@v6 | ||
- name: Setup flex | ||
run: | | ||
composer global require --no-progress --no-scripts --no-plugins symfony/flex && composer global config --no-plugins allow-plugins.symfony/flex true | ||
- name: Install | ||
env: | ||
SYMFONY_REQUIRE: ${{ matrix.symfony-version }} | ||
with: | ||
php_version: ${{ matrix.php-version }} | ||
command: install --no-interaction --no-scripts --ansi --no-progress --prefer-dist | ||
run: | | ||
composer install --no-interaction --no-scripts --ansi --no-progress --prefer-dist | ||
phpstan: | ||
strategy: | ||
matrix: | ||
include: | ||
- symfony-version: 4.4 | ||
php-version: 7.4 | ||
- symfony-version: 5.4 | ||
php-version: 8.1 | ||
|
||
|
@@ -51,16 +56,17 @@ jobs: | |
uses: actions/cache@v3 | ||
with: | ||
path: vendor/ | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
key: ${{ runner.os }}-composer-s-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
restore-keys: | | ||
${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
${{ runner.os }}-composer-s-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
- name: PHP Setup | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
ini-values: pcov.directory=. | ||
coverage: pcov | ||
tools: composer | ||
|
||
- name: PHPStan | ||
run: | | ||
|
@@ -70,8 +76,6 @@ jobs: | |
strategy: | ||
matrix: | ||
include: | ||
- symfony-version: 4.4 | ||
php-version: 7.4 | ||
- symfony-version: 5.4 | ||
php-version: 8.1 | ||
|
||
|
@@ -85,16 +89,17 @@ jobs: | |
uses: actions/cache@v3 | ||
with: | ||
path: vendor/ | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
key: ${{ runner.os }}-composer-s-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
restore-keys: | | ||
${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
${{ runner.os }}-composer-s-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
- name: PHP Setup | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
ini-values: pcov.directory=. | ||
coverage: pcov | ||
tools: composer | ||
|
||
- name: PHP-CS-Fixer | ||
run: | | ||
|
@@ -103,8 +108,9 @@ jobs: | |
test: | ||
strategy: | ||
matrix: | ||
symfony-version: [ 4.4, 5.4 ] | ||
php-version: [ 7.4, 8.1 ] | ||
include: | ||
- symfony-version: 5.4 | ||
php-version: 8.1 | ||
|
||
runs-on: ubuntu-latest | ||
needs: | ||
|
@@ -118,17 +124,38 @@ jobs: | |
uses: actions/cache@v3 | ||
with: | ||
path: vendor/ | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
key: ${{ runner.os }}-composer-s-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
restore-keys: | | ||
${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
${{ runner.os }}-composer-s-${{ hashFiles('**/composer.json') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }} | ||
- name: PHP Setup | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
ini-values: pcov.directory=. | ||
coverage: pcov | ||
tools: composer | ||
|
||
- name: PHPUnit | ||
run: | | ||
vendor/bin/phpunit --coverage-cobertura artifacts/code-coverage-cobertura.xml | ||
- name: Code Coverage Report | ||
uses: irongut/[email protected] | ||
with: | ||
filename: artifacts/code-coverage-cobertura.xml | ||
badge: true | ||
fail_below_min: true | ||
format: markdown | ||
hide_branch_rate: false | ||
hide_complexity: true | ||
indicators: true | ||
output: both | ||
thresholds: '70 80' | ||
|
||
- name: Add Coverage PR Comment | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
if: github.event_name == 'pull_request' | ||
with: | ||
recreate: true | ||
path: code-coverage-results.md |
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,5 +1,47 @@ | ||
# Symfony DTO Bundle | ||
|
||
![Code Coverage](https://camo.githubusercontent.com/ffe54b3b9a48d4d6bd374e2630b48e088c99858500db95ebed37184e8c1a6a3b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6465253230436f7665726167652d38342532352d737563636573733f7374796c653d666c6174) | ||
|
||
This bundle aims to lower the burden of typechecking, casting, loading entities | ||
and related annoyances of using requests in your api. | ||
|
||
## Usage | ||
|
||
1. Create a DTO class for your request | ||
|
||
```php | ||
|
||
use \DM\DtoRequestBundle\Attributes\Dto\Path; | ||
use \DM\DtoRequestBundle\Model\AbstractDto; | ||
|
||
class MyDto extends AbstractDto | ||
{ | ||
public ?int $myVar = null; | ||
|
||
#[Path("custom_path")] | ||
public ?string $myString = null; | ||
} | ||
|
||
``` | ||
|
||
2. Add your dto as a controller argument | ||
|
||
```php | ||
|
||
class MyController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController | ||
{ | ||
public function myAction(MyDto $dto): \Symfony\Component\HttpFoundation\Response | ||
{ | ||
// your dto here is already validated! | ||
} | ||
} | ||
``` | ||
|
||
## Docs | ||
|
||
Currently no documentation is available, but will be added in the future. For the time being see [the DTO models for tests](tests/Fixtures/Model/Dto) | ||
|
||
## Missing features | ||
|
||
Currently, some setup is required. Doctrine will not automatically supply entities at this point | ||
and a custom CompilerPass is needed. This will be resolved with an update for the bundle in the future. |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
parameters: | ||
reportUnmatchedIgnoredErrors: false | ||
checkGenericClassInNonGenericObjectType: false | ||
level: 7 | ||
level: 9 | ||
paths: | ||
- src |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.