sabre-io / xml

sabre/xml is an XML library that you may not hate.
http://sabre.io/xml/
BSD 3-Clause "New" or "Revised" License
515 stars 77 forks source link

Type annotation for Service::write() is not correct #237

Closed mstilkerich closed 1 year ago

mstilkerich commented 1 year ago

According to the extended syntax (see for example the example after "You can even mix these syntaxes"), it is possible to pass a list (array with integer keys) as value parameter to the Service::write() method. However, the type annoation of the value parameter does not allow it:

    /*
     * @param string|array<string, mixed>|object|XmlSerializable $value
     */
    public function write(string $rootElementName, $value, string $contextUri = null): string

This causes type error with static analysis (using psalm in my case).