Skip to content

Commit 450e2ee

Browse files
committed
fix(cli): allow perform-heuristic-checks setting for bc reasons
Signed-off-by: azjezz <[email protected]>
1 parent 7acd824 commit 450e2ee

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/config/analyzer.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,25 @@ pub struct AnalyzerConfiguration {
165165
///
166166
/// Defaults to `false`.
167167
pub check_property_initialization: bool,
168+
169+
/// **Deprecated**: Use `check-missing-override` and `find-unused-parameters` instead.
170+
///
171+
/// When set to `true`, enables both `check-missing-override` and `find-unused-parameters`.
172+
/// When set to `false`, disables both.
173+
///
174+
/// This option is kept for backwards compatibility with existing configurations.
175+
#[serde(skip_serializing)]
176+
pub perform_heuristic_checks: Option<bool>,
168177
}
169178

170179
impl AnalyzerConfiguration {
171180
pub fn to_settings(&self, php_version: PHPVersion, color_choice: ColorChoice, enable_diff: bool) -> Settings {
181+
// Backwards compatibility: if perform_heuristic_checks is set, use it for both options
182+
let check_missing_override =
183+
self.perform_heuristic_checks.unwrap_or(self.check_missing_override);
184+
let find_unused_parameters =
185+
self.perform_heuristic_checks.unwrap_or(self.find_unused_parameters);
186+
172187
Settings {
173188
version: php_version,
174189
analyze_dead_code: self.analyze_dead_code,
@@ -179,8 +194,8 @@ impl AnalyzerConfiguration {
179194
check_throws: self.check_throws,
180195
unchecked_exceptions: self.unchecked_exceptions.iter().map(|s| atom(s.as_str())).collect(),
181196
unchecked_exception_classes: self.unchecked_exception_classes.iter().map(|s| atom(s.as_str())).collect(),
182-
check_missing_override: self.check_missing_override,
183-
find_unused_parameters: self.find_unused_parameters,
197+
check_missing_override,
198+
find_unused_parameters,
184199
strict_list_index_checks: self.strict_list_index_checks,
185200
no_boolean_literal_comparison: self.no_boolean_literal_comparison,
186201
check_missing_type_hints: self.check_missing_type_hints,
@@ -228,6 +243,7 @@ impl Default for AnalyzerConfiguration {
228243
trust_existence_checks: defaults.trust_existence_checks,
229244
class_initializers: vec![],
230245
check_property_initialization: defaults.check_property_initialization,
246+
perform_heuristic_checks: None,
231247
}
232248
}
233249
}

0 commit comments

Comments
 (0)