Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`if.condNotBoolean` is not generated if variable is an item from an untyped array

Open
#289 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
devtools

Research direction

Start with the PHPStan reproducer linked in the report and compare it with the typed-array reproducer, focusing on the behavior change since v2.1.30. The work is done when the untyped-array case also reports if.condNotBoolean while preserving the expected behavior shown by the comparison link.

Written by the indexing model from the issue text.

Description

Bug report

Values taken from untyped arrays no longer generate if.condNotBoolean since v2.1.30.

Code snippet that reproduces the problem

https://phpstan.org/r/93a0d683-e507-4a8b-bb00-dfb88285b9f2

Expected output

I'd expect the snipped to generate if.condNotBoolean. Here is the equivalent snippet with the array type defined https://phpstan.org/r/12ec5066-dc65-4576-b588-6d642e0c45ee.

Did PHPStan help you today? Did it make you happy in any way?

It helped my refactor a bunch of weird legacy code without having to tear my hair out!

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

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.