Skip to content

Predefined constants of wrong php version are used #9246

@erikvanderschaaf

Description

@erikvanderschaaf

Bug report

It seems that the wrong constants are used for analyzing the code. I run php version 8.2.4 on my local environment, but our production environment is on php 7.3.33. So I've put phpVersion: 70333 in our phpstan.neon file, and it's also in the platform section of our composer.json.

Since the password constants have been changed from int to string in php 7.4 it yields an error on the password_hash function.

Parameter #2 $algo of function password_hash expects int, string given.

https://www.php.net/password_hash
https://www.php.net/manual/en/password.constants.php

Code snippet that reproduces the problem

https://phpstan.org/r/3a20f288-2c07-4fab-ab05-0b2e3512eb7e

Expected output

Since we use the PASSWORD_BCRYPT constant in our code, we would expect no errors for this line of code.

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

We've implemented phpstan on our projects as of today, we're sure it will make our code better in the future

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions