Initialize a pure non-Composer workspace (no `composer.json` anywhere). Full-scans all PHP files in the workspace.
(
&self,
root: &std::path::Path,
php_version: crate::types::PhpVersion,
progress_token: Option<&NumberOrString>,
)
| 1788 | /// Initialize a pure non-Composer workspace (no `composer.json` |
| 1789 | /// anywhere). Full-scans all PHP files in the workspace. |
| 1790 | async fn init_no_composer( |
| 1791 | &self, |
| 1792 | root: &std::path::Path, |
| 1793 | php_version: crate::types::PhpVersion, |
| 1794 | progress_token: Option<&NumberOrString>, |
| 1795 | ) { |
| 1796 | self.log( |
| 1797 | MessageType::INFO, |
| 1798 | "PHPantom: No composer.json found. Scanning workspace for PHP classes.".to_string(), |
| 1799 | ) |
| 1800 | .await; |
| 1801 | |
| 1802 | if let Some(tok) = progress_token { |
| 1803 | self.progress_report( |
| 1804 | tok, |
| 1805 | 20, |
| 1806 | Some("Scanning workspace for PHP files".to_string()), |
| 1807 | ) |
| 1808 | .await; |
| 1809 | } |
| 1810 | |
| 1811 | let skip_dirs = HashSet::new(); |
| 1812 | let scan = classmap_scanner::scan_workspace_fallback_full(root, &skip_dirs); |
| 1813 | self.populate_autoload_indices(&scan); |
| 1814 | |
| 1815 | let symbol_count = scan.classmap.len(); |
| 1816 | { |
| 1817 | let mut idx = self.fqn_uri_index.write(); |
| 1818 | for (fqn, path) in scan.classmap { |
| 1819 | idx.entry(fqn) |
| 1820 | .or_insert_with(|| crate::util::path_to_uri(&path)); |
| 1821 | } |
| 1822 | } |
| 1823 | |
| 1824 | let symbol_count = symbol_count |
| 1825 | + self.autoload_function_index.read().len() |
| 1826 | + self.autoload_constant_index.read().len(); |
| 1827 | |
| 1828 | self.log( |
| 1829 | MessageType::INFO, |
| 1830 | format!( |
| 1831 | "PHPantom v{}: PHP {}, {} symbols from workspace scan, stubs {}", |
| 1832 | self.version, |
| 1833 | php_version, |
| 1834 | symbol_count, |
| 1835 | crate::stubs::STUBS_VERSION |
| 1836 | ), |
| 1837 | ) |
| 1838 | .await; |
| 1839 | } |
| 1840 | |
| 1841 | /// Register a vendor directory path and its URI prefix for |
| 1842 | /// vendor-file detection. |
no test coverage detected