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

Enable extensions based on composer.json instead of those loaded at runtime (fixes #5482). #7107

Conversation

AndrolGenhald
Copy link
Collaborator

No description provided.

public const PARAM_LOB = 3;
public const PARAM_STMT = 4;
public const PARAM_BOOL = 5;
// public const PARAM_STR_NATL = 1073741824; since 7.2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure how to make this only available in 7.2, I'd rather not make a whole new stub file, but it doesn't look like psalm supports @since? Not immediately necessary anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, recurrent issue. It should not be an issue if we start generating stubs as we talked

@AndrolGenhald
Copy link
Collaborator Author

I figure there should probably be an XML config to enable/disable extensions as well, but this seems to work fine so far.

@AndrolGenhald AndrolGenhald force-pushed the feature/5482-load-extensions-based-on-composer-config branch from f5920be to 46a5e8c Compare December 9, 2021 00:03
@AndrolGenhald
Copy link
Collaborator Author

I was just thinking about require-dev. It would be nice if it were possible to load extensions in require-dev for specific namespaces such as tests, but as far as I'm aware there's no way to tell Psalm to only load a stub for use in a specific namespace. This might have to be part of a more general require-dev support, it would also be nice to exclude loading require-dev libraries when inspecting non-dev code.

@AndrolGenhald AndrolGenhald force-pushed the feature/5482-load-extensions-based-on-composer-config branch 3 times, most recently from 356192c to 401b664 Compare December 9, 2021 20:49
@AndrolGenhald
Copy link
Collaborator Author

Tests all run fine locally with #7110 merged. I'll see to getting an XML config added and then I think it's good to go.

@AndrolGenhald AndrolGenhald marked this pull request as ready for review December 9, 2021 23:02
@orklah
Copy link
Collaborator

orklah commented Dec 11, 2021

Seems like tests are failing. Maybe due to your last commit?

@AndrolGenhald
Copy link
Collaborator Author

AndrolGenhald commented Dec 11, 2021

Odd, they all run fine locally. Must be a PHP version issue.

Edit: Wait no, of course, it's because I re-enabled the SOAP extension locally after I got those tests to work the first time.

@AndrolGenhald
Copy link
Collaborator Author

I need to read before going and debugging again...
Those tests fail due to a separate bug fixed in #7110, when that's merged I'll rebase and everything should be fine.

@AndrolGenhald
Copy link
Collaborator Author

@orklah anything I can do to streamline review of some of these pull requests? I'm seeing several other pull requests that are going to cause conflicts.

@weirdan
Copy link
Collaborator

weirdan commented Dec 14, 2021

Ideally I'd like to merge CI fix and CS change before all other PRs.

@orklah
Copy link
Collaborator

orklah commented Dec 14, 2021

@AndrolGenhald Thanks for your PRs, it's really great! I'm having a hard time reviewing everything though!

This one is relatively easy to review, but if you could take the habit of summarize your most complex PR to explain the reason behind the biggest changes and challenges you encountered, it would help a lot :)

@AndrolGenhald AndrolGenhald mentioned this pull request Dec 14, 2021
@AndrolGenhald
Copy link
Collaborator Author

Feel free to liberally point out any areas that aren't explained well enough. In the future I'll try to do multiple commits when moving around and deduplicating code sections, I expect being able to see each step in the refactor would help a lot with reviewing.

@AndrolGenhald
Copy link
Collaborator Author

AndrolGenhald commented Jan 20, 2022

@orklah I believe this is ready to go, just blocked by #7110 (failing tests are due to the added stub not being handled correctly).

@AndrolGenhald
Copy link
Collaborator Author

Currently rebasing on master, I'll have to open a pull request against 4.x to add loadXdebugStub to the deprecated attributes list. Doesn't look like we're documenting those in UPGRADING.md?

@orklah
Copy link
Collaborator

orklah commented Jan 22, 2022

No, we only documented config properties removal in UPGRADING

@orklah orklah added the release:feature The PR will be included in 'Features' section of the release notes label Jan 22, 2022
@AndrolGenhald AndrolGenhald force-pushed the feature/5482-load-extensions-based-on-composer-config branch from 28a3efe to 63168ac Compare January 22, 2022 20:44
@AndrolGenhald
Copy link
Collaborator Author

AndrolGenhald commented Jan 22, 2022

@orklah I'm trying to update the baseline on 4.x, but every time I try it's just giving me an empty baseline and saying "No Errors" without actually performing a scan. Any idea what's going on there?

It looks like there are also some errors showing up on 4.x that aren't in the baseline, but it's being a bit inconsistent. Might be because I'm trying to modify it manually.

src/Psalm/Config.php Outdated Show resolved Hide resolved
@AndrolGenhald AndrolGenhald force-pushed the feature/5482-load-extensions-based-on-composer-config branch from 63168ac to 5c01913 Compare January 27, 2022 22:55
@AndrolGenhald
Copy link
Collaborator Author

@orklah is there any plan to version the documentation on psalm.dev? Maybe add psalm.dev/docs/v4 and psalm.dev/docs/v5 or something? Not sure if I should be removing deprecated stuff from the documentation or not.

@orklah
Copy link
Collaborator

orklah commented Jan 27, 2022

No plan for that no. Changes will be little enough I think and we'll probably advise anyone complaning to update versions anyway...

@AndrolGenhald
Copy link
Collaborator Author

Should I add back in the documentation for loadXdebugStub then with a deprecation/removed note? I worry about people upgrading from an older version of 4 straight to 5, so they might never get the deprecation notice and see what they're supposed to do to fix it.

@orklah
Copy link
Collaborator

orklah commented Jan 28, 2022

Thanks!

@orklah orklah merged commit 2966f1c into vimeo:master Jan 28, 2022
@AndrolGenhald
Copy link
Collaborator Author

@orklah

Should I add back in the documentation for loadXdebugStub then with a deprecation/removed note? I worry about people upgrading from an older version of 4 straight to 5, so they might never get the deprecation notice and see what they're supposed to do to fix it.

@orklah
Copy link
Collaborator

orklah commented Jan 28, 2022

You can add a note in UPGRADING I guess, I'd just like to avoid keeping things in the xml with no uses

@AndrolGenhald
Copy link
Collaborator Author

You can add a note in UPGRADING I guess, I'd just like to avoid keeping things in the xml with no uses

Oh, sorry I wasn't clear enough, I meant the documentation at psalm.dev/docs. If we're not versioning that people will be using Psalm 5 docs for Psalm 4, so we should probably be careful to avoid removing documentation.

@orklah
Copy link
Collaborator

orklah commented Jan 28, 2022

I'm fine with that :)

@weirdan
Copy link
Collaborator

weirdan commented Jan 28, 2022

If we're not versioning that people will be using Psalm 5 docs for Psalm 4, so we should probably be careful to avoid removing documentation.

Should the need arise we'll provide documentation for previous versions on readthedocs.org, so feel free to remove outdated parts from master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Need review release:feature The PR will be included in 'Features' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants