Skip to content

Access to an undefined property object::$property_name #928

@muglug

Description

@muglug

object can never have defined properties or methods, but PHPStan complains:

function takesUnknown($foo) {
	echo $foo->bar; // this is fine
}

function takesObject(object $o) {
	echo $o->bar; // Access to an undefined property object::$bar.
}

https://phpstan.org/r/8b92ca2494b5366976d12533aadc7ceb

Suggestion: treat the same as mixed::$bar, and only complain if you complain about mixed property fetching (planned for level 8)

cc @asgrim

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions