Skip to content

Commit aaae738

Browse files
committed
Allow null parameter values in EnsureModelExists
1 parent 15b7912 commit aaae738

18 files changed

+287
-256
lines changed

Diff for: .github/workflows/build.yml

-33
This file was deleted.

Diff for: .github/workflows/init.yml

-35
This file was deleted.

Diff for: .github/workflows/php.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Validate composer.json and composer.lock
18+
run: composer validate --strict
19+
20+
- name: Cache Composer packages
21+
id: composer-cache
22+
uses: actions/cache@v2
23+
with:
24+
path: vendor
25+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
26+
restore-keys: ${{ runner.os }}-php-
27+
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: '8.3'
32+
33+
- name: Install dependencies
34+
run: composer install --prefer-dist --no-progress
35+
env:
36+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
37+
38+
- name: Run test suite
39+
run: composer run-script tests

Diff for: .php-cs-fixer.php

+30-29
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
11
<?php
2+
23
$finder = PhpCsFixer\Finder::create()
3-
->in(__DIR__ . '/src')
4-
->in(__DIR__ . '/tests');
4+
->in(__DIR__.'/src')
5+
->in(__DIR__.'/tests');
56

67
return (new PhpCsFixer\Config())
78
->setRules([
8-
'@PSR2' => true,
9-
'array_syntax' => ['syntax' => 'short'],
10-
'concat_space' => ['spacing' => 'one'],
11-
'new_with_braces' => true,
12-
'no_blank_lines_after_phpdoc' => true,
13-
'no_empty_phpdoc' => true,
14-
'no_empty_comment' => true,
15-
'no_leading_import_slash' => true,
16-
'no_trailing_comma_in_singleline_array' => true,
17-
'no_unused_imports' => true,
18-
'ordered_imports' => ['imports_order' => null, 'sort_algorithm' => 'alpha'],
19-
'phpdoc_add_missing_param_annotation' => ['only_untyped' => true],
20-
'phpdoc_align' => true,
21-
'phpdoc_no_empty_return' => true,
22-
'phpdoc_order' => true,
23-
'phpdoc_scalar' => true,
24-
'phpdoc_to_comment' => true,
25-
'psr_autoloading' => true,
26-
'return_type_declaration' => ['space_before' => 'none'],
27-
'single_blank_line_before_namespace' => true,
28-
'single_quote' => true,
29-
'space_after_semicolon' => true,
30-
'ternary_operator_spaces' => true,
31-
'trailing_comma_in_multiline' => true,
32-
'trim_array_spaces' => true,
33-
'whitespace_after_comma_in_array' => true,
9+
'@PSR2' => true,
10+
'array_syntax' => ['syntax' => 'short'],
11+
'concat_space' => ['spacing' => 'one'],
12+
'new_with_parentheses' => true,
13+
'no_blank_lines_after_phpdoc' => true,
14+
'no_empty_phpdoc' => true,
15+
'no_empty_comment' => true,
16+
'no_leading_import_slash' => true,
17+
'no_trailing_comma_in_singleline' => true,
18+
'no_unused_imports' => true,
19+
'ordered_imports' => ['imports_order' => null, 'sort_algorithm' => 'alpha'],
20+
'phpdoc_add_missing_param_annotation' => ['only_untyped' => true],
21+
'phpdoc_align' => true,
22+
'phpdoc_no_empty_return' => true,
23+
'phpdoc_order' => true,
24+
'phpdoc_scalar' => true,
25+
'phpdoc_to_comment' => true,
26+
'psr_autoloading' => true,
27+
'return_type_declaration' => ['space_before' => 'none'],
28+
'blank_lines_before_namespace' => true,
29+
'single_quote' => true,
30+
'space_after_semicolon' => true,
31+
'ternary_operator_spaces' => true,
32+
'trailing_comma_in_multiline' => true,
33+
'trim_array_spaces' => true,
34+
'whitespace_after_comma_in_array' => true,
3435
])
35-
->setFinder($finder);
36+
->setFinder($finder);

Diff for: .travis.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
language: php
2+
3+
sudo: false
4+
5+
matrix:
6+
include:
7+
- php: 8.1
8+
env: COLLECT_COVERAGE=true VALIDATE_CODING_STYLE=true
9+
- php: master
10+
env: COLLECT_COVERAGE=true VALIDATE_CODING_STYLE=false
11+
allow_failures:
12+
- php: master
13+
fast_finish: true
14+
15+
cache:
16+
directories:
17+
- $HOME/.composer/cache
18+
19+
before_install:
20+
- travis_retry composer self-update
21+
22+
install:
23+
- travis_retry composer update --no-interaction --prefer-source
24+
25+
script:
26+
- composer phpunit
27+
28+
after_script:
29+
- if [ "$COLLECT_COVERAGE" == "true" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/clover.xml; fi
30+
- if [ "$VALIDATE_CODING_STYLE" == "true" ]; then composer phpcs; fi

Diff for: Makefile

-19
This file was deleted.

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ Testing
104104

105105
To run the tests, run the following command from the project folder.
106106
``` bash
107-
$ make tests
107+
$ docker compose run test
108108
```
109109

110110
To open a terminal in the dev environment:
111111
``` bash
112-
$ make debug
112+
$ docker compose run --entrypoint=bash php
113113
```
114114

115115
License

Diff for: composer.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
"issues": "https://github.com/softonic/rest-api-nested-resources/issues"
1010
},
1111
"require": {
12-
"php": ">=8.0"
12+
"php": ">=8.3"
1313
},
1414
"require-dev": {
15-
"phpunit/phpunit": "^9.0",
15+
"friendsofphp/php-cs-fixer": "^3.0",
16+
"laravel/framework": "^11.0",
1617
"mockery/mockery": "^1.0",
17-
"friendsofphp/php-cs-fixer": "^3.6",
18-
"laravel/framework": "^8.0",
19-
"squizlabs/php_codesniffer": "^3",
20-
"rector/rector": "^0.11.20"
18+
"phpunit/phpunit": "^11.0",
19+
"rector/rector": "^1.0",
20+
"squizlabs/php_codesniffer": "^3"
2121
},
2222
"autoload": {
2323
"psr-4": {
@@ -30,20 +30,20 @@
3030
}
3131
},
3232
"scripts": {
33-
"test": [
33+
"tests": [
3434
"@checkstyle",
3535
"@phpunit"
3636
],
37-
"phpunit": "phpunit --coverage-text",
37+
"phpunit": "phpunit",
3838
"checkstyle": [
39-
"php-cs-fixer fix -v --diff --dry-run --allow-risky=yes",
40-
"rector --dry-run"
39+
"PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix -v --diff --allow-risky=yes",
40+
"rector process"
4141
],
4242
"fix-checkstyle": [
4343
"@php-cs-fixer",
4444
"@rector"
4545
],
46-
"php-cs-fixer": "php-cs-fixer fix -v --diff --allow-risky=yes",
47-
"rector": "rector"
46+
"php-cs-fixer": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix -v --diff --allow-risky=yes",
47+
"rector": "rector process"
4848
}
4949
}

Diff for: docker-compose.yaml

+33-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
1-
version: '3.8'
2-
31
services:
4-
composer:
2+
php:
3+
volumes:
4+
- ./:/app
5+
image: composer:2.2
6+
7+
install:
8+
volumes:
9+
- ./:/app
10+
image: composer:2.2
11+
command: composer install --ignore-platform-req=ext-sockets
12+
13+
update:
14+
volumes:
15+
- ./:/app
16+
image: composer:2.2
17+
command: composer update --ignore-platform-req=ext-sockets
18+
19+
phpunit:
20+
volumes:
21+
- ./:/app
22+
image: composer:2.2
23+
command: composer phpunit
24+
25+
test:
26+
volumes:
27+
- ./:/app
28+
image: composer:2.2
29+
command: composer run tests
30+
31+
fix-cs:
532
volumes:
6-
- ./:/app
7-
image: softonic/composer-rector:latest
33+
- ./:/app
34+
image: composer:2.2
35+
command: composer run fix-cs

Diff for: phpunit.xml

+12-30
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit bootstrap="vendor/autoload.php"
4-
backupGlobals="false"
5-
backupStaticAttributes="false"
6-
colors="true"
7-
verbose="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
colors="true"
7+
displayDetailsOnTestsThatTriggerDeprecations="true"
8+
displayDetailsOnTestsThatTriggerErrors="true"
9+
displayDetailsOnTestsThatTriggerNotices="true"
10+
displayDetailsOnTestsThatTriggerWarnings="true">
1311

1412
<testsuites>
15-
<testsuite name="softonic/rest-api-nested-resources">
16-
<directory>tests</directory>
13+
<testsuite name="All">
14+
<directory>./tests</directory>
1715
</testsuite>
1816
</testsuites>
19-
20-
<coverage processUncoveredFiles="true">
21-
<include>
22-
<directory suffix=".php">src</directory>
23-
</include>
24-
<report>
25-
<clover outputFile="./build/clover.xml"/>
26-
<html outputDirectory="./build/coverage"/>
27-
<text outputFile="./build/coverage.txt" />
28-
</report>
29-
</coverage>
30-
31-
<logging>
32-
<junit outputFile="./build/report.junit.xml"/>
33-
</logging>
34-
35-
</phpunit>
17+
</phpunit>

0 commit comments

Comments
 (0)