Skip to content

Test chaining with static/self and $this more - #3363

Closed
mvorisek wants to merge 1 commit into
phpstan:2.1.xfrom
mvorisek:fix_5946_this_into_static
Closed

Test chaining with static/self and $this more#3363
mvorisek wants to merge 1 commit into
phpstan:2.1.xfrom
mvorisek:fix_5946_this_into_static

Conversation

@mvorisek

@mvorisek mvorisek commented Aug 27, 2024

Copy link
Copy Markdown
Contributor

add more tests for #4902 for phpstan/phpstan#5946

self:: method calls and properties are resolved using late-static binding, but Foo:: are not. For methods, this works perfectly already, for properties, expected type is commented in edge cases.

@mvorisek
mvorisek force-pushed the fix_5946_this_into_static branch 2 times, most recently from 8440516 to fd3a89a Compare September 23, 2024 06:45
@mvorisek
mvorisek force-pushed the fix_5946_this_into_static branch from fd3a89a to 8eae77c Compare October 11, 2024 09:11
@mvorisek
mvorisek force-pushed the fix_5946_this_into_static branch from 8eae77c to 8ceb598 Compare November 28, 2024 22:14
@mvorisek mvorisek closed this Jul 31, 2025
@mvorisek
mvorisek deleted the fix_5946_this_into_static branch July 31, 2025 08:19
@mvorisek
mvorisek restored the fix_5946_this_into_static branch February 16, 2026 09:23
@mvorisek mvorisek reopened this Feb 17, 2026
@mvorisek
mvorisek changed the base branch from 1.12.x to 2.1.x February 17, 2026 10:15
@mvorisek
mvorisek force-pushed the fix_5946_this_into_static branch from 8ceb598 to 5381a06 Compare February 17, 2026 21:55
@mvorisek mvorisek changed the title Fix chaining with static/self and $this Test chaining with static/self and $this more Feb 17, 2026
@mvorisek
mvorisek force-pushed the fix_5946_this_into_static branch 2 times, most recently from a5a2fe0 to e27d8da Compare February 17, 2026 22:26
@mvorisek
mvorisek force-pushed the fix_5946_this_into_static branch from e27d8da to d2c7fa9 Compare March 9, 2026 09:58
@mvorisek
mvorisek marked this pull request as ready for review March 9, 2026 10:02
@phpstan-bot

Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

@mvorisek
mvorisek force-pushed the fix_5946_this_into_static branch from d2c7fa9 to 5167184 Compare March 13, 2026 23:21
@mvorisek
mvorisek force-pushed the fix_5946_this_into_static branch from 5167184 to cbeef7c Compare March 15, 2026 22:24
@mvorisek

Copy link
Copy Markdown
Contributor Author

@ondrejmirtes can this be reviewed please?

@VincentLanglet VincentLanglet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

HI,

Rather than providing tests with "non-expected" result related to a solved and closed issues. I recommend either

  • Providing a PR with extra fixes
  • Or an issue with dedicated exemple about what is needed to be improved to let the bot working on it.

I currently don't see the value adding assertion with // should be comments.

@mvorisek

Copy link
Copy Markdown
Contributor Author

Hi @VincentLanglet. This is comprehensive test to a fixed issue, but when landed, these tests were not added, so they have value to prevent breaking them later.

The test is covering all chaining scenarios and I prefer to keep also the cases which are still broken. I prefer to keep the broken cases to keep them logically together.

@mvorisek mvorisek closed this Aug 3, 2026
@mvorisek
mvorisek deleted the fix_5946_this_into_static branch August 3, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

$this type of static (self, ...) type must remains static

3 participants