Skip to content

Implement @pure-unless-callable-impure#3482

Draft
zonuexe wants to merge 10 commits into
phpstan:2.1.xfrom
zonuexe:feature/pure-unless-callable-is-impure
Draft

Implement @pure-unless-callable-impure#3482
zonuexe wants to merge 10 commits into
phpstan:2.1.xfrom
zonuexe:feature/pure-unless-callable-is-impure

Conversation

@zonuexe

@zonuexe zonuexe commented Sep 25, 2024

Copy link
Copy Markdown
Contributor

This PR is still a work in progress, no tests or rules have been added yet.

  • Add tests
  • Add rules
  • Add function map

refs #3106, phpstan/phpstan#11100 and phpstan/phpstan#11710
closes phpstan/phpstan#11101

related issue phpstan/phpdoc-parser#253

@zonuexe zonuexe marked this pull request as draft September 25, 2024 17:46
Comment thread src/PhpDoc/PhpDocNodeResolver.php Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be replaced by phpstan/phpdoc-parser#253

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WIP. = false will be removed.

@ondrejmirtes

Copy link
Copy Markdown
Member

Just updated phpdoc-parser here so you can use that.

@zonuexe zonuexe force-pushed the feature/pure-unless-callable-is-impure branch 4 times, most recently from eddd22a to f207c72 Compare September 30, 2024 18:09
@zonuexe zonuexe force-pushed the feature/pure-unless-callable-is-impure branch from f207c72 to 8c756cc Compare November 3, 2024 17:57
@staabm

staabm commented Nov 18, 2024

Copy link
Copy Markdown
Contributor

@zonuexe any plans to move this forward?

@zonuexe

zonuexe commented Nov 19, 2024

Copy link
Copy Markdown
Contributor Author

@staabm Hi, I know this branch is important but it was blocked due to my motivation. I'm going to rebase it on 2.0.x and do the necessary work. If I miss it tonight, I won't be able to start the rest of the work until next week, so it would be quicker for you to take over then.

@staabm

staabm commented Nov 19, 2024

Copy link
Copy Markdown
Contributor

I don't want to put pressure on you. It was not clear to me whether you stopped working on it or not.

I am totally fine if this takes a bit more time - thank you

@zonuexe zonuexe force-pushed the feature/pure-unless-callable-is-impure branch from 8c756cc to 389c7f0 Compare November 19, 2024 16:58
@zonuexe

zonuexe commented Nov 19, 2024

Copy link
Copy Markdown
Contributor Author

No problem, this is a very interesting subject for me too, so I'm happy to work on it because I realized that there are other people who are interested in it. More importantly, I'm always helped by your hard work.

@zonuexe zonuexe changed the base branch from 1.12.x to 2.0.x November 19, 2024 17:11
@zonuexe zonuexe force-pushed the feature/pure-unless-callable-is-impure branch 4 times, most recently from 2146ae0 to 1cc1fad Compare November 19, 2024 18:32
@VincentLanglet

Copy link
Copy Markdown
Contributor

Friendly ping @zonuexe, still interested in this PR ? Do you have time to finish it ?
Do you look for help ? What is missing ?

@zonuexe

zonuexe commented Jul 20, 2025

Copy link
Copy Markdown
Contributor Author

@VincentLanglet
Thank you for the suggestion, sorry for making you wait so long.
I've been working on PHPStan 2.1.18 a few times over the last few weeks, and just finished a PHPStan workshop at a local PHP conference, so I'll get back to that tomorrow.

@zonuexe zonuexe force-pushed the feature/pure-unless-callable-is-impure branch from adb02ca to abc8cd8 Compare August 1, 2025 12:45
@zonuexe zonuexe changed the base branch from 2.0.x to 2.1.x August 1, 2025 12:46
@zonuexe zonuexe force-pushed the feature/pure-unless-callable-is-impure branch from abc8cd8 to c4999be Compare August 1, 2025 13:09
@VincentLanglet

Copy link
Copy Markdown
Contributor

Friendly ping @zonuexe

I don't want to put pressure on you. It's just not clear to me whether you stopped working on it or not.
What is missing ?

It will unblock the phpstan/phpdoc-parser#259 pr :)

@VincentLanglet

Copy link
Copy Markdown
Contributor

Maybe I'm wrong, but I start to think this annotation is useless
https://phpstan.org/r/d3af976b-17ef-4ca6-87cb-4a1325622cee

PHPStan already handle cb with immediately/later invoked callable, even for a pure function/method.

So we just need to declare array_map and so as pure.

@devbanana

Copy link
Copy Markdown
Contributor

i'm happy to help contribute towards a solution if it's decided which direction is best.

@VincentLanglet

Copy link
Copy Markdown
Contributor

Hi @devbanana feel free to work on this.

Laybe @zonuexe could explain what he had in mind ; or @ondrejmirtes will have some guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants