Skip to content

Commit

Permalink
Drop support for PHP 5 and add support for PHP 8.1 (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell authored Aug 28, 2021
1 parent 994eccc commit 5455cb3
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ jobs:
command: composer bin psalm update --no-interaction --no-progress

- name: Execute Psalm
run: vendor/bin/psalm --no-progress --output-format=github
run: vendor/bin/psalm.phar --no-progress --output-format=github
25 changes: 6 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']

steps:
- name: Checkout Code
Expand All @@ -27,29 +27,16 @@ jobs:
- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install PHP 5/7 Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress
if: "matrix.php < 8"
- name: Mimic PHP 8.0
run: composer config platform.php 8.0.999
if: matrix.php > 8

- name: Setup PHP 8 Dependencies
- name: Install PHP Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer require "phpunit/phpunit:^9.3" --no-interaction --no-update
if: "matrix.php >= 8"

- name: Install PHP 8 Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress --ignore-platform-reqs
if: "matrix.php >= 8"
command: composer update --no-interaction --no-progress

- name: Execute PHPUnit
run: vendor/bin/phpunit
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ phpstan-analyze-tests:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze tests -c phpstan.tests.neon.dist

psalm-analyze:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm --rm registry.gitlab.com/grahamcampbell/php:7.4-cli
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:7.4-cli

psalm-show-info:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm --rm registry.gitlab.com/grahamcampbell/php:7.4-cli --show-info=true
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm .phar--rm registry.gitlab.com/grahamcampbell/php:7.4-cli --show-info=true

test: phpunit phpstan-analyze-src phpstan-analyze-tests psalm-analyze

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
},
{
"name": "Graham Campbell",
"email": "[email protected]"
"email": "[email protected]"
}
],
"require": {
"php": "^5.5.9 || ^7.0 || ^8.0"
"php": "^7.0 || ^8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0 || ^8.0 || ^9.0"
"phpunit/phpunit": "^6.5.14 || ^7.0.20 || ^8.5.19 || ^9.5.8"
},
"autoload": {
"psr-4": {
Expand All @@ -35,7 +35,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.7-dev"
"dev-master": "1.8-dev"
}
},
"minimum-stability": "dev",
Expand Down
6 changes: 1 addition & 5 deletions phpstan.src.neon.dist
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
parameters:
level: max
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
-
message: "#^Method PhpOption\\\\Option\\:\\:fromReturn\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#"
count: 1
path: src/PhpOption/Option.php

-
message: "#^Method PhpOption\\\\Option\\:\\:ensure\\(\\) should return PhpOption\\\\Option\\<S\\> but returns PhpOption\\\\Option\\<S\\|null\\>\\.$#"
count: 1
path: src/PhpOption/Option.php
2 changes: 1 addition & 1 deletion phpstan.tests.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ parameters:
path: tests/PhpOption/Tests/NoneTest.php

-
message: "#^Parameter \\#1 \\$array of static method PhpOption\\\\Option\\<mixed\\>\\:\\:fromArraysValue\\(\\) expects array\\<int\\|string, mixed\\>\\|ArrayAccess\\<int\\|string, mixed\\>\\|null, string given\\.$#"
message: "#^Parameter \\#1 \\$array of static method PhpOption\\\\Option\\<mixed\\>\\:\\:fromArraysValue\\(\\) expects array\\<int\\|string, mixed\\>\\|ArrayAccess\\<int\\|string, mixed\\>\\|null, 'foo' given\\.$#"
count: 1
path: tests/PhpOption/Tests/OptionTest.php

Expand Down
8 changes: 4 additions & 4 deletions src/PhpOption/LazyOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class LazyOption extends Option
*
* @return LazyOption<S>
*/
public static function create($callback, array $arguments = [])
public static function create($callback, array $arguments = []): self
{
return new self($callback, $arguments);
}
Expand All @@ -60,12 +60,12 @@ public function __construct($callback, array $arguments = [])
$this->arguments = $arguments;
}

public function isDefined()
public function isDefined(): bool
{
return $this->option()->isDefined();
}

public function isEmpty()
public function isEmpty(): bool
{
return $this->option()->isEmpty();
}
Expand Down Expand Up @@ -153,7 +153,7 @@ public function foldRight($initialValue, $callable)
/**
* @return Option<T>
*/
private function option()
private function option(): Option
{
if (null === $this->option) {
/** @var mixed */
Expand Down
8 changes: 4 additions & 4 deletions src/PhpOption/None.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class None extends Option
/**
* @return None
*/
public static function create()
public static function create(): self
{
if (null === self::$instance) {
self::$instance = new self();
Expand Down Expand Up @@ -60,12 +60,12 @@ public function getOrThrow(\Exception $ex)
throw $ex;
}

public function isEmpty()
public function isEmpty(): bool
{
return true;
}

public function isDefined()
public function isDefined(): bool
{
return false;
}
Expand Down Expand Up @@ -115,7 +115,7 @@ public function reject($value)
return $this;
}

public function getIterator()
public function getIterator(): EmptyIterator
{
return new EmptyIterator();
}
Expand Down
8 changes: 4 additions & 4 deletions src/PhpOption/Some.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ public function __construct($value)
*
* @return Some<U>
*/
public static function create($value)
public static function create($value): self
{
return new self($value);
}

public function isDefined()
public function isDefined(): bool
{
return true;
}

public function isEmpty()
public function isEmpty(): bool
{
return false;
}
Expand Down Expand Up @@ -149,7 +149,7 @@ public function reject($value)
return $this;
}

public function getIterator()
public function getIterator(): ArrayIterator
{
return new ArrayIterator([$this->value]);
}
Expand Down
2 changes: 1 addition & 1 deletion vendor-bin/phpstan/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"phpstan/phpstan": "~0.12.33"
"phpstan/phpstan": "~0.12.96"
},
"config": {
"preferred-install": "dist"
Expand Down
2 changes: 1 addition & 1 deletion vendor-bin/psalm/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"vimeo/psalm": "~3.12.2"
"psalm/phar": "~4.9.3"
},
"config": {
"preferred-install": "dist"
Expand Down

0 comments on commit 5455cb3

Please sign in to comment.