Skip to content

Commit f1ee1fe

Browse files
committed
Use typed properties wherever possible
1 parent 74a16af commit f1ee1fe

File tree

4 files changed

+15
-28
lines changed

4 files changed

+15
-28
lines changed

src/AxisAlignedBB.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,14 @@
2626
use function abs;
2727
use const PHP_INT_MAX;
2828

29-
class AxisAlignedBB{
30-
31-
/** @var float */
32-
public $minX;
33-
/** @var float */
34-
public $minY;
35-
/** @var float */
36-
public $minZ;
37-
/** @var float */
38-
public $maxX;
39-
/** @var float */
40-
public $maxY;
41-
/** @var float */
42-
public $maxZ;
29+
final class AxisAlignedBB{
30+
31+
public float $minX;
32+
public float $minY;
33+
public float $minZ;
34+
public float $maxX;
35+
public float $maxY;
36+
public float $maxZ;
4337

4438
public function __construct(float $minX, float $minY, float $minZ, float $maxX, float $maxY, float $maxZ){
4539
if($minX > $maxX){

src/Matrix.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@
3333
class Matrix implements \ArrayAccess{
3434
/** @var float[][] */
3535
private array $matrix = [];
36-
/** @var int */
37-
private $rows;
38-
/** @var int */
39-
private $columns;
36+
private int $rows;
37+
private int $columns;
4038

4139
public function offsetExists($offset){
4240
return isset($this->matrix[(int) $offset]);

src/RayTraceResult.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,9 @@
2828
*/
2929
class RayTraceResult{
3030

31-
/** @var AxisAlignedBB */
32-
public $bb;
33-
/** @var int */
34-
public $hitFace;
35-
/** @var Vector3 */
36-
public $hitVector;
31+
public AxisAlignedBB $bb;
32+
public int $hitFace;
33+
public Vector3 $hitVector;
3734

3835
/**
3936
* @param int $hitFace one of the Facing::* constants

src/Vector2.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@
3030
use function sqrt;
3131

3232
class Vector2{
33-
/** @var float */
34-
public $x;
35-
/** @var float */
36-
public $y;
33+
public float $x;
34+
public float $y;
3735

3836
public function __construct(float $x, float $y){
3937
$this->x = $x;

0 commit comments

Comments
 (0)