Skip to content

$_ENV['CI'] not nullable since v2.1.9 #12776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mvorisek opened this issue Mar 23, 2025 · 3 comments · Fixed by phpstan/phpstan-src#3901
Closed

$_ENV['CI'] not nullable since v2.1.9 #12776

mvorisek opened this issue Mar 23, 2025 · 3 comments · Fixed by phpstan/phpstan-src#3901

Comments

@mvorisek
Copy link
Contributor

mvorisek commented Mar 23, 2025

Bug report

repro: https://github.com/atk4/ui/blob/235416b31066827226e462f1916d9fc99c0d14b4/demos/init-db.php#L556

 ------ --------------------------------------------------------------------- 
  Line   demos/init-db.php                                                    
 ------ --------------------------------------------------------------------- 
  556    Offset 'CI' on non-empty-array on left side of ?? always exists and  
         is not nullable.                                                     
         🪪  nullCoalesce.offset                                              
 ------ --------------------------------------------------------------------- 

Looking into the release notes - maybe caused by phpstan/phpstan-src@d4d7e11, not sure. Environment variables passed into PHPStan must however not be assumed on runtime.

Code snippet that reproduces the problem

n/a

Expected output

no PHPStan error

Copy link

mergeable bot commented Mar 23, 2025

This bug report is missing a link to reproduction at phpstan.org/try.

It will most likely be closed after manual review.

@ruudk
Copy link
Contributor

ruudk commented Mar 24, 2025

I have the same issue. Tried to reproduce it on phpstan.org/try but there it does not fail. I assume in my project, it's because I have reportPossiblyNonexistentConstantArrayOffset enabled. And maybe that's not enabled on phpstan.org/try? Would it be an idea for phpstan.org/try to also allow enabling other configuration options? That would make it easier to reproduce these type of issues.

Offset 'CI' on non-empty-array in isset() always exists and is not nullable.
🔖 isset.offset

@herndlm
Copy link
Contributor

herndlm commented Mar 24, 2025

high change that this is related to / a duplicate of #12771, but no need to close yet, this info might be relevant later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants