Skip to content

IssetOnPropertyObjectToPropertyExistsRector too eager #9128

@victorlap

Description

@victorlap

Bug Report

Subject Details
Rector version Rector 2.0.11

The IssetOnPropertyObjectToPropertyExistsRector changes code while it shouldn't.

Minimal PHP Code Causing Issue

https://getrector.com/demo/fc241ad4-ac82-4120-bfe7-27ffc62ac965

-        if (! isset($values['_identity']->value)) {
+        if ($values['_identity']->value === null) {

Expected Behaviour

Rector should leave this code snippet, or allow for the array key to not exist, like:

-        if (! isset($values['_identity']->value)) {
+        if ($values['_identity']?->value === null) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions