Skip to content

Commit 106a6a4

Browse files
committed
Fix PSalm errors
1 parent 03de968 commit 106a6a4

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

.run/PSalm.run.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="PSalm" type="PhpLocalRunConfigurationType" factoryName="PHP Console" path="$PROJECT_DIR$/vendor/bin/psalm">
3+
<method v="2" />
4+
</configuration>
5+
</component>

.run/Test Project.run.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Test Project" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
3+
<TestRunner configuration_file="$PROJECT_DIR$/phpunit.xml.dist" scope="XML" use_alternative_configuration_file="true" />
4+
<method v="2" />
5+
</configuration>
6+
</component>

src/AnyDataset.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,13 @@ public function save(?string $filename = null): void
175175
*/
176176
public function appendRow(Row|array $singleRow = []): void
177177
{
178-
if (!empty($singleRow)) {
179-
if ($singleRow instanceof Row) {
180-
$this->collection[] = $singleRow;
181-
$singleRow->acceptChanges();
182-
} elseif (is_array($singleRow)) {
183-
$this->collection[] = new Row($singleRow);
184-
} else {
185-
throw new InvalidArgumentException("You must pass an array or a Row object");
186-
}
187-
} else {
178+
if (empty($singleRow)) {
188179
$singleRow = new Row();
189-
$this->collection[] = $singleRow;
190-
$singleRow->acceptChanges();
180+
} elseif (is_array($singleRow)) {
181+
$singleRow = new Row($singleRow);
191182
}
183+
184+
$this->collection[] = $singleRow;
192185
$this->currentRow = count($this->collection) - 1;
193186
}
194187

src/RowOutput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ protected function formatCustom(Row $row, string $field, Closure $closure): stri
9393
/**
9494
* @param string $field
9595
* @param string $pattern
96-
* @return RowOutput
96+
* @return static
9797
*/
9898
public function addFormat(string $field, string $pattern): static
9999
{
@@ -104,7 +104,7 @@ public function addFormat(string $field, string $pattern): static
104104
/**
105105
* @param string $field
106106
* @param Closure $closure
107-
* @return RowOutput
107+
* @return static
108108
*/
109109
public function addCustomFormat(string $field, Closure $closure): static
110110
{

0 commit comments

Comments
 (0)