Skip to content

Commit 5f98146

Browse files
committed
fixing nullable_type_declaration operator_linebreak
1 parent bc3c192 commit 5f98146

7 files changed

Lines changed: 36 additions & 36 deletions

File tree

src/Block.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function getBlock(mixed $key, mixed $defaultValue = null, string $charNes
122122
* In the case the $key doesn't exist, null can be returned
123123
* @param non-empty-string $charNestedKey
124124
*/
125-
public function getBlockNullable(mixed $key, mixed $defaultValue = null, string $charNestedKey = "."): self|null
125+
public function getBlockNullable(mixed $key, mixed $defaultValue = null, string $charNestedKey = "."): ?self
126126
{
127127
$value = $this->get($key, $defaultValue, $charNestedKey);
128128
if (is_null($value)) {

src/Traits/EditableBlock.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ trait EditableBlock
1212
* @param array<int|string, mixed>|Block $data
1313
* @return $this
1414
*/
15-
public function append(array|Block $data, string|null $key = null): self
15+
public function append(array|Block $data, ?string $key = null): self
1616
{
1717
if ($data instanceof Block) {
1818
$this->data = array_merge($this->data, $data->toArray());
@@ -23,7 +23,7 @@ public function append(array|Block $data, string|null $key = null): self
2323
return $this;
2424
}
2525

26-
public function appendItem(mixed $data, string|null $key = null): self
26+
public function appendItem(mixed $data, ?string $key = null): self
2727
{
2828
if (is_null($key)) {
2929
$this->data[] = $data;

src/Traits/FormattableBlock.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function getFormattedDateTime(
1818
string $format = "Y-m-d H:i:s",
1919
mixed $defaultValue = null,
2020
string $charNestedKey = ".",
21-
): string|null {
21+
): ?string {
2222
$value = $this->get($key, $defaultValue, $charNestedKey);
2323
if (is_null($value)) {
2424
return null;
@@ -78,7 +78,7 @@ public function getFormattedByte(
7878
*/
7979
public function getString(
8080
mixed $key,
81-
string|null $defaultValue = null,
81+
?string $defaultValue = null,
8282
string $charNestedKey = ".",
8383
): string {
8484
return (string) $this->get($key, $defaultValue, $charNestedKey);
@@ -92,7 +92,7 @@ public function getString(
9292
*/
9393
public function getBoolean(
9494
mixed $key,
95-
bool|null $defaultValue = null,
95+
?bool $defaultValue = null,
9696
string $charNestedKey = ".",
9797
): bool {
9898
return (bool) $this->get($key, $defaultValue, $charNestedKey);

src/Traits/ValidableBlock.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ trait ValidableBlock
1111
public function validateJsonViaUrl(string $url): bool
1212
{
1313
try {
14-
$schema =
15-
Schema::import($url);
14+
$schema
15+
= Schema::import($url);
1616
$schema->in($this->toJsonObject());
1717
} catch (\Exception) {
1818
return false;
@@ -29,8 +29,8 @@ public function validateJsonSchemaGithubWorkflow(): bool
2929
public function validateJsonWithSchema(string $schemaJson): bool
3030
{
3131
try {
32-
$schema =
33-
Schema::import(json_decode($schemaJson));
32+
$schema
33+
= Schema::import(json_decode($schemaJson));
3434
$schema->in($this->toJsonObject());
3535
} catch (\Exception) {
3636
//echo $e->getMessage();

tests/Unit/BlockGetTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,32 @@
33
use HiFolks\DataType\Block;
44

55
$fruitsArray = [
6-
"avocado" =>
7-
[
6+
"avocado"
7+
=> [
88
'name' => 'Avocado',
99
'fruit' => '🥑',
1010
'wikipedia' => 'https://en.wikipedia.org/wiki/Avocado',
1111
'color' => 'green',
1212
'rating' => 8,
1313
],
14-
"apple" =>
15-
[
14+
"apple"
15+
=> [
1616
'name' => 'Apple',
1717
'fruit' => '🍎',
1818
'wikipedia' => 'https://en.wikipedia.org/wiki/Apple',
1919
'color' => 'red',
2020
'rating' => 7,
2121
],
22-
"banana" =>
23-
[
22+
"banana"
23+
=> [
2424
'name' => 'Banana',
2525
'fruit' => '🍌',
2626
'wikipedia' => 'https://en.wikipedia.org/wiki/Banana',
2727
'color' => 'yellow',
2828
'rating' => 8.5,
2929
],
30-
"cherry" =>
31-
[
30+
"cherry"
31+
=> [
3232
'name' => 'Cherry',
3333
'fruit' => '🍒',
3434
'wikipedia' => 'https://en.wikipedia.org/wiki/Cherry',
@@ -169,26 +169,26 @@ function () use ($fruitsArray): void {
169169

170170
$block = Block::make(
171171
[
172-
"avocado" =>
173-
[
172+
"avocado"
173+
=> [
174174
'name' => 'Avocado',
175175
'fruit' => '🥑',
176176
'wikipedia' => 'https://en.wikipedia.org/wiki/Avocado',
177177
],
178-
"apple" =>
179-
[
178+
"apple"
179+
=> [
180180
'name' => 'Apple',
181181
'fruit' => '🍎',
182182
'wikipedia' => 'https://en.wikipedia.org/wiki/Apple',
183183
],
184-
"banana" =>
185-
[
184+
"banana"
185+
=> [
186186
'name' => 'Banana',
187187
'fruit' => '🍌',
188188
'wikipedia' => 'https://en.wikipedia.org/wiki/Banana',
189189
],
190-
"cherry" =>
191-
[
190+
"cherry"
191+
=> [
192192
'name' => 'Cherry',
193193
'fruit' => '🍒',
194194
'wikipedia' => 'https://en.wikipedia.org/wiki/Cherry',

tests/Unit/Traits/ExportableTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,32 @@
33
use HiFolks\DataType\Block;
44

55
$fruitsArray = [
6-
"avocado" =>
7-
[
6+
"avocado"
7+
=> [
88
'name' => 'Avocado',
99
'fruit' => '🥑',
1010
'wikipedia' => 'https://en.wikipedia.org/wiki/Avocado',
1111
'color' => 'green',
1212
'rating' => 8,
1313
],
14-
"apple" =>
15-
[
14+
"apple"
15+
=> [
1616
'name' => 'Apple',
1717
'fruit' => '🍎',
1818
'wikipedia' => 'https://en.wikipedia.org/wiki/Apple',
1919
'color' => 'red',
2020
'rating' => 7,
2121
],
22-
"banana" =>
23-
[
22+
"banana"
23+
=> [
2424
'name' => 'Banana',
2525
'fruit' => '🍌',
2626
'wikipedia' => 'https://en.wikipedia.org/wiki/Banana',
2727
'color' => 'yellow',
2828
'rating' => 8.5,
2929
],
30-
"cherry" =>
31-
[
30+
"cherry"
31+
=> [
3232
'name' => 'Cherry',
3333
'fruit' => '🍒',
3434
'wikipedia' => 'https://en.wikipedia.org/wiki/Cherry',

tests/Unit/Traits/QueryableBlockTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ function (): void {
9191
];
9292
$fruitsBlock = Block::make($fruits);
9393
$groupedByQuantityRange = $fruitsBlock->groupByFunction(
94-
fn($fruit): string =>
95-
match (true) {
94+
fn($fruit): string
95+
=> match (true) {
9696
$fruit['quantity'] < 10 => 'Low',
9797
$fruit['quantity'] < 15 => 'Medium',
9898
default => 'High',

0 commit comments

Comments
 (0)