local util = require("lspconfig.util") local utils = require("lsp.utils") -- Only setup if license file exists local license_path = vim.fn.expand("$HOME/.local/share/nvim/intelephense-licence.txt") if not utils.file_exists(license_path) then vim.notify("Intelephense license not found at: " .. license_path, vim.log.levels.WARN) end return { root_dir = function(pattern) local root = util.root_pattern("composer.json", "composer.lock")(pattern) return root or vim.fn.getcwd() end, single_file_support = false, init_options = { licenceKey = license_path, }, settings = { intelephense = { format = { enable = true, sortUseStatements = true, }, stubs = { "bcmath", "bz2", "calendar", "Core", "curl", "date", "dba", "dom", "enchant", "fileinfo", "filter", "ftp", "gd", "gettext", "hash", "iconv", "imap", "intl", "json", "libxml", "mbstring", "mcrypt", "mysql", "mysqli", "password", "pcntl", "pcre", "PDO", "pdo_mysql", "Phar", "readline", "recode", "Reflection", "regex", "session", "SimpleXML", "soap", "sockets", "sodium", "SPL", "standard", "superglobals", "sysvsem", "sysvshm", "tokenizer", "xml", "xdebug", "xmlreader", "xmlwriter", "yaml", "zip", "zlib", "wordpress", "woocommerce", "acf-pro", "wordpress-globals", "wp-cli", }, }, }, }