Skip to content

Commit f1f92fe

Browse files
committed
Drop everything below PHP 8.1
1 parent d5cb925 commit f1f92fe

File tree

3 files changed

+13
-54
lines changed

3 files changed

+13
-54
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"type": "library",
55
"license": "LGPL-3.0",
66
"require": {
7-
"php": "^8.0",
7+
"php": "^8.1",
88
"php-64bit": "*"
99
},
1010
"require-dev": {
1111
"phpstan/phpstan": "~1.10.3",
1212
"phpstan/extension-installer": "^1.0",
1313
"phpstan/phpstan-strict-rules": "^1.0",
14-
"phpunit/phpunit": "^9.5 || ^10.0 || ^11.0"
14+
"phpunit/phpunit": "^10.0 || ^11.0"
1515
},
1616
"autoload": {
1717
"psr-4": {

tests/phpunit/FacingTest.php

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
namespace pocketmine\math;
2323

24+
use PHPUnit\Framework\Attributes\DataProvider;
2425
use PHPUnit\Framework\TestCase;
2526

2627
class FacingTest extends TestCase{
@@ -34,12 +35,7 @@ public static function axisProvider() : \Generator{
3435
yield [Facing::EAST, Axis::X];
3536
}
3637

37-
/**
38-
* @dataProvider axisProvider
39-
*
40-
* @param int $direction
41-
* @param int $axis
42-
*/
38+
#[DataProvider("axisProvider")]
4339
public function testAxis(int $direction, int $axis) : void{
4440
self::assertEquals($axis, Facing::axis($direction));
4541
}
@@ -50,12 +46,7 @@ public static function oppositeProvider() : \Generator{
5046
yield [Facing::WEST, Facing::EAST];
5147
}
5248

53-
/**
54-
* @dataProvider oppositeProvider
55-
*
56-
* @param int $dir1
57-
* @param int $dir2
58-
*/
49+
#[DataProvider("oppositeProvider")]
5950
public function testOpposite(int $dir1, int $dir2) : void{
6051
self::assertEquals($dir2, Facing::opposite($dir1));
6152
self::assertEquals($dir1, Facing::opposite($dir2));
@@ -70,12 +61,7 @@ public static function positiveProvider() : \Generator{
7061
yield [Facing::EAST, true];
7162
}
7263

73-
/**
74-
* @dataProvider positiveProvider
75-
*
76-
* @param int $facing
77-
* @param bool $positive
78-
*/
64+
#[DataProvider("positiveProvider")]
7965
public function testIsPositive(int $facing, bool $positive) : void{
8066
self::assertEquals($positive, Facing::isPositive($facing));
8167
}
@@ -114,14 +100,7 @@ public static function rotateProvider() : \Generator{
114100
yield [Facing::NORTH, Axis::X, false, Facing::UP];
115101
}
116102

117-
/**
118-
* @dataProvider rotateProvider
119-
*
120-
* @param int $direction
121-
* @param int $axis
122-
* @param bool $clockwise
123-
* @param int $expected
124-
*/
103+
#[DataProvider("rotateProvider")]
125104
public function testRotate(int $direction, int $axis, bool $clockwise, int $expected) : void{
126105
self::assertEquals($expected, Facing::rotate($direction, $axis, $clockwise));
127106
}

tests/phpunit/Vector3Test.php

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
namespace pocketmine\math;
2323

24+
use PHPUnit\Framework\Attributes\DataProvider;
2425
use PHPUnit\Framework\TestCase;
2526

2627
class Vector3Test extends TestCase{
@@ -52,14 +53,7 @@ public static function minComponentsProvider() : \Generator{
5253
];
5354
}
5455

55-
/**
56-
* @dataProvider minComponentsProvider
57-
*
58-
* @param Vector3 $vec1
59-
* @param Vector3 $vec2
60-
* @param Vector3 $vec3
61-
* @param Vector3 $expected
62-
*/
56+
#[DataProvider("minComponentsProvider")]
6357
public function testMinComponents(Vector3 $vec1, Vector3 $vec2, Vector3 $vec3, Vector3 $expected) : void{
6458
self::assertEquals(Vector3::minComponents($vec1, $vec2, $vec3), $expected);
6559
}
@@ -91,14 +85,7 @@ public static function maxComponentsProvider() : \Generator{
9185
];
9286
}
9387

94-
/**
95-
* @dataProvider maxComponentsProvider
96-
*
97-
* @param Vector3 $vec1
98-
* @param Vector3 $vec2
99-
* @param Vector3 $vec3
100-
* @param Vector3 $expected
101-
*/
88+
#[DataProvider("maxComponentsProvider")]
10289
public function testMaxComponents(Vector3 $vec1, Vector3 $vec2, Vector3 $vec3, Vector3 $expected) : void{
10390
self::assertEquals(Vector3::maxComponents($vec1, $vec2, $vec3), $expected);
10491
}
@@ -115,10 +102,9 @@ public static function sumProvider() : \Generator{
115102
}
116103

117104
/**
118-
* @dataProvider sumProvider
119-
*
120105
* @param Vector3[] $vectors
121106
*/
107+
#[DataProvider("sumProvider")]
122108
public function testSum(array $vectors) : void{
123109
$vec = new Vector3(0, 0, 0);
124110
foreach($vectors as $vector){
@@ -141,14 +127,8 @@ public static function withComponentsProvider() : \Generator{
141127
yield [new Vector3(0, 0, 0), null, null, null, new Vector3(0, 0, 0)];
142128
}
143129

144-
/**
145-
* @dataProvider withComponentsProvider
146-
*
147-
* @param float|int|null $x
148-
* @param float|int|null $y
149-
* @param float|int|null $z
150-
*/
151-
public function testWithComponents(Vector3 $original, $x, $y, $z, Vector3 $expected) : void{
130+
#[DataProvider("withComponentsProvider")]
131+
public function testWithComponents(Vector3 $original, float|int|null $x, float|int|null $y, float|int|null $z, Vector3 $expected) : void{
152132
$actual = $original->withComponents($x, $y, $z);
153133
self::assertTrue($actual->equals($expected));
154134
}

0 commit comments

Comments
 (0)