mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-27 20:29:39 +02:00
refactor(dynamic): enhance resolver detection for frameworks, refine SSA receiver validation, and expand test coverage
This commit is contained in:
parent
3027c1afa7
commit
f49211d788
38 changed files with 1198 additions and 137 deletions
|
|
@ -59,7 +59,7 @@ impl FrameworkAdapter for MiddlewareLaravelAdapter {
|
|||
let has_shape = source_has_middleware_shape(file_bytes);
|
||||
let name_matches = name_is_middleware_entry(&summary.name);
|
||||
let body_mounts_middleware =
|
||||
super::any_callee_matches(summary, callee_is_laravel_middleware);
|
||||
has_shape && super::any_callee_matches(summary, callee_is_laravel_middleware);
|
||||
let binds = (name_matches && has_shape) || body_mounts_middleware;
|
||||
if !binds {
|
||||
return None;
|
||||
|
|
@ -118,4 +118,25 @@ mod tests {
|
|||
"controller method must not bind as middleware just because the file imports Request",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn does_not_bind_with_middleware_call_without_contract_shape() {
|
||||
let src: &[u8] = b"<?php\nclass Bootstrapper {\n public function configure($app) { return $app->withMiddleware([]); }\n}\n";
|
||||
let tree = parse_php(src);
|
||||
let mut summary = FuncSummary {
|
||||
name: "configure".into(),
|
||||
..Default::default()
|
||||
};
|
||||
summary.callees.push(crate::summary::CalleeSite {
|
||||
name: "app.withMiddleware".to_owned(),
|
||||
receiver: Some("app".to_owned()),
|
||||
ordinal: 0,
|
||||
..Default::default()
|
||||
});
|
||||
assert!(
|
||||
MiddlewareLaravelAdapter
|
||||
.detect(&summary, tree.root_node(), src)
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue