Skip to content

Commit aaa61d5

Browse files
committed
Add generics to BaseRack and its children
1 parent 3b6a13a commit aaa61d5

File tree

12 files changed

+62
-6
lines changed

12 files changed

+62
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ See [GitHub releases](https://github.com/mll-lab/php-utils/releases).
99

1010
## Unreleased
1111

12+
## v4.1.0
13+
14+
### Added
15+
16+
- Add generics to `BaseRack` and its children
17+
1218
## v4.0.0
1319

1420
### Added

src/Tecan/Rack/AlublockA.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
/**
6+
* @template TContent
7+
*
8+
* @extends BaseRack<TContent>
9+
*/
510
class AlublockA extends BaseRack
611
{
712
public function type(): string

src/Tecan/Rack/BaseRack.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
use Illuminate\Support\Collection;
66

7+
/** @template TContent */
78
abstract class BaseRack implements Rack
89
{
910
public const EMPTY_POSITION = null;
1011

11-
/** @var Collection<int, mixed> */
12+
/** @var Collection<int, TContent|null> */
1213
public Collection $positions;
1314

1415
public function __construct()
@@ -31,13 +32,13 @@ public function toString(): string
3132
]);
3233
}
3334

34-
/** @param mixed $content Anything goes, null is considered empty */
35+
/** @param TContent|null $content Anything goes, null is considered empty */
3536
public function assignFirstEmptyPosition($content): int
3637
{
3738
return $this->assignPosition($content, $this->findFirstEmptyPosition());
3839
}
3940

40-
/** @param mixed $content Anything goes, null is considered empty */
41+
/** @param TContent|null $content Anything goes, null is considered empty */
4142
public function assignLastEmptyPosition($content): int
4243
{
4344
return $this->assignPosition($content, $this->findLastEmptyPosition());
@@ -71,7 +72,7 @@ public function findLastEmptyPosition(): int
7172
return $lastEmpty;
7273
}
7374

74-
/** @param mixed $content Anything goes, null is considered empty */
75+
/** @param TContent|null $content Anything goes, null is considered empty */
7576
public function assignPosition($content, int $position): int
7677
{
7778
if (! $this->positions->has($position)) {

src/Tecan/Rack/DestLC.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
/**
6+
* @template TContent
7+
*
8+
* @extends BaseRack<TContent>
9+
*/
510
class DestLC extends BaseRack
611
{
712
public function type(): string

src/Tecan/Rack/DestPCR.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
/**
6+
* @template TContent
7+
*
8+
* @extends BaseRack<TContent>
9+
*/
510
class DestPCR extends BaseRack
611
{
712
public function type(): string

src/Tecan/Rack/DestTaqMan.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
/**
6+
* @template TContent
7+
*
8+
* @extends BaseRack<TContent>
9+
*/
510
class DestTaqMan extends BaseRack
611
{
712
public function type(): string

src/Tecan/Rack/FluidXRack.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
/**
6+
* @template TContent
7+
*
8+
* @extends BaseRack<TContent>
9+
*/
510
class FluidXRack extends BaseRack implements ScannedRack
611
{
712
public function type(): string

src/Tecan/Rack/MPCDNA.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
/**
6+
* @template TContent
7+
*
8+
* @extends BaseRack<TContent>
9+
*/
510
class MPCDNA extends BaseRack
611
{
712
public function type(): string

src/Tecan/Rack/MPSample.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
/**
6+
* @template TContent
7+
*
8+
* @extends BaseRack<TContent>
9+
*/
510
class MPSample extends BaseRack
611
{
712
public function type(): string

src/Tecan/Rack/MPWater.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
/**
6+
* @template TContent
7+
*
8+
* @extends BaseRack<TContent>
9+
*/
510
class MPWater extends BaseRack
611
{
712
public function type(): string

0 commit comments

Comments
 (0)