Conversation
Apply changes to funcation map for php-stubs#460
|
@johnbillion Please comment on this. |
|
Should I have updated the generated file wordpress-stubs.php as well as the
source file function-map.php. As the integrations that have failed seem to
be a comparison of the output.
Peter
…On Tue, 31 Mar 2026 at 15:33, Viktor Szépe ***@***.***> wrote:
*szepeviktor* left a comment (php-stubs/wordpress-stubs#461)
<#461?email_source=notifications&email_token=A3WI6GODY3FVU7E74R67SLT4TPJKRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJWGMYDSNZRGEY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2LK4DSL5RW63LNMVXHIX3POBSW4X3DNRUWG2Y#issuecomment-4163097111>
@johnbillion <https://github.com/johnbillion> Please comment on this.
—
Reply to this email directly, view it on GitHub
<#461?email_source=notifications&email_token=A3WI6GODY3FVU7E74R67SLT4TPJKRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJWGMYDSNZRGEY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2LK4DSL5RW63LNMVXHIX3POBSW4X3DNRUWG2Y#issuecomment-4163097111>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3WI6GIUJOL3VQXDKBILYD34TPJKRAVCNFSM6AAAAACXH2V47SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCNRTGA4TOMJRGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
No. |
|
This appears technically correct, but I'm sure there are dozens or hundreds more functions that are impure. What's the effect of marking them as such? |
I deeply agree with that. |
|
I agree with both of you that more of the WordPress functions are probably
impure.
These two came up because my code had time-delayed retries of these
functions in the event of an error, and PhpStan assumed the value from the
first call would be the same for the second (e.g. assumed the second call
with the same arguments would always fail too). And that generated a
(false) report from PhpStan.
I almost wonder whether the default should be to assume WordPress functions
are impure unless known not to be.
…On Tue, 31 Mar 2026 at 17:42, Viktor Szépe ***@***.***> wrote:
*szepeviktor* left a comment (php-stubs/wordpress-stubs#461)
<#461?email_source=notifications&email_token=A3WI6GJHF2YN6HMKUF7N3F34TPYPDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJWGM4TONBUGMZKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2LK4DSL5RW63LNMVXHIX3POBSW4X3DNRUWG2Y#issuecomment-4163974432>
hundreds more functions that are impure.
I deeply agree with that.
—
Reply to this email directly, view it on GitHub
<#461?email_source=notifications&email_token=A3WI6GJHF2YN6HMKUF7N3F34TPYPDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJWGM4TONBUGMZKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2LK4DSL5RW63LNMVXHIX3POBSW4X3DNRUWG2Y#issuecomment-4163974432>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3WI6GNBC53MTDIBNFEQEX34TPYPDAVCNFSM6AAAAACXH2V47SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCNRTHE3TINBTGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
@johnbillion PHPStan, by default, considers functions that return a value to be pure, meaning that it assumes they return the same value for the same input arguments. This behaviour can be disabled in the config by setting We have already added Yes, a lot of WordPress functions are impure, probably most of them, because they depend on globals, database queries, filters (though we typically ignore filters anyway), or other external state. I think that @PeterSmith8nss Yes, you should regenerate |
|
I'm happy for this to go in as long as Viktor is. |
|
Okay! |
|
Have now added generated file. |
Remove trailing spaces
|
Thank you, Peter. |
Apply changes to funcation map for #460