Skip to content

Add test for PropertyFetchTypeResolver#5307

Closed
vhenzl wants to merge 4 commits intorectorphp:masterfrom
vhenzl:property-fetch-type-resolver-test
Closed

Add test for PropertyFetchTypeResolver#5307
vhenzl wants to merge 4 commits intorectorphp:masterfrom
vhenzl:property-fetch-type-resolver-test

Conversation

@vhenzl
Copy link
Copy Markdown
Contributor

@vhenzl vhenzl commented Jan 25, 2021

Adds missing test for PropertyFetchTypeResolver. See #5299 (comment) for the motivation.

Currently based on v0.9.10 which is the last version where property fetch type resolution worked (although with some errors as the test reveals). Will be rebased later.

@vhenzl
Copy link
Copy Markdown
Contributor Author

vhenzl commented Jan 25, 2021

@TomasVotruba Is it possible to have tests and fixtures targeting only PHP 7.4+ (or even PHP 8.0+) to test typed properties (and native union types)? What's the recommended way to exclude files like ClassWithNativeProps.php from linting, analysing and testing on PHP 7.3?

@samsonasik
Copy link
Copy Markdown
Member

@vhenzl vhenzl force-pushed the property-fetch-type-resolver-test branch from fc18650 to f1c1978 Compare January 27, 2021 10:10
@vhenzl vhenzl force-pushed the property-fetch-type-resolver-test branch from aeed121 to 05bc070 Compare January 27, 2021 10:25
@vhenzl vhenzl marked this pull request as ready for review January 27, 2021 10:46
@vhenzl
Copy link
Copy Markdown
Contributor Author

vhenzl commented Jan 27, 2021

This is ready now. Tests are expected to fail because PropertyFetchTypeResolver is broken: instead of the type of a fetched property, it returns the type of the object the property is fetched on (ClassWithNativeProps, ClassWithPhpDocProps).

samsonasik added a commit that referenced this pull request Jan 27, 2021
@samsonasik
Copy link
Copy Markdown
Member

samsonasik commented Jan 27, 2021

@vhenzl I cherry-picked your commit at PR at #5334

samsonasik added a commit that referenced this pull request Jan 27, 2021
samsonasik added a commit that referenced this pull request Jan 27, 2021
@samsonasik
Copy link
Copy Markdown
Member

Handled at #5334

@samsonasik samsonasik closed this Jan 27, 2021
@vhenzl vhenzl deleted the property-fetch-type-resolver-test branch January 28, 2021 00:31
TomasVotruba added a commit that referenced this pull request Dec 2, 2023
rectorphp/rector-src@71c22e2 [CodeQuality] Skip with else on SimplifyForeachToCoalescingRector (#5307)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants