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

Add <psalm phpVersion="7.2" support to psalm.xml #2628

Closed
TysonAndre opened this issue Jan 15, 2020 · 7 comments · Fixed by #2715
Closed

Add <psalm phpVersion="7.2" support to psalm.xml #2628

TysonAndre opened this issue Jan 15, 2020 · 7 comments · Fixed by #2715

Comments

@TysonAndre
Copy link
Contributor

(the syntax isn't important)

Related to #1191

Some applications will only be deployed on one version of php most of the time.
It's inconvenient to add --php-version 7.2 to all invocations (language server, manual runs, etc).

--php-version should override the psalm.xml setting.

@psalm-github-bot
Copy link

Hey @TysonAndre, can you reproduce the issue on https://psalm.dev ?

@Aerendir
Copy link

Just looking for a way to specify the PHP version supported: so, currently there is no way to specifcy which version to check against? Because Psalm warns that I can add a type hint to method param, but I cannot as the interface doesn't have one and the concrete method cannot add it without breaking the code on PHP 7.2.

@weirdan
Copy link
Collaborator

weirdan commented Jan 16, 2020

@Aerendir it's not possible to specify in the config currently, but you can pass --php-version 7.2 in cli arguments.

@Aerendir
Copy link

--php-version 7.2

I get this error:

Cannot local 7.2

🤔

@SignpostMarv
Copy link
Contributor

--php-version 7.2

I get this error:

Cannot local 7.2

🤔

--php-version=7.2

@Aerendir
Copy link

It works with the = sign, but it should be able to read it also without it 🤔Anyway, it works...

@pilif
Copy link
Contributor

pilif commented Jan 30, 2020

Another idea would be to get the version from the minimum specified in composer.json if one is present.

I'll try my hands on a PR

pilif added a commit to pilif/psalm that referenced this issue Jan 30, 2020
if a composer.json is present and a PHP version requirement is
configured, we set the php version to the minimal PHP version that
satisfies the composer requirement.

Additionally, this adds a `phpVersion` attribute to the <psalm> tag. If
that's set, it takes precedence over what has been detected in
composer.json.

And finally, the --php-version command line flag continues to work and
takes precedence over the setting in the <psalm> tag

this fixes vimeo#2628
pilif added a commit to pilif/psalm that referenced this issue Jan 30, 2020
if a composer.json is present and a PHP version requirement is
configured, we set the php version to the minimal PHP version that
satisfies the composer requirement.

Additionally, this adds a `phpVersion` attribute to the <psalm> tag. If
that's set, it takes precedence over what has been detected in
composer.json.

And finally, the --php-version command line flag continues to work and
takes precedence over the setting in the <psalm> tag

this fixes vimeo#2628
muglug pushed a commit that referenced this issue Jan 30, 2020
if a composer.json is present and a PHP version requirement is
configured, we set the php version to the minimal PHP version that
satisfies the composer requirement.

Additionally, this adds a `phpVersion` attribute to the <psalm> tag. If
that's set, it takes precedence over what has been detected in
composer.json.

And finally, the --php-version command line flag continues to work and
takes precedence over the setting in the <psalm> tag

this fixes #2628
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants