Skip to content

Read of unset typed property /w magic __get throws wrong message #9388

Closed
@mvorisek

Description

@mvorisek

Description

demo: https://3v4l.org/P7jXD (/wo return at all)
demo 2: https://3v4l.org/6RlfS (/w incompatible return type)
demo 3: https://3v4l.org/O9prE (/w type that can be implicitly casted, but not when using strict types)

The error message Cannot assign null to property Cl::$name of type string is wrong & hard to understand, as there is no assignment anywhere.

demo 4: https://3v4l.org/PaD9b (/w same return type as typed property, nothing wrong here, but it shows nothing is assigned as the error message claims)

PHP Version

8.0+

Operating System

any

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions