Skip to content

Commit

Permalink
fix(linter): fix linter rule test runner to correctly determine PHP v…
Browse files Browse the repository at this point in the history
…ersion compatibility

Signed-off-by: azjezz <azjezz@protonmail.com>
  • Loading branch information
azjezz committed Jan 18, 2025
1 parent 9dbab1b commit 8e63423
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/linter/tests/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ pub fn test_rule_usage_example(rule: Box<dyn Rule>, usage_example: &RuleUsageExa
let reflection = mago_reflector::reflect(&interner, &source, &semantics.program, &semantics.names);

let mut php_version = PHPVersion::PHP84;
if let Some(version) = rule.get_definition().maximum_supported_php_version {
php_version = PHPVersion::from_version_id(version.to_version_id() - 1);
}
if let Some(version) = rule.get_definition().minimum_supported_php_version {
php_version = version;
} else if let Some(version) = rule.get_definition().maximum_supported_php_version {
php_version = version;
}

let settings = Settings::new(php_version).with_rule(format!("test/{}", definition.get_slug()), rule_settings);
Expand Down

0 comments on commit 8e63423

Please sign in to comment.