Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Benedikt Franke <[email protected]>
  • Loading branch information
simbig and spawnia authored May 3, 2024
1 parent 7c974dc commit 3852ff6
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See [GitHub releases](https://github.com/mll-lab/php-utils/releases).

### Added

- Add support for creating Illumina NovaSeq Sample Sheets (V2) for NovaSeqX.
- Support creating Illumina NovaSeq Sample Sheets (V2) for NovaSeqX

## v1.13.0

Expand Down
7 changes: 6 additions & 1 deletion src/IlluminaSampleSheet/SampleSheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ public function addSection(SectionInterface $section): void

public function toString(): string
{
return implode("\n", array_map(fn (SectionInterface $section) => $section->convertSectionToString(), $this->sections));
$sectionStrings = array_map(
fn (SectionInterface $section): string => $section->convertSectionToString(),

Check failure on line 18 in src/IlluminaSampleSheet/SampleSheet.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

Call to method convertSectionToString() on an unknown class MLL\Utils\IlluminaSampleSheet\SectionInterface.

Check failure on line 18 in src/IlluminaSampleSheet/SampleSheet.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

Parameter $section of anonymous function has invalid type MLL\Utils\IlluminaSampleSheet\SectionInterface.
$this->sections
);

return implode("\n", $sectionStrings);
}

/** @return array<SectionInterface> */
Expand Down
2 changes: 1 addition & 1 deletion src/IlluminaSampleSheet/SectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace MLL\Utils\IlluminaSampleSheet;

interface SectionInterface
interface Section
{
public function convertSectionToString(): string;
}
2 changes: 1 addition & 1 deletion src/IlluminaSampleSheet/V2/BclConvert/BclSample.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BclSample

public function __construct(

Check failure on line 25 in src/IlluminaSampleSheet/V2/BclConvert/BclSample.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

Constructor of class MLL\Utils\IlluminaSampleSheet\V2\BclConvert\BclSample has an unused parameter $sampleID.
int $lane,
string $sampleId,
string $sampleID,
string $index
) {
$this->lane = $lane;
Expand Down
5 changes: 2 additions & 3 deletions src/IlluminaSampleSheet/V2/BclConvert/DataSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ class DataSection implements SectionInterface
/** @var array<BclSample> */
private array $dataRows = [];

public function addSample(
BclSample $bclSample
): void {
public function addSample(BclSample $bclSample): void
{
$this->dataRows[] = $bclSample;
}

Expand Down
2 changes: 1 addition & 1 deletion src/IlluminaSampleSheet/V2/HeaderSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function convertSectionToString(): string
{
$headerLines = [
'[Header]',
'FileFormatVersion,' . $this->fileFormatVersion,
"FileFormatVersion,{$this->fileFormatVersion}",
"RunName,{$this->runName}",
];
if (! is_null($this->runDescription)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/IlluminaSampleSheet/SampleSheetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use MLL\Utils\IlluminaSampleSheet\SectionInterface;
use PHPUnit\Framework\TestCase;

class SampleSheetTest extends TestCase
final class SampleSheetTest extends TestCase
{
public function testSampleSheetToStringReturnsCorrectFormat(): void
{
Expand Down
8 changes: 3 additions & 5 deletions tests/IlluminaSampleSheet/V2/NovaSeqXCloudSampleSheetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
use MLL\Utils\IlluminaSampleSheet\V2\ReadsSection;
use PHPUnit\Framework\TestCase;

class NovaSeqXCloudSampleSheetTest extends TestCase
final class NovaSeqXCloudSampleSheetTest extends TestCase
{
public function testNovaSeqXCloudSampleSheetToStringReturnsExpectedResult(): void
{
$headerSection = new HeaderSection(
'Run1',
);
$headerSection = new HeaderSection('Run1');
$headerSection->setInstrumentPlatform('NovaSeqXSeries');
$headerSection->setCustomParam('IndexOrientation', 'Orientation1');

Expand Down Expand Up @@ -88,6 +86,6 @@ public function testNovaSeqXCloudSampleSheetToStringReturnsExpectedResult(): voi
3,Sample3,Index5,Index6,Cycles3,Adapter5,Adapter6
';

self::assertEquals($expected, $novaSeqXCloudSampleSheet->toString());
self::assertSame($expected, $novaSeqXCloudSampleSheet->toString());
}
}

0 comments on commit 3852ff6

Please sign in to comment.