Check whether a raw type string refers to a class that cannot be loaded. Returns `Some(class_name)` when the type looks like a class name (not scalar, not a PHPDoc pseudo-type) but the class loader cannot find it. Returns `None` for scalars, unions, shapes, and types that resolve successfully.
(
raw_type: &PhpType,
class_loader: &dyn Fn(&str) -> Option<Arc<ClassInfo>>,
)
| 1203 | /// find it. Returns `None` for scalars, unions, shapes, and types |
| 1204 | /// that resolve successfully. |
| 1205 | fn check_unresolvable_class_name( |
| 1206 | raw_type: &PhpType, |
| 1207 | class_loader: &dyn Fn(&str) -> Option<Arc<ClassInfo>>, |
| 1208 | ) -> Option<PhpType> { |
| 1209 | if raw_type.all_members_scalar() { |
| 1210 | return None; |
| 1211 | } |
| 1212 | |
| 1213 | let effective = raw_type.non_null_type().unwrap_or_else(|| raw_type.clone()); |
| 1214 | let base = effective.base_name()?; |
| 1215 | |
| 1216 | if class_loader(base).is_none() { |
| 1217 | Some(PhpType::Named(base.to_string())) |
| 1218 | } else { |
| 1219 | None |
| 1220 | } |
| 1221 | } |
| 1222 | |
| 1223 | /// Shared variable-resolution logic extracted from the former |
| 1224 | /// bare-`$var` branch of `resolve_target_classes`. |
no test coverage detected