Skip to content

Commit cc81824

Browse files
authored
Merge pull request #22 from always-open/chore/fixing-psalm
Fixing psalm errors
2 parents 03ecdd5 + 2341b91 commit cc81824

File tree

7 files changed

+15
-16
lines changed

7 files changed

+15
-16
lines changed

psalm.xml.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,11 @@
1313
<directory name="vendor"/>
1414
</ignoreFiles>
1515
</projectFiles>
16+
<issueHandlers>
17+
<InvalidScalarArgument>
18+
<errorLevel type="suppress">
19+
<file name="src/ReportBase.php" />
20+
</errorLevel>
21+
</InvalidScalarArgument>
22+
</issueHandlers>
1623
</psalm>

src/BaseFeatures/Data/Column.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace AlwaysOpen\ReportEngine\BaseFeatures\Data;
44

55
use AlwaysOpen\ReportEngine\BaseFeatures\Data\Types\Bases\BaseType;
6+
use AlwaysOpen\ReportEngine\BaseFeatures\Data\Types\DateTime;
67
use AlwaysOpen\ReportEngine\BaseFeatures\Data\Types\Enum;
78
use AlwaysOpen\ReportEngine\BaseFeatures\Data\Types\Text;
89
use AlwaysOpen\ReportEngine\BaseFeatures\Filters\BaseFilter;
@@ -115,10 +116,7 @@ public function formattedValue($result)
115116
return $value;
116117
}
117118

118-
/**
119-
* @return BaseType
120-
*/
121-
public function type(): BaseType
119+
public function type(): BaseType|DateTime
122120
{
123121
if (! empty($this->config['type'])) {
124122
if ($this->config['type'] instanceof BaseType) {
@@ -566,7 +564,7 @@ public function renderFilter()
566564
->renderFilter($this->label(), $this->name(), $this->filterInstances(), $this->type(), $this->getFilterValue());
567565
}
568566

569-
public function formatter() : string
567+
public function formatter() : string|null
570568
{
571569
return $this->type()->formatter();
572570
}

src/BaseFeatures/Data/Types/Bases/BaseType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function setFormatter(?string $formatter) : self
202202
return $this;
203203
}
204204

205-
public function formatter() : string
205+
public function formatter() : string|null
206206
{
207207
return $this->formatter ?? 'plaintext';
208208
}

src/BaseFeatures/Data/Types/DateTime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function setOutputTimezone(string|null $timezone) : self
6969
return $this;
7070
}
7171

72-
public function formatter(): string
72+
public function formatter(): string|null
7373
{
7474
return $this->formatter;
7575
}

src/BaseFeatures/Data/Types/Html.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ public static function availableFilters(): array
3434
];
3535
}
3636

37-
/**
38-
* @return string
39-
*/
40-
public function formatter() : string
37+
public function formatter() : string|null
4138
{
4239
return 'html';
4340
}

src/BaseFeatures/Data/Types/NumericHtml.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ public function typeFormat($value, ?object $result = null)
2121
return (string) $value;
2222
}
2323

24-
/**
25-
* @return string
26-
*/
27-
public function formatter() : string
24+
public function formatter() : string|null
2825
{
2926
return 'html';
3027
}

src/ReportBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public function toArray(): array
318318
$this->build();
319319

320320
return [
321-
'columns' => collect($this->columns)->map(function (Column $column) {
321+
'columns' => $this->columns->map(function (Column $column) {
322322
return $column->toArray();
323323
}),
324324
'data' => $this->rowsArray,

0 commit comments

Comments
 (0)