M1ke/psalm

Object-like-array comparisons to highlight difference

Opened this issue · 0 comments

M1ke commented

When comparing two arrays it would be helpful to see the comparison more clearly:

psalm: InvalidArgument: Argument 2 of xxx expects array{abc: numeric, def: numeric, klm: string, ghi: string, nop: numeric}, array{ghi: numeric, xyz: bool, def: string} provided

A simple fix could be to alphabetise this:

psalm: InvalidArgument: Argument 2 of xxx expects array{abc: numeric, def: numeric, ghi: string, klm: string, nop: numeric}, array{def: string, ghi: numeric, xyz: bool} provided

A better fix could be to also show a diff:

psalm: InvalidArgument: Argument 2 of xxx expects array{abc: numeric, def: numeric, ghi: string, klm: string, nop: numeric}, array{def: string, ghi: numeric, xyz: bool} provided. It is missing array{abc: numeric, klm: string, nop: numeric}