Skip to content

Commit 556e60c

Browse files
Added more type information
1 parent 40126db commit 556e60c

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

phpstan.src.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ parameters:
33
ignoreErrors:
44
- '#Unable to resolve the template type#'
55
- '#Anonymous function should have native return typehint ".+".#'
6-
- '#Parameter \#1 \$callable of method PhpOption\\Option<bool\|string>::flatMap\(\) expects callable\(bool\|string\): PhpOption\\Option<mixed>, Closure\(string\): mixed given.#'
76
- '#Only booleans are allowed in a negated boolean, int\|false given.#'

src/Parser/EntryParser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static function parse(string $entry)
4848
[$name, $value] = $parts;
4949

5050
return self::parseName($name)->flatMap(static function (string $name) use ($value) {
51+
/** @var Result<Value|null,string> */
5152
$parsedValue = $value === null ? Success::create(null) : self::parseValue($value);
5253

5354
return $parsedValue->map(static function (?Value $value) use ($name) {

src/Store/File/Reader.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ public static function read(array $filePaths, bool $shortCircuit = true, string
6969
*/
7070
private static function readFromFile(string $path, string $encoding = null)
7171
{
72-
return Option::fromValue(@\file_get_contents($path), false)->flatMap(static function (string $content) use ($encoding) {
72+
/** @var Option<string> */
73+
$content = Option::fromValue(@\file_get_contents($path), false);
74+
75+
return $content->flatMap(static function (string $content) use ($encoding) {
7376
return Str::utf8($content, $encoding)->mapError(static function (string $error) {
7477
throw new InvalidEncodingException($error);
7578
})->success();

0 commit comments

Comments
 (0)