Skip to content

Commit

Permalink
bumping php versions, composer deps, fixing phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydiablo committed Feb 19, 2019
1 parent f1059b9 commit b354b13
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 23 deletions.
37 changes: 26 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@ language: php

sudo: false

php:
- 7
- 7.1
- 7.2
- nightly

env: TMPDIR=/tmp USE_XDEBUG=false
env:
global:
- COMPOSER_ARGS="" TMPDIR=/tmp USE_XDEBUG=false

branches:
only:
master

install:
- phpenv rehash
- travis_retry composer install --no-interaction --prefer-source
- travis_retry composer update --no-interaction --prefer-source $COMPOSER_ARGS

stages:
- test
Expand All @@ -33,20 +29,39 @@ script:
jobs:
fast_finish: true
allow_failures:
- php: 7.4snapshot
- php: nightly
include:
- php: 7.1
env: COMPOSER_ARGS="--prefer-lowest"
- php: 7.1
- php: 7.2
env: COMPOSER_ARGS="--prefer-lowest"
- php: 7.2
- php: 7.3
env: COMPOSER_ARGS="--prefer-lowest"
- php: 7.3
- php: 7.4snapshot
env: COMPOSER_ARGS="--ignore-platform-reqs --prefer-lowest"
- php: 7.4snapshot
env: COMPOSER_ARGS="--ignore-platform-reqs"
- php: nightly
env: COMPOSER_ARGS="--ignore-platform-reqs --prefer-lowest"
- php: nightly
env: COMPOSER_ARGS="--ignore-platform-reqs"

- stage: style check
php: 7.1
php: 7.2
env: TMPDIR=/tmp USE_XDEBUG=false
script:
- composer style-check
- stage: phpstan analysis
php: 7.1
php: 7.2
env: TMPDIR=/tmp USE_XDEBUG=false
script:
- composer phpstan
- stage: test with coverage
php: 7.1
php: 7.2
env: TMPDIR=/tmp USE_XDEBUG=true CC_TEST_REPORTER_ID=7689cf4ed165a2a7bbbcac8f02773734883ae19de17b489d815d817506f29bb0
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
}
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"phpstan/phpstan": "^0.9.2",
"phpunit/phpunit": "^7.0",
"phpstan/phpstan": "^0.11.2",
"friendsofphp/php-cs-fixer": "^2.11",
"maglnet/composer-require-checker": "^0.1.6 | ^0.2.1",
"maglnet/composer-require-checker": "^1.1.0",
"phpro/grumphp": "^0.14.0"
},
"include-path": [
Expand All @@ -44,7 +44,7 @@
"scripts": {
"test": "phpunit",
"test-with-coverage": "phpunit --coverage-clover=clover.xml",
"phpstan": "phpstan analyze -l6 -c phpstan.neon --no-progress ./ --ansi",
"phpstan": "phpstan analyze -c phpstan.neon --no-progress --ansi",
"style-check": "php-cs-fixer fix --dry-run -vv"
}
}
1 change: 0 additions & 1 deletion grumphp.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ parameters:
allow_risky: true
config: .php_cs
phpstan:
level: 6
configuration: phpstan.neon
phpunit:
metadata:
Expand Down
7 changes: 6 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
parameters:
level: 6
paths:
- ./
excludes_analyse:
- %rootDir%/../../../vendor/*
- %rootDir%/../../../tests/*
ignoreErrors:
- '#Casting to .+ something that.s already .+\.#'
- '#Method Zend_Filter_Input::_getFilter\(\) should return Zend_Filter_Interface but returns Zend_Filter_Interface\|Zend_Validate_Interface\.#'
- '#Method Zend_Filter_Input::_getValidator\(\) should return Zend_Validate_Interface but returns Zend_Filter_Interface\|Zend_Validate_Interface\.#'
-
message: '#Method Zend_Filter_Input::_getFilterOrValidator\(\) should return Zend_Filter_Interface\|Zend_Validate_Interface but returns object\.#'
path: %currentWorkingDirectory%/src/Zend/Filter/Input.php
11 changes: 7 additions & 4 deletions src/Zend/Filter/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,8 @@ public function setOptions(array $options)

foreach ($value as $prefix) {
$this->addValidatorPrefixPath(
$prefix,
str_replace('_', DIRECTORY_SEPARATOR, $prefix)
$prefix,
str_replace('_', DIRECTORY_SEPARATOR, $prefix)
);
}
break;
Expand All @@ -526,8 +526,8 @@ public function setOptions(array $options)

foreach ($value as $prefix) {
$this->addFilterPrefixPath(
$prefix,
str_replace('_', DIRECTORY_SEPARATOR, $prefix)
$prefix,
str_replace('_', DIRECTORY_SEPARATOR, $prefix)
);
}
break;
Expand Down Expand Up @@ -726,7 +726,9 @@ protected function _getMissingMessage($rule, $field)
}

$message = str_replace('%rule%', $rule, $message);
/** @var string $message */
$message = str_replace('%field%', $field, $message);

return $message;
}

Expand All @@ -746,6 +748,7 @@ protected function _getNotEmptyMessage($rule, $field)
}

$message = str_replace('%rule%', $rule, $message);
/** @var string $message */
$message = str_replace('%field%', $field, $message);
return $message;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Zend/Filter/InputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -681,13 +681,13 @@ public function testValidatorMultiFieldAllowEmptyProcessing()
$this->assertEquals(array('rule2', 'rule3'), array_keys($messages));
$this->assertEquals(
array('isEmpty' => "You must give a non-empty value for field 'password3'"),
$messages['rule2']
$messages['rule2']
);
$this->assertEquals(
array('isEmpty' => "You must give a non-empty value for field 'password3'",
0 => "You must give a non-empty value for field 'password4'"
),
$messages['rule3']
$messages['rule3']
);
}

Expand Down

0 comments on commit b354b13

Please sign in to comment.