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
if($var) should not modify the type of $var. #4846
Comments
anomiex
added a commit
to Automattic/jetpack
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers.
3 tasks
anomiex
added a commit
to Automattic/jetpack
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers.
matticbot
pushed a commit
to Automattic/jetpack-connection
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-abtest
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-waf
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-jitm
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-stats-admin
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-publicize
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-inspect
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-videopress
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-mu-wpcom-plugin
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/automattic-for-agencies-client
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-blaze
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-backup
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-storybook
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-my-jetpack
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-backup-plugin
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-videopress-plugin
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/wpcom-migration
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-starter-plugin
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-protect-plugin
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-boost-production
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-social-plugin
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-search
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-search-plugin
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
matticbot
pushed a commit
to Automattic/jetpack-production
that referenced
this issue
Apr 24, 2024
* Declare the shape of returned response arrays for better static analysis. * Fix a bunch of other phpdocs to be more correct too. * Remove some unnecessary boolean checks, that were confusing Phan into marking all the keys in arrays as being possibly-missing (cf. phan/phan#4846) * At least they're unnecessary based on the declared return values of stuff and a quick look through the code. If we really need them, we should be more specific about what we're checking for and we should always return the documented WP_Error instead of passing the weird-falsey-value along. The most important fix here is getting the type of the `$body` parameter to `wpcom_json_api_request_as_blog` right, which fixes PhanTypeMismatchArgumentProbablyReal issues in a lot of callers. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8821834019 Upstream-Ref: Automattic/jetpack@01d6d6d
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Phan 5.4.3 .
In a CI setup, the variable '$ok' in a code that essentially is as below, the '$ok' was considered '?''|?'0'|?0|?0.0|?1|?array{}|?false(real=?''|?'0'|?0|?0.0|?1|?array{}|?false)' after the test.
After replacing
if ($ok)
withif ($ok ==1)
, $ok no longer was nullable at any point observed with phan-debug-var.I tried to make a test case, but I could not reproduce it.
This os tje extract from cs-style-log with phan-debug-var information showing that $ok transitions to a nullable union type;
The text was updated successfully, but these errors were encountered: