Skip to content

Named argument detection is scope php-version dependent #3662

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

Merged
merged 3 commits into from
Dec 20, 2024

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Nov 24, 2024

@staabm staabm marked this pull request as ready for review November 24, 2024 09:33
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@@ -1,7 +1,7 @@
<?php

namespace FunctionNamedArguments;

if (PHP_VERSION_ID < 80000) return;
Copy link
Member

Choose a reason for hiding this comment

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

We don't need this here, right? The test should run only on PHP 8+.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the test which uses this file, has error expectations for PHP 7, see

if (PHP_VERSION_ID < 80000) {
$errors[] = [
'Missing parameter $arr1 (array) in call to function array_merge.',
14,
];
}

Copy link
Member

Choose a reason for hiding this comment

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

It doesn't make sense to me. PHP 7.x does not support named arguments so it doesn't make sense to check them?

Copy link
Contributor Author

@staabm staabm Nov 25, 2024

Choose a reason for hiding this comment

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

so do you say I should skip the test on php7, or should the test be made to assert 0 errors on php7?
(and I guess the rule needs adjustments for that)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went with skipping the tests for now

@staabm staabm force-pushed the named-args branch 3 times, most recently from 5f93ffc to 87418b6 Compare November 26, 2024 07:51
@ondrejmirtes ondrejmirtes merged commit 8fd217a into phpstan:2.0.x Dec 20, 2024
424 of 426 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the named-args branch December 20, 2024 09:08
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