Skip to content

Cannot unset offset 0 on $this #2752

@AJenbo

Description

@AJenbo

Bug report

I'm not sure if I would need to specify a type of the generic for this to work, but I would expect it to inherit the type from SimpleXMLElement

Source:
http://stackoverflow.com/questions/262351/remove-a-child-with-a-specific-attribute-in-simplexml-for-php/16062633#16062633

Code snippet that reproduces the problem

<?php declare(strict_types = 1);

use SimpleXMLExtended;

class HelloWorld extends SimpleXMLElement
{
	public function removeThis(): void
	{
		unset($this[0]);
	}
}

https://phpstan.org/r/d60d583b-f6a0-4dba-92fb-9a1451540d91

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions