Skip to content

Conversation

@mvs3d
Copy link

@mvs3d mvs3d commented Sep 29, 2025

The current stub for round() in standard/standard_3.php defines $mode twice, which causes inspections in PhpStorm to report "Function has a parameter whose default value is incompatible with its declared type".

The current stub for `round()` in `standard/standard_3.php` defines `$mode`
twice, which causes inspections in PhpStorm to report
"Function has a parameter whose default value is incompatible with its declared type".
int|float $num,
int $precision = 0,
#[PhpStormStubsElementAvailable(from: '5.3', to: '8.4')] #[LanguageLevelTypeAware(['8.4' => 'RoundingMode|int'], default: 'int')] $mode = 0,
#[PhpStormStubsElementAvailable(from: '5.3', to: '8.3')] #[LanguageLevelTypeAware(['8.4' => 'RoundingMode|int'], default: 'int')] $mode = 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is incorrect.

You have one $mode defined from 5.3 to 8.4
and one $mode defined from 8.5

It shouldn't overlap.

By changing the 8.4 to 8.3

  • There is no mode defined in 8.4
  • There is a conflict between PhpStormStubsElementAvailable (from 5.3 to 8.3) and the LanguageLevelTypeAware (8.4) which have no php version in common

Copy link
Contributor

Choose a reason for hiding this comment

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

@VincentLanglet Is completely correct. This change is invalid. Speaking about original problem with which causes inspections in PhpStorm to report "Function has a parameter whose default value is incompatible with its declared type". It was caused by previous version of this stub that had only one $mode definition. And the current version of stub aimed to fix exactly this issue. The problem originally reported in ticket https://youtrack.jetbrains.com/issue/WI-82556. Please check if you are using the latest PhpStorm version (2025.2.3)

@isfedorov isfedorov closed this Oct 16, 2025
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.

3 participants