Psalm: `password_hash` should return `string|false`, not `string|null`

Created on 9 Jan 2019  Â·  14Comments  Â·  Source: vimeo/psalm

https://github.com/vimeo/psalm/commit/2f30132d9488bfd7e4aee6688f36d3cefeef7919#diff-4355ecf0bcc89fe8c145b64be0e02ddfL8647 — this commit replaced proper signature with the broken one.

Most helpful comment

Thanks guys! Bummer this takes so long to fix in the docs.

All 14 comments

Additionally:

  • ~SQLiteUnbuffered::column is mixed, not void~ seems to be fixed in a later commit
  • spliti is removed in 7.0

This issue seems to have regressed.

https://github.com/vimeo/psalm/blob/dc78e9c57ba58e21e7970451ca52314b398fc811/src/Psalm/Internal/CallMap_74_delta.php#L18

According to the PHP docs nothing has changed.

This issue seems to have regressed.

Almost a year ago in fact.
/cc @bugreportuser

I believe this is correct. In 7.4, there is no false return.

This change was not documented, which is why this bug exists.

Oh, I totally forgot we already discussed it back then.

That's fine. It's good this was revisited after the 7.4 release.

Thanks guys! Bummer this takes so long to fix in the docs.

Sorry, would one of you mind PRing again with the correct signatures? And also leave a comment this time so someone well-meaning doesn’t undo them (here's where they were changed: https://github.com/vimeo/psalm/pull/2396/files#diff-4355ecf0bcc89fe8c145b64be0e02ddf)

@muglug the delta is fine, as it's changed in 7.4. Does CallMap represent the latest stable PHP version (7.4 now)?

@muglug The signatures are already correct. The return type changed in 7.4. The documentation is wrong.

A PR with a comment is a good idea. Do you want that here or in the callmap?

Is it correct through that this issue was triggered when running on PHP 7.3?

@iluuu1994 Now I understand. This PR is new. It made a change in the callmap that was already in the 7.4 delta. I'll create a PR to fix that.

The callmap should have the latest PHP version’s changes, with the deltas providing backwards-compatibility

@muglug Ok, then maybe the delta isn't being correctly applied for PHP 7.3. I'm getting the same signature as @iluuu1994.

Example on master:

php73.php:

<?php
echo password_hash("password", PASSWORD_DEFAULT) === false;

```
$ psalm --php-version=7.3 php73.php

ERROR: TypeDoesNotContainType - php73.php:2:6 - null|string does not contain false

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vudaltsov picture vudaltsov  Â·  3Comments

staabm picture staabm  Â·  3Comments

muglug picture muglug  Â·  3Comments

albe picture albe  Â·  3Comments

vudaltsov picture vudaltsov  Â·  3Comments