Skip to content

Commit

Permalink
Merge pull request #19 from jakzal/php-8.2
Browse files Browse the repository at this point in the history
Add support for PHP 8.2
  • Loading branch information
jakzal committed Dec 18, 2022
2 parents 8a5315b + 2baffc4 commit db00d96
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 90 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
name: Build and test
strategy:
matrix:
php: ['8.0', '8.1']
php: ['8.0', '8.1', '8.2']
deps: [high]
include:
- php: '8.1'
- php: '8.2'
deps: low

steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
/box.json
/composer.lock
/vendor/
/.php_cs.cache
/.php-cs-fixer.cache
/.deptrac.cache
.phpunit.result.cache
5 changes: 2 additions & 3 deletions .php_cs → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
->in(['src', 'tests'])
;

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_before_statement' => true,
'declare_strict_types' => true,
'native_function_invocation' => true,
'native_function_invocation' => ['include' => ['@internal'], 'scope' => 'all', 'strict' => true],
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_extra_consecutive_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_unused_imports' => true,
Expand Down
24 changes: 8 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IS_PHP81:=$(shell php -r 'echo (int)version_compare(PHP_VERSION, "8.1", ">=");')
IS_PHP82:=$(shell php -r 'echo (int)version_compare(PHP_VERSION, "8.2", ">=");')

default: build

Expand Down Expand Up @@ -27,29 +27,21 @@ test: vendor cs deptrac phpunit infection
test-min: update-min cs deptrac phpunit infection
.PHONY: test-min

ifeq ($(IS_PHP81),1)
ifeq ($(IS_PHP82),1)
test-package:
else
test-package: package test-package-tools
cd tests/phar && ./tools/phpunit
endif
.PHONY: test-package

ifeq ($(IS_PHP81),1)
cs:
else
cs: tools/php-cs-fixer
PHP_CS_FIXER_IGNORE_ENV=1 tools/php-cs-fixer --dry-run --allow-risky=yes --no-interaction --ansi fix
endif
.PHONY: cs

ifeq ($(IS_PHP81),1)
cs-fix:
else
cs-fix: tools/php-cs-fixer
PHP_CS_FIXER_IGNORE_ENV=1 tools/php-cs-fixer --allow-risky=yes --no-interaction --ansi fix
.PHONY: cs-fix
endif

deptrac: tools/deptrac
tools/deptrac --no-interaction --ansi
Expand Down Expand Up @@ -80,7 +72,7 @@ clean:
find tests/phar/tools -not -path '*/\.*' -type f -delete
.PHONY: clean

ifeq ($(IS_PHP81),1)
ifeq ($(IS_PHP82),1)
package:
else
package: tools/box
Expand Down Expand Up @@ -109,19 +101,19 @@ tools/phpunit: vendor/bin/phpunit
ln -sf ../vendor/bin/phpunit tools/phpunit

tools/php-cs-fixer:
curl -Ls http://cs.symfony.com/download/php-cs-fixer-v2.phar -o tools/php-cs-fixer && chmod +x tools/php-cs-fixer
curl -Ls http://cs.symfony.com/download/php-cs-fixer-v3.phar -o tools/php-cs-fixer && chmod +x tools/php-cs-fixer

tools/deptrac:
curl -Ls https://github.com/sensiolabs-de/deptrac/releases/download/0.19.1/deptrac.phar -o tools/deptrac && chmod +x tools/deptrac
curl -Ls https://github.com/sensiolabs-de/deptrac/releases/download/0.24.0/deptrac.phar -o tools/deptrac && chmod +x tools/deptrac

tools/infection: tools/infection.pubkey
curl -Ls https://github.com/infection/infection/releases/download/0.26.1/infection.phar -o tools/infection && chmod +x tools/infection
curl -Ls https://github.com/infection/infection/releases/download/0.26.16/infection.phar -o tools/infection && chmod +x tools/infection

tools/infection.pubkey:
curl -Ls https://github.com/infection/infection/releases/download/0.26.1/infection.phar.pubkey -o tools/infection.pubkey
curl -Ls https://github.com/infection/infection/releases/download/0.26.16/infection.phar.pubkey -o tools/infection.pubkey

tools/box:
curl -Ls https://github.com/humbug/box/releases/download/3.14.0/box.phar -o tools/box && chmod +x tools/box
curl -Ls https://github.com/humbug/box/releases/download/3.16.0/box.phar -o tools/box && chmod +x tools/box

tests/phar/tools/phpunit:
curl -Ls https://phar.phpunit.de/phpunit-9.phar -o tests/phar/tools/phpunit && chmod +x tests/phar/tools/phpunit
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Initialises test doubles in PHPUnit test cases for you",
"type": "library",
"require": {
"php": "~8.0.0 || ~8.1.0",
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
"phpunit/phpunit": "^9.0",
"phpdocumentor/reflection-docblock": "^5.2"
},
Expand Down
67 changes: 0 additions & 67 deletions depfile.yaml

This file was deleted.

68 changes: 68 additions & 0 deletions deptrac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
parameters:
paths:
- ./src
exclude_files: []
layers:
- name: Doubles TestCase
collectors:
- type: className
regex: ^Zalas\\PHPUnit\\Doubles\\TestCase\\.*
- name: Doubles Extractor
collectors:
- type: className
regex: ^Zalas\\PHPUnit\\Doubles\\Extractor\\.*
- name: Doubles Injector
collectors:
- type: className
regex: ^Zalas\\PHPUnit\\Doubles\\Injector\\.*
- name: Doubles PhpDocumentor
collectors:
- type: className
regex: ^Zalas\\PHPUnit\\Doubles\\PhpDocumentor\\.*
- name: PHPUnit
collectors:
- type: className
regex: ^PHPUnit\\Framework\\.*
- name: Prophecy
collectors:
- type: className
regex: ^Prophecy\\Prophecy\\.*
- name: PhpDocumentor Reflection
collectors:
- type: className
regex: ^phpDocumentor\\Reflection\\.*
- name: Other Vendors
collectors:
- type: bool
must:
# must be outside of global namespace
- type: className
regex: '[\\]+'
must_not:
# must not be one of the known vendors
- type: className
regex: ^Zalas\\PHPUnit\\Doubles\\TestCase\\.*
- type: className
regex: ^Zalas\\PHPUnit\\Doubles\\Extractor\\.*
- type: className
regex: ^Zalas\\PHPUnit\\Doubles\\Injector\\.*
- type: className
regex: ^Zalas\\PHPUnit\\Doubles\\PhpDocumentor\\.*
- type: className
regex: ^PHPUnit\\Framework\\.*
- type: className
regex: ^Prophecy\\Prophecy\\.*
- type: className
regex: ^phpDocumentor\\Reflection\\.*
ruleset:
Doubles TestCase:
- Doubles Extractor
- Doubles Injector
- Doubles PhpDocumentor
- PHPUnit
- Prophecy
Doubles Extractor:
Doubles Injector:
Doubles PhpDocumentor:
- Doubles Extractor
- PhpDocumentor Reflection

0 comments on commit db00d96

Please sign in to comment.