Skip to content

SimpleXmlElement array access should be possible #14054

@feyst

Description

@feyst

Bug report

It should be possible to do this:

        $xml = new \SimpleXmlElement('');
		$xml->test[] = 'bla';

But an error is thrown:
Cannot access an offset on bool|float|int|SimpleXMLElement|string|null.

Code snippet that reproduces the problem

https://phpstan.org/r/aca8e681-6ba1-4ab9-a800-8c5ebfba5fbe

Expected output

No errors

Did PHPStan help you today? Did it make you happy in any way?

Yes every day

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions