Skip to content

Commit

Permalink
Fix a few psalm issues in PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Phoen committed Jun 25, 2024
1 parent 9ebe0f5 commit 4cafe2d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/jennies/php/rawtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,10 @@ func (jenny RawTypes) generateFromJSON(context languages.Context, def ast.Object
buffer.WriteString(" */\n")
buffer.WriteString("public static function fromArray(array $inputData): self\n")
buffer.WriteString("{\n")
buffer.WriteString(fmt.Sprintf(" /** @var %s $inputData */\n", jenny.shaper.typeShape(def.Type)))
buffer.WriteString(" $data = $inputData;\n")
if len(constructorArgs) != 0 {
buffer.WriteString(fmt.Sprintf(" /** @var %s $inputData */\n", jenny.shaper.typeShape(def.Type)))
buffer.WriteString(" $data = $inputData;\n")
}
buffer.WriteString(" return new self(\n")
buffer.WriteString(strings.Join(constructorArgs, ""))
buffer.WriteString(" );\n")
Expand Down Expand Up @@ -608,9 +610,7 @@ func (jenny RawTypes) unmarshalDisjunctionFunc(context languages.Context, disjun
decodingSwitch += "}"

return fmt.Sprintf(`(function($input) {
if (!is_array($input)) {
throw new \ValueError('expected disjunction value to be an array');
}
\assert(is_array($input), 'expected disjunction value to be an array');
%s
})`, decodingSwitch)
Expand Down

0 comments on commit 4cafe2d

Please sign in to comment.