Skip to content

Commit 5455cb3

Browse files
Drop support for PHP 5 and add support for PHP 8.1 (#59)
1 parent 994eccc commit 5455cb3

File tree

12 files changed

+29
-62
lines changed

12 files changed

+29
-62
lines changed

.github/workflows/static.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ jobs:
9999
command: composer bin psalm update --no-interaction --no-progress
100100

101101
- name: Execute Psalm
102-
run: vendor/bin/psalm --no-progress --output-format=github
102+
run: vendor/bin/psalm.phar --no-progress --output-format=github

.github/workflows/tests.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
14+
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
1515

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

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

38-
- name: Setup PHP 8 Dependencies
34+
- name: Install PHP Dependencies
3935
uses: nick-invision/retry@v1
4036
with:
4137
timeout_minutes: 5
4238
max_attempts: 5
43-
command: composer require "phpunit/phpunit:^9.3" --no-interaction --no-update
44-
if: "matrix.php >= 8"
45-
46-
- name: Install PHP 8 Dependencies
47-
uses: nick-invision/retry@v1
48-
with:
49-
timeout_minutes: 5
50-
max_attempts: 5
51-
command: composer update --no-interaction --no-progress --ignore-platform-reqs
52-
if: "matrix.php >= 8"
39+
command: composer update --no-interaction --no-progress
5340

5441
- name: Execute PHPUnit
5542
run: vendor/bin/phpunit

.travis.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ phpstan-analyze-tests:
1212
@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
1313

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

1717
psalm-show-info:
18-
@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
18+
@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
1919

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

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
},
1111
{
1212
"name": "Graham Campbell",
13-
"email": "[email protected]"
13+
"email": "[email protected]"
1414
}
1515
],
1616
"require": {
17-
"php": "^5.5.9 || ^7.0 || ^8.0"
17+
"php": "^7.0 || ^8.0"
1818
},
1919
"require-dev": {
2020
"bamarni/composer-bin-plugin": "^1.4.1",
21-
"phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0 || ^8.0 || ^9.0"
21+
"phpunit/phpunit": "^6.5.14 || ^7.0.20 || ^8.5.19 || ^9.5.8"
2222
},
2323
"autoload": {
2424
"psr-4": {
@@ -35,7 +35,7 @@
3535
},
3636
"extra": {
3737
"branch-alias": {
38-
"dev-master": "1.7-dev"
38+
"dev-master": "1.8-dev"
3939
}
4040
},
4141
"minimum-stability": "dev",

phpstan.src.neon.dist

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
parameters:
22
level: max
3+
checkGenericClassInNonGenericObjectType: false
34
ignoreErrors:
45
-
56
message: "#^Method PhpOption\\\\Option\\:\\:fromReturn\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#"
67
count: 1
78
path: src/PhpOption/Option.php
8-
9-
-
10-
message: "#^Method PhpOption\\\\Option\\:\\:ensure\\(\\) should return PhpOption\\\\Option\\<S\\> but returns PhpOption\\\\Option\\<S\\|null\\>\\.$#"
11-
count: 1
12-
path: src/PhpOption/Option.php

phpstan.tests.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ parameters:
3232
path: tests/PhpOption/Tests/NoneTest.php
3333

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

src/PhpOption/LazyOption.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class LazyOption extends Option
4141
*
4242
* @return LazyOption<S>
4343
*/
44-
public static function create($callback, array $arguments = [])
44+
public static function create($callback, array $arguments = []): self
4545
{
4646
return new self($callback, $arguments);
4747
}
@@ -60,12 +60,12 @@ public function __construct($callback, array $arguments = [])
6060
$this->arguments = $arguments;
6161
}
6262

63-
public function isDefined()
63+
public function isDefined(): bool
6464
{
6565
return $this->option()->isDefined();
6666
}
6767

68-
public function isEmpty()
68+
public function isEmpty(): bool
6969
{
7070
return $this->option()->isEmpty();
7171
}
@@ -153,7 +153,7 @@ public function foldRight($initialValue, $callable)
153153
/**
154154
* @return Option<T>
155155
*/
156-
private function option()
156+
private function option(): Option
157157
{
158158
if (null === $this->option) {
159159
/** @var mixed */

src/PhpOption/None.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class None extends Option
3131
/**
3232
* @return None
3333
*/
34-
public static function create()
34+
public static function create(): self
3535
{
3636
if (null === self::$instance) {
3737
self::$instance = new self();
@@ -60,12 +60,12 @@ public function getOrThrow(\Exception $ex)
6060
throw $ex;
6161
}
6262

63-
public function isEmpty()
63+
public function isEmpty(): bool
6464
{
6565
return true;
6666
}
6767

68-
public function isDefined()
68+
public function isDefined(): bool
6969
{
7070
return false;
7171
}
@@ -115,7 +115,7 @@ public function reject($value)
115115
return $this;
116116
}
117117

118-
public function getIterator()
118+
public function getIterator(): EmptyIterator
119119
{
120120
return new EmptyIterator();
121121
}

src/PhpOption/Some.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ public function __construct($value)
4545
*
4646
* @return Some<U>
4747
*/
48-
public static function create($value)
48+
public static function create($value): self
4949
{
5050
return new self($value);
5151
}
5252

53-
public function isDefined()
53+
public function isDefined(): bool
5454
{
5555
return true;
5656
}
5757

58-
public function isEmpty()
58+
public function isEmpty(): bool
5959
{
6060
return false;
6161
}
@@ -149,7 +149,7 @@ public function reject($value)
149149
return $this;
150150
}
151151

152-
public function getIterator()
152+
public function getIterator(): ArrayIterator
153153
{
154154
return new ArrayIterator([$this->value]);
155155
}

0 commit comments

Comments
 (0)