Skip to content

Accessing SimpleXML attributes on php 8 #3947

@b1rdex

Description

@b1rdex

https://phpstan.org/r/765ef3ab-b796-4421-ae18-21413a869809

class HelloWorld
{
	public function sayHello(SimpleXMLElement $item): void
	{
		foreach ($item->items->children() as $groupItem) {
			switch ((string)$groupItem->orderType) {
			}
		}
	}
}

It produces Cannot access property $orderType on SimpleXMLIterator\|null on php 8 on phpstan.org.
IDK why but this code reports Access to private property $orderType of parent class SimpleXMLElement for me locally w/ phpVersion: 80000 setting enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions