Skip to content

Test on PHP 8 #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ sudo: false
jobs:
include:
- php: 7.4
env: PREFER_LOWEST=""
env: COMPOSER_ARG=""
before_script:
- &composerupdate
composer update --no-interaction --no-progress --optimize-autoloader $PREFER_LOWEST
composer update --no-interaction --no-progress --optimize-autoloader $COMPOSER_ARG
script:
- &phpunit
"./vendor/bin/phpunit"
Expand All @@ -15,13 +15,19 @@ jobs:
after_script:
- travis_retry php vendor/bin/php-coveralls -v
- php: 7.1
env: PREFER_LOWEST=""
env: COMPOSER_ARG=""
before_script:
- *composerupdate
script:
- *phpunit
- php: 7.1
env: PREFER_LOWEST="--prefer-lowest"
env: COMPOSER_ARG="--prefer-lowest"
before_script:
- *composerupdate
script:
- *phpunit
- php: nightly
env: COMPOSER_ARG="--ignore-platform-reqs"
before_script:
- *composerupdate
script:
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/CallMethodRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testSafePregReplace()
{
// FIXME: this rule actually runs code but will always return no error because the rule executed is not the correct one.
// This provides code coverage but assert is not ok.
$this->analyse([__DIR__ . '/data/safe_pregreplace.php'], []);
@$this->analyse([__DIR__ . '/data/safe_pregreplace.php'], []);
}


Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/UseSafeClassesRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protected function getRule(): \PHPStan\Rules\Rule

public function testDateTime()
{
$this->analyse([__DIR__ . '/data/datetime.php'], [
@$this->analyse([__DIR__ . '/data/datetime.php'], [
[
"Class DateTime is unsafe to use. Its methods can return FALSE instead of throwing an exception. Please add 'use Safe\DateTime;' at the beginning of the file to use the variant provided by the 'thecodingmachine/safe' library.",
3,
Expand Down
10 changes: 5 additions & 5 deletions tests/Rules/UseSafeFunctionsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protected function getRule(): \PHPStan\Rules\Rule

public function testCatch()
{
$this->analyse([__DIR__ . '/data/fopen.php'], [
@$this->analyse([__DIR__ . '/data/fopen.php'], [
[
"Function fopen is unsafe to use. It can return FALSE instead of throwing an exception. Please add 'use function Safe\\fopen;' at the beginning of the file to use the variant provided by the 'thecodingmachine/safe' library.",
4,
Expand All @@ -24,18 +24,18 @@ public function testCatch()

public function testNoCatchSafe()
{
$this->analyse([__DIR__ . '/data/safe_fopen.php'], []);
@$this->analyse([__DIR__ . '/data/safe_fopen.php'], []);
}

public function testExprCall()
{
$this->analyse([__DIR__ . '/data/undirect_call.php'], []);
@$this->analyse([__DIR__ . '/data/undirect_call.php'], []);
}

public function testJSONDecodeNoCatchSafe()
{
if (version_compare(PHP_VERSION, '7.3.0', '>=')) {
$this->analyse([__DIR__ . '/data/safe_json_decode_for_7.3.0.php'], []);
@$this->analyse([__DIR__ . '/data/safe_json_decode_for_7.3.0.php'], []);
} else {
$this->assertTrue(true);
}
Expand All @@ -44,7 +44,7 @@ public function testJSONDecodeNoCatchSafe()
public function testJSONEncodeNoCatchSafe()
{
if (version_compare(PHP_VERSION, '7.3.0', '>=')) {
$this->analyse([__DIR__ . '/data/safe_json_encode_for_7.3.0.php'], []);
@$this->analyse([__DIR__ . '/data/safe_json_encode_for_7.3.0.php'], []);
} else {
$this->assertTrue(true);
}
Expand Down