Skip to content

Commit fe48592

Browse files
authored
Merge pull request #59 from bbatsche/php-8.0
PHP 8.0
2 parents 2706929 + 5043eaa commit fe48592

25 files changed

+212
-188
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ indent_size = 2
1111

1212
[*.php]
1313
indent_size = 4
14+
15+
[*.xml]
16+
indent_size = 4
17+
18+
[*.{neon,neon.dist}]
19+
indent_size = 2

.gitattributes

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
33

44
# Ignore all test and miscellaneous support files with "export-ignore".
5-
/.* export-ignore
6-
/hooks export-ignore
7-
/phpstan.neon.dist export-ignore
8-
/phpunit.xml export-ignore
9-
/test export-ignore
5+
/.* export-ignore
6+
/hooks export-ignore
7+
/phpstan.neon.dist export-ignore
8+
/phpstan.phpunit7.neon export-ignore
9+
/phpstan.phpunit9.neon export-ignore
10+
/phpunit.xml export-ignore
11+
/test export-ignore

.gitignore

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Created by https://www.toptal.com/developers/gitignore/api/macos,linux,composer,intellij+all,phpunit
2-
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,linux,composer,intellij+all,phpunit
1+
# Created by https://www.toptal.com/developers/gitignore/api/linux,macos,phpunit,composer,intellij+all,visualstudiocode
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,macos,phpunit,composer,intellij+all,visualstudiocode
33

44
### Composer ###
55
composer.phar
@@ -20,6 +20,9 @@ composer.lock
2020
.idea/**/dictionaries
2121
.idea/**/shelf
2222

23+
# AWS User-specific
24+
.idea/**/aws.xml
25+
2326
# Generated files
2427
.idea/**/contentModel.xml
2528

@@ -147,6 +150,7 @@ Temporary Items
147150

148151
# Generated files
149152
.phpunit.result.cache
153+
.phpunit.cache
150154

151155
# PHPUnit
152156
/app/phpunit.xml
@@ -155,6 +159,28 @@ Temporary Items
155159
# Build data
156160
/build/
157161

158-
# End of https://www.toptal.com/developers/gitignore/api/macos,linux,composer,intellij+all,phpunit
159-
/.php_cs.cache
162+
### VisualStudioCode ###
163+
.vscode/*
164+
!.vscode/settings.json
165+
!.vscode/tasks.json
166+
!.vscode/launch.json
167+
!.vscode/extensions.json
168+
*.code-workspace
169+
170+
# Local History for Visual Studio Code
171+
.history/
172+
173+
### VisualStudioCode Patch ###
174+
# Ignore all local history of files
175+
.history
176+
.ionide
177+
178+
# Support for Project snippet scope
179+
!.vscode/*.code-snippets
180+
181+
# End of https://www.toptal.com/developers/gitignore/api/linux,macos,phpunit,composer,intellij+all,visualstudiocode
182+
183+
/.php-cs-fixer.cache
184+
/.php-cs-fixer.php
185+
/coverage.xml
160186
/phpstan.neon

.php-cs-fixer.dist.php

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in('src')
5+
->in('test')
6+
->notName('function.php'); // no_superfluous_php_doc_tags does not play well with function.php
7+
// basically treat rule & file as mutually exclusive; either have one or the other
8+
9+
return (new PhpCsFixer\Config())
10+
->setRules([
11+
'@PHP70Migration' => true,
12+
'@PHP70Migration:risky' => true,
13+
'@PHPUnit60Migration:risky' => true,
14+
'@PhpCsFixer' => true,
15+
'@PhpCsFixer:risky' => true,
16+
'align_multiline_comment' => ['comment_type' => 'phpdocs_like'],
17+
'binary_operator_spaces' => [
18+
'default' => 'align_single_space_minimal',
19+
'operators' => ['||' => null, '&&' => null]
20+
],
21+
'class_attributes_separation' => [
22+
'elements' => [
23+
'const' => 'only_if_meta',
24+
'property' => 'only_if_meta',
25+
'method' => 'one',
26+
'trait_import' => 'none',
27+
]
28+
],
29+
'class_definition' => [
30+
'single_item_single_line' => true,
31+
'multi_line_extends_each_single_line' => true,
32+
],
33+
'concat_space' => ['spacing' => 'one'],
34+
'control_structure_continuation_position' => true,
35+
'date_time_immutable' => true,
36+
'declare_parentheses' => true,
37+
'final_class' => true,
38+
'final_public_method_for_abstract_class' => true,
39+
'global_namespace_import' => true,
40+
'list_syntax' => ['syntax' => 'long'], // PHP 7.0 compatibility
41+
'mb_str_functions' => true,
42+
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
43+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
44+
'no_unset_on_property' => false,
45+
'operator_linebreak' => ['position' => 'beginning', 'only_booleans' => false],
46+
'ordered_class_elements' => ['sort_algorithm' => 'alpha'],
47+
'ordered_interfaces' => true,
48+
'ordered_imports' => ['imports_order' => ['const', 'class', 'function']],
49+
'phpdoc_line_span' => ['const' => 'single', 'property' => 'single'],
50+
'phpdoc_no_empty_return' => false, // PHP 7.0 & PHPStan compatibility
51+
'phpdoc_order_by_value' => ['annotations' => ['covers', 'depends', 'group', 'throws']],
52+
'phpdoc_types_order' => ['null_adjustment' => 'always_last'],
53+
'php_unit_test_case_static_method_calls' => ['call_type' => 'this'],
54+
'php_unit_test_class_requires_covers' => false,
55+
'psr_autoloading' => ['dir' => 'src'],
56+
'regular_callable_call' => true,
57+
'self_static_accessor' => true,
58+
'static_lambda' => true,
59+
'simplified_null_return' => true,
60+
'simplified_if_return' => true,
61+
'visibility_required' => ['elements' => ['property', 'method']], // PHP 7.0 compatibility
62+
'yoda_style' => false,
63+
])
64+
->setFinder($finder)
65+
->setRiskyAllowed(true);

.php_cs

Lines changed: 0 additions & 51 deletions
This file was deleted.

.travis.yml

Lines changed: 19 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,37 @@
11
language: php
22

3-
php:
4-
- 7.0
5-
- 7.1
6-
- 7.2
7-
- 7.3
8-
- 7.4
9-
103
env:
11-
- PHPUNIT_VERSION=6 TEST_SUITE=unit
12-
- PHPUNIT_VERSION=7 TEST_SUITE=static
13-
- PHPUNIT_VERSION=7 TEST_SUITE=unit
14-
- PHPUNIT_VERSION=8 TEST_SUITE=static
15-
- PHPUNIT_VERSION=8 TEST_SUITE=unit
16-
- PHPUNIT_VERSION=9 TEST_SUITE=static
17-
- PHPUNIT_VERSION=9 TEST_SUITE=unit
4+
global:
5+
- XDEBUG_MODE=coverage
186

197
matrix:
20-
exclude:
21-
# PHP 7.0
22-
- php: 7.0
23-
env: PHPUNIT_VERSION=7 TEST_SUITE=static
24-
- php: 7.0
25-
env: PHPUNIT_VERSION=7 TEST_SUITE=unit
26-
- php: 7.0
27-
env: PHPUNIT_VERSION=8 TEST_SUITE=static
8+
include:
289
- php: 7.0
29-
env: PHPUNIT_VERSION=8 TEST_SUITE=unit
30-
- php: 7.0
31-
env: PHPUNIT_VERSION=9 TEST_SUITE=static
32-
- php: 7.0
33-
env: PHPUNIT_VERSION=9 TEST_SUITE=unit
34-
35-
# PHP 7.1
36-
- php: 7.1
37-
env: PHPUNIT_VERSION=8 TEST_SUITE=static
38-
- php: 7.1
39-
env: PHPUNIT_VERSION=8 TEST_SUITE=unit
40-
- php: 7.1
41-
env: PHPUNIT_VERSION=9 TEST_SUITE=static
42-
- php: 7.1
43-
env: PHPUNIT_VERSION=9 TEST_SUITE=unit
10+
env: TEST_SUITE=unit PHPUNIT_VERSION=6
4411

45-
# PHP 7.2
46-
- php: 7.2
47-
env: PHPUNIT_VERSION=9 TEST_SUITE=static
48-
- php: 7.2
49-
env: PHPUNIT_VERSION=9 TEST_SUITE=unit
50-
51-
# PHP 7.3
52-
- php: 7.3
53-
env: PHPUNIT_VERSION=6 TEST_SUITE=unit
54-
55-
# PHP 7.4
5612
- php: 7.4
57-
env: PHPUNIT_VERSION=6 TEST_SUITE=unit
13+
env: TEST_SUITE=unit PHPUNIT_VERSION=7
14+
- php: 7.4
15+
env: TEST_SUITE=static PHPUNIT_VERSION=7
5816
- php: 7.4
59-
env: PHPUNIT_VERSION=7 TEST_SUITE=static
17+
env: TEST_SUITE=unit PHPUNIT_VERSION=8
6018
- php: 7.4
61-
env: PHPUNIT_VERSION=7 TEST_SUITE=unit
19+
env: TEST_SUITE=static PHPUNIT_VERSION=8
20+
- php: 7.4
21+
env: TEST_SUITE=unit PHPUNIT_VERSION=9
22+
- php: 7.4
23+
env: TEST_SUITE=static PHPUNIT_VERSION=9
24+
25+
- php: 8.0
26+
env: TEST_SUITE=unit PHPUNIT_VERSION=9
27+
- php: 8.0
28+
env: TEST_SUITE=static PHPUNIT_VERSION=9
6229

6330
sudo: false
6431

6532
before_install:
6633
# Remove some dependencies that aren't needed for static test suite and are incompatible with PHP 7 or PHPUnit 6
67-
- if [ $TEST_SUITE == "unit" ]; then composer remove --dev ergebnis/composer-normalize maglnet/composer-require-checker phpstan/phpstan phpstan/phpstan-mockery phpstan/phpstan-phpunit phpstan/phpstan-strict-rules; fi
34+
- if [ $TEST_SUITE == "unit" ]; then composer remove --dev ergebnis/composer-normalize maglnet/composer-require-checker phpstan/phpstan phpstan/phpstan-mockery phpstan/phpstan-phpunit phpstan/phpstan-strict-rules friendsofphp/php-cs-fixer; fi
6835

6936
install:
7037
- if [ -e composer.lock ]; then rm -rf composer.lock vendor; fi

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ Verify will be added to your `composer.json` under `require-dev` and installed i
4040

4141
### Compatibility
4242

43-
As stated, Verify is built on top of PHPUnit's own assertions. It has been written to be compatibile with any version of PHPUnit from 6.0 through 9.x. That said, some assertions have been removed from later versions of PHPUnit, and others added. Those assertions are noted in documentation below. When using Verify, it is still good practice to declare what version of PHPUnit your project depends on so that there are no surprise compatibility issues.
43+
As stated, Verify is built on top of PHPUnit's own assertions. It has been written to be compatible with any version of PHPUnit from 6.0 through 9.x. That said, some assertions have been removed from later versions of PHPUnit, and others added. Those assertions are noted in documentation below. When using Verify, it is still good practice to declare what version of PHPUnit your project depends on so that there are no surprise compatibility issues.
4444

45-
In addition, Verify is compatibile with any version of PHP 7. You should have no issues integrating it into your legacy projects.
45+
In addition, Verify is compatible with both PHP 7 and 8. You should have no issues integrating it into your legacy projects.
4646

4747
## Basic Usage
4848

@@ -55,7 +55,7 @@ use function BeBat\Verify\verify;
5555
use function BeBat\Verify\verify_file;
5656
// assertions for directories
5757
use function BeBat\Verify\verify_directory;
58-
````
58+
```
5959

6060
To use Verify in your unit tests, call the `verify()` function, followed by one or more conjunction, and then your assertion(s). For example:
6161

composer.json

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,32 @@
2525
}
2626
],
2727
"require": {
28-
"php": "^7.0",
28+
"php": "^7.0 || ^8.0",
2929
"phpunit/phpunit": "^6.0 || ^7.0 || ^8.0 || ^9.0"
3030
},
3131
"replace": {
3232
"codeception/verify": "*"
3333
},
3434
"require-dev": {
3535
"ergebnis/composer-normalize": "^2.6",
36-
"friendsofphp/php-cs-fixer": "^2.15",
37-
"maglnet/composer-require-checker": "^2.0",
36+
"friendsofphp/php-cs-fixer": "^3.3",
37+
"maglnet/composer-require-checker": "^3.5",
3838
"mockery/mockery": "^1.0",
39-
"phpstan/phpstan": "^0.12",
40-
"phpstan/phpstan-mockery": "^0.12",
41-
"phpstan/phpstan-phpunit": "^0.12",
42-
"phpstan/phpstan-strict-rules": "^0.12",
4339
"php-mock/php-mock": "^2.2",
44-
"php-mock/php-mock-mockery": "^1.3"
40+
"php-mock/php-mock-mockery": "^1.3",
41+
"phpstan/phpstan": "^1.2",
42+
"phpstan/phpstan-mockery": "^1.0",
43+
"phpstan/phpstan-phpunit": "^1.0",
44+
"phpstan/phpstan-strict-rules": "^1.0"
4545
},
4646
"suggest": {
4747
"codeception/specify": "Highly readable test code blocks for PHPUnit and Codeception"
4848
},
49+
"extra": {
50+
"branch-alias": {
51+
"dev-master": "2.2.x-dev"
52+
}
53+
},
4954
"autoload": {
5055
"psr-4": {
5156
"BeBat\\Verify\\": "src"

phpstan.neon.dist

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ parameters:
1212
message: '/PHPDoc tag @param references unknown parameter: \$description/'
1313
path: %currentWorkingDirectory%/src/function.php
1414
-
15-
message: '/has parameter \$args with no typehint specified/'
15+
message: '/has parameter \$args with no type specified/'
1616
path: %currentWorkingDirectory%/src/function.php
1717
-
1818
message: '/Negated boolean expression is always false/'
@@ -23,6 +23,10 @@ parameters:
2323
-
2424
message: '/Call to an undefined method BeBat\\Verify\\Verify::[a-z_]+_conjunction\(\)/'
2525
path: %currentWorkingDirectory%/test/VerifyTest.php
26+
-
27+
message: '/(Static )?(P|p)roperty BeBat\\Verify\\Test\\Stub\\[a-zA-Z:\$]+ is never read, only written/'
28+
path: %currentWorkingDirectory%/test/Stub
2629
- '/Mockery\\LegacyMockInterface::shouldNotReceive/'
2730
- '/Mockery\\LegacyMockInterface::shouldReceive/'
2831
- '/Mockery\\HigherOrderMessage::with/'
32+
- '/Property BeBat\\Verify\\VerifyBase::\$modifierCondition \(bool\) in isset\(\) is not nullable/'

0 commit comments

Comments
 (0)