Skip to content

Commit

Permalink
Fix generic inference for `MLL\Utils\Microplate\Coordinates::fromPosi…
Browse files Browse the repository at this point in the history
…tion()`
  • Loading branch information
spawnia committed Sep 25, 2024
1 parent afe3783 commit e142060
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ See [GitHub releases](https://github.com/mll-lab/php-utils/releases).

## Unreleased

## v5.5.1

### Fixed

- Fix generic inference for `MLL\Utils\Microplate\Coordinates::fromPosition()`

## v5.5.0

### Added
Expand Down
6 changes: 4 additions & 2 deletions src/Microplate/Coordinates.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ public static function fromString(string $coordinatesString, CoordinateSystem $c
}

/**
* @param TCoordinateSystem $coordinateSystem
* @template TCoord of CoordinateSystem
*
* @param TCoord $coordinateSystem
*
* @return static<TCoordinateSystem>
* @return static<TCoord>
*/
public static function fromPosition(int $position, FlowDirection $direction, CoordinateSystem $coordinateSystem): self
{
Expand Down
1 change: 0 additions & 1 deletion src/Microplate/MicroplateSet/MicroplateSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function locationFromPosition(int $setPosition, FlowDirection $direction)
$plateIndex = (int) floor(($setPosition - 1) / $this->coordinateSystem->positionsCount());
$positionOnSinglePlate = $setPosition - ($plateIndex * $this->coordinateSystem->positionsCount());

/** @phpstan-ignore-next-line Generic inference is too weak to recognize this code is correct */
return new Location(
Coordinates::fromPosition($positionOnSinglePlate, $direction, $this->coordinateSystem),
$this->plateIDs()[$plateIndex]
Expand Down

0 comments on commit e142060

Please sign in to comment.