Skip to content
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

Scan files included by autoloaders #3183

Merged
merged 1 commit into from Jul 11, 2020

Conversation

weirdan
Copy link
Collaborator

@weirdan weirdan commented Apr 19, 2020

Refs #2861

To provide a bit more context: this PR changes the way Psalm discovers what's been made available during autoloader registration. Previously it would simply deep-scan files listed in autoloader.file section of composer.json. Now it takes a snapshot of loaded files before autoloader registration and compares that to the included file list after autoloader is registered. This provides almost bullet-proof support for any custom logic autoloader may implement.

@weirdan
Copy link
Collaborator Author

weirdan commented Apr 19, 2020

I think better approach could be to compare the list of included files before and after autoloader registration, remove any that are related to Psalm itself and scan the remaining.

@weirdan weirdan changed the title Scan user-defined function sources Scan files included by autoloaders Apr 21, 2020
@azjezz
Copy link
Contributor

azjezz commented Jul 6, 2020

any updates here?

@weirdan weirdan force-pushed the scan-autoloaded-functions branch 3 times, most recently from 300b245 to d7bf5d6 Compare July 11, 2020 15:30
@weirdan weirdan requested a review from muglug July 11, 2020 16:43
@weirdan weirdan marked this pull request as ready for review July 11, 2020 16:43
@weirdan
Copy link
Collaborator Author

weirdan commented Jul 11, 2020

CircleCI reports one issue remaining with ProxyManager, but I can't seem to reproduce it outside the CI, even using CircleCI-built psalm.phar.

@muglug muglug merged commit 931d35a into vimeo:master Jul 11, 2020
@muglug
Copy link
Collaborator

muglug commented Jul 11, 2020

Thanks, I'll debug that error myself

@azjezz
Copy link
Contributor

azjezz commented Jul 11, 2020

🎉 Thank you for you work!

@muglug
Copy link
Collaborator

muglug commented Jul 13, 2020

@weirdan the error was caused by the phar, which is built with ocramius/packageversions:1.4.2, which is missing a @psalm-pure annotation. I think Psalm is reflecting that class's method docblock from the bundled phar after reflecting the one in the vendor directory.

@weirdan
Copy link
Collaborator Author

weirdan commented Jul 14, 2020

I wonder why it wouldn't fail the same way when I tried running the phar I downloaded from CircleCI. Anyway, we'll see how it goes when new release is cut.

@weirdan weirdan deleted the scan-autoloaded-functions branch July 14, 2020 00:20
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.

None yet

3 participants