Skip to content

Commit 7008117

Browse files
authored
Merge pull request #186 from koriym/php7.1
Drop support php 7.0
2 parents 5421780 + 49ba2d8 commit 7008117

9 files changed

Lines changed: 99 additions & 62 deletions

File tree

.travis.yml

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,61 @@
11
language: php
22
sudo: false
3+
34
php:
4-
- 7
55
- 7.1
66
- 7.2
77
- 7.3
8+
- nightly
9+
810
cache:
911
directories:
1012
- vendor
1113
- $HOME/.composer/cache
12-
env:
13-
matrix:
14-
- DEPENDENCIES=""
15-
- DEPENDENCIES="--prefer-lowest --prefer-stable"
16-
before_script:
17-
- if [[ $TRAVIS_PHP_VERSION = '7.2' ]]; then cp $HOME/.phpenv/versions/$(phpenv global)/etc/conf.d/xdebug.ini /tmp; fi
18-
- if [[ $TRAVIS_PHP_VERSION != '7.3' ]]; then phpenv config-rm xdebug.ini ; fi
14+
15+
matrix:
16+
fast_finish: true
17+
18+
before_install:
19+
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
1920
- composer self-update
20-
- if [[ $TRAVIS_PHP_VERSION = '7.2' ]]; then composer require --dev phpstan/phpstan-shim ^0.10 friendsofphp/php-cs-fixer ^2.0; fi
21+
2122
install:
22-
- if [[ $TRAVIS_PHP_VERSION = '7.2' && DEPENDENCIES = '' ]]; then composer require --dev phpstan/phpstan-shim ^0.9 friendsofphp/php-cs-fixer ^2.13; fi
23-
- composer update $DEPENDENCIES
23+
- composer update
24+
2425
script:
25-
- ./vendor/bin/phpunit $COVERAGE;
26-
- if [[ $TRAVIS_PHP_VERSION = '7.2' && DEPENDENCIES = '' ]]; then ./vendor/bin/php-cs-fixer --dry-run -v fix; fi
27-
- if [[ $TRAVIS_PHP_VERSION = '7.2' && DEPENDENCIES = '' ]]; then ./vendor/bin/phpstan analyse -l max -c phpstan.neon src tests --no-progress --no-interaction; fi
28-
- if [[ $TRAVIS_PHP_VERSION = '7.2' && DEPENDENCIES = '' ]]; then phpenv config-add /tmp/xdebug.ini; ./vendor/bin/phpunit --coverage-clover=coverage.clover; else ./vendor/bin/phpunit; fi
29-
after_script:
30-
- if [[ $TRAVIS_PHP_VERSION = '7.2' && DEPENDENCIES = '' ]]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
26+
- ./vendor/bin/phpunit;
27+
28+
jobs:
29+
include:
30+
- stage: Test
31+
name: Lowest dependencies
32+
php: 7.2
33+
install: composer update --prefer-dist --prefer-lowest
34+
35+
- stage: Test
36+
name: Code coverage
37+
php: 7.2
38+
before_script:
39+
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
40+
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
41+
script:
42+
- ./vendor/bin/phpunit -v --coverage-clover ./build/logs/clover.xml
43+
after_script:
44+
- wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover;
45+
46+
- stage: Code Quality
47+
name: Static analysis
48+
php: 7.2
49+
install: composer require --dev phpstan/phpstan-shim ^0.10;
50+
script:
51+
- ./vendor/bin/phpstan analyse -l max -c phpstan.neon src tests --no-progress --no-interaction;
52+
53+
- stage: Code Quality
54+
name: Coding standards
55+
php: 7.2
56+
install: composer require --dev friendsofphp/php-cs-fixer ^2.0;
57+
script:
58+
- ./vendor/bin/php-cs-fixer --dry-run -v fix;
59+
60+
allow_failures:
61+
- php: nightly

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^7.0",
19-
"ray/aop": "2.7.6",
18+
"php": ">=7.1.0",
19+
"ray/aop": "^2.8",
2020
"ray/compiler": "^1.3.5"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "^6.3.0"
23+
"phpunit/phpunit": "^7.5"
2424
},
2525
"autoload": {
2626
"psr-4": {

phpcs.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
<?xml version="1.0"?>
2-
<ruleset>
3-
<!-- 2. General -->
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset name="PHP_CodeSniffer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
44
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
55
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
66
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
7-
<!-- Include the whole PSR-2 standard -->
87
<rule ref="PSR2">
98
<exclude name="Generic.Files.LineLength"/>
109
</rule>
@@ -15,6 +14,6 @@
1514
<exclude name="PEAR.Commenting.FunctionComment.MissingParamTag"/>
1615
<exclude name="PEAR.Commenting.FunctionComment.Missing"/>
1716
<exclude name="PEAR.Commenting.FunctionComment.ParameterCommentsNotAligned"/>
18-
<exclude name="PEAR.Commenting.FunctionComment.ParamNameNoMatch" />
17+
<exclude name="PEAR.Commenting.FunctionComment.ParamNameNoMatch"/>
1918
</rule>
2019
</ruleset>

phpmd.xml

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,39 @@
1-
<ruleset xmlns="http://pmd.sf.net/ruleset/1.0.0"
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset name="PHPMD rule set"
3+
xmlns="http://pmd.sf.net/ruleset/1.0.0"
24
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
35
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
46
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
57
<!--codesize-->
6-
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
7-
<rule ref="rulesets/codesize.xml/NPathComplexity" />
8-
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" />
9-
<rule ref="rulesets/codesize.xml/ExcessiveClassLength" />
10-
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
11-
<rule ref="rulesets/codesize.xml/ExcessiveParameterList" />
12-
<rule ref="rulesets/codesize.xml/ExcessivePublicCount" />
13-
<rule ref="rulesets/codesize.xml/TooManyFields" />
14-
<rule ref="rulesets/codesize.xml/TooManyMethods" />
8+
<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>
9+
<rule ref="rulesets/codesize.xml/NPathComplexity"/>
10+
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity"/>
11+
<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>
12+
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>
13+
<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>
14+
<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>
15+
<rule ref="rulesets/codesize.xml/TooManyFields"/>
16+
<rule ref="rulesets/codesize.xml/TooManyMethods"/>
1517
<!--design-->
16-
<rule ref="rulesets/design.xml/EvalExpression" />
17-
<rule ref="rulesets/design.xml/ExitExpression" />
18+
<rule ref="rulesets/design.xml/EvalExpression"/>
19+
<rule ref="rulesets/design.xml/ExitExpression"/>
1820
<rule ref="rulesets/design.xml/GotoStatement" />
19-
<rule ref="rulesets/design.xml/NumberOfChildren" />
20-
<rule ref="rulesets/design.xml/DepthOfInheritance" />
21-
<rule ref="rulesets/design.xml/CouplingBetweenObjects" />
21+
<rule ref="rulesets/design.xml/NumberOfChildren"/>
22+
<rule ref="rulesets/design.xml/DepthOfInheritance"/>
23+
<!-- <rule ref="rulesets/design.xml/CouplingBetweenObjects" /> -->
2224
<!--naming-->
23-
<rule ref="rulesets/naming.xml/ConstantNamingConventions" />
24-
<rule ref="rulesets/naming.xml/BooleanGetMethodName" />
25+
<rule ref="rulesets/naming.xml/ConstantNamingConventions"/>
26+
<rule ref="rulesets/naming.xml/BooleanGetMethodName"/>
2527
<!--unusedcode-->
26-
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
27-
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" />
28-
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
29-
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
28+
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>
29+
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
30+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
31+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
3032
<!--controversial-->
31-
<rule ref="rulesets/controversial.xml/Superglobals" />
32-
<rule ref="rulesets/controversial.xml/CamelCaseClassName" />
33-
<rule ref="rulesets/controversial.xml/CamelCasePropertyName" />
34-
<rule ref="rulesets/controversial.xml/CamelCaseMethodName" />
35-
<rule ref="rulesets/controversial.xml/CamelCaseParameterName" />
36-
<rule ref="rulesets/controversial.xml/CamelCaseVariableName" />
33+
<rule ref="rulesets/controversial.xml/CamelCaseClassName"/>
34+
<rule ref="rulesets/controversial.xml/CamelCasePropertyName"/>
35+
<rule ref="rulesets/controversial.xml/CamelCaseMethodName"/>
3736
<!--cleancode-->
38-
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag" />
39-
<rule ref="rulesets/cleancode.xml/ElseExpression" />
37+
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag"/>
38+
<rule ref="rulesets/cleancode.xml/ElseExpression" />
4039
</ruleset>

phpunit.xml.dist

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
<phpunit bootstrap="tests/bootstrap.php">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="tests/bootstrap.php">
25
<testsuites>
3-
<testsuite>
4-
<directory>./tests</directory>
6+
<testsuite name="all">
7+
<directory>tests</directory>
58
</testsuite>
69
</testsuites>
10+
<php>
11+
<ini name="error_reporting" value="-1" />
12+
</php>
713
<filter>
814
<whitelist processUncoveredFilesFromWhitelist="true">
9-
<directory suffix=".php">./src</directory>
15+
<directory suffix=".php">src</directory>
1016
</whitelist>
1117
</filter>
1218
</phpunit>

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<ignoreFiles>
1111
<directory name="src/Di" />
1212
<file name="src/SpyCompiler.php"></file>
13+
<file name="src/NewInstance.php"></file>
1314
</ignoreFiles>
1415
</projectFiles>
1516

src/Bind.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ private function isRegistered(string $interface) : bool
174174
*/
175175
private function getStringName(array $name) : string
176176
{
177-
$names = array_reduce(array_keys($name), function (array $carry, string $key) use ($name) : array {
178-
$carry[] .= $key . '=' . $name[$key];
177+
$names = array_reduce(array_keys($name), function (array $carry, $key) use ($name) : array {
178+
$carry[] .= $key . '=' . $name[(string) $key];
179179

180180
return $carry;
181181
}, []);

src/NewInstance.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function __construct(
4343
}
4444

4545
/**
46+
* @throws \ReflectionException
4647
* @return object
4748
*/
4849
public function __invoke(Container $container)

src/SpyCompiler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ final class SpyCompiler implements CompilerInterface
1212
/**
1313
* {@inheritdoc}
1414
*/
15-
public function newInstance($class, array $args, BindInterface $bind)
15+
public function newInstance(string $class, array $args, BindInterface $bind)
1616
{
1717
}
1818

1919
/**
2020
* {@inheritdoc}
2121
*/
22-
public function compile($class, BindInterface $bind) : string
22+
public function compile(string $class, BindInterface $bind) : string
2323
{
2424
if ($this->hasNoBinding($class, $bind)) {
2525
return $class;

0 commit comments

Comments
 (0)