Skip to content

Commit 5a2eef9

Browse files
committed
:octocat: File: fix parameter defaults for load/save json
1 parent c305a9a commit 5a2eef9

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ parameters:
55
count: 1
66
path: src/Crypto.php
77

8-
-
9-
message: "#^Parameter \\#2 \\$flags of static method chillerlan\\\\Utilities\\\\Str\\:\\:jsonEncode\\(\\) expects int, int\\|null given\\.$#"
10-
count: 1
11-
path: src/File.php
12-
138
-
149
message: "#^Parameter \\$length of function file_get_contents expects int\\<0, max\\>\\|null, int\\|null given\\.$#"
1510
count: 1

src/File.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,16 @@ public static function save(string $file, string $data):int{
105105
*
106106
* @codeCoverageIgnore
107107
*/
108-
public static function loadJSON(string $file, bool $associative = false):mixed{
109-
return Str::jsonDecode(self::load($file), $associative);
108+
public static function loadJSON(string $file, bool $associative = false, int $flags = 0):mixed{
109+
return Str::jsonDecode(self::load($file), $associative, $flags);
110110
}
111111

112112
/**
113113
* save to a JSON file (convenience)
114114
*
115115
* @codeCoverageIgnore
116116
*/
117-
public static function saveJSON(string $file, mixed $data, int|null $flags = null):int{
117+
public static function saveJSON(string $file, mixed $data, int $flags = Str::JSON_ENCODE_FLAGS_DEFAULT):int{
118118
return self::save($file, Str::jsonEncode($data, $flags));
119119
}
120120

0 commit comments

Comments
 (0)