Rule to prefer !== null check over isset() for existing variable/key/property

Open
#171 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
tooling

Research direction

The issue names no files, tests, or entry points. Start by locating the existing rule and its tests for isset() handling, then confirm how the project identifies variables, keys, and properties that are already defined. Done means the narrower !== null form is reported only when definedness is established, with tests covering each stated case.

Written by the indexing model from the issue text.

Description

When using isset() we're checking that

  • The property/variable/... is defined
  • The value is not null

When the value is always defined, it could be clearer to write $foo !== null instead.

Dominant language
PHP
Stars
709
Forks
62
Avg merge
5d 19h
Merged PRs (30d)
3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phpstan/phpstan-strict-rules

All issues in phpstan/phpstan-strict-rules

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.