1<?php 2/** 3 * PHPStan stubs for DokuWiki framework classes. 4 * These provide type signatures so PHPStan can analyse DokuWiki plugins 5 * without requiring a full DokuWiki installation. 6 */ 7 8namespace dokuwiki\Extension { 9 10 class Plugin 11 { 12 public function getLang(string $key): string 13 { 14 return ''; 15 } 16 17 /** 18 * @return mixed 19 */ 20 public function getConf(string $key) 21 { 22 return ''; 23 } 24 } 25 26 class ActionPlugin extends Plugin 27 { 28 public function register(EventHandler $controller): void 29 { 30 } 31 } 32 33 class SyntaxPlugin extends Plugin 34 { 35 /** @var object */ 36 public $Lexer; 37 38 public function getPType(): string 39 { 40 return ''; 41 } 42 43 public function getType(): string 44 { 45 return ''; 46 } 47 48 public function getSort(): int 49 { 50 return 0; 51 } 52 53 public function connectTo(string $mode): void 54 { 55 } 56 57 public function postConnect(): void 58 { 59 } 60 61 /** 62 * @param mixed[] $data 63 * @return mixed[] 64 */ 65 public function handle(string $match, int $state, int $pos, \Doku_Handler $handler): array 66 { 67 return []; 68 } 69 70 /** 71 * @param mixed[] $data 72 */ 73 public function render(string $mode, \Doku_Renderer $renderer, array $data): bool 74 { 75 return false; 76 } 77 } 78 79 class EventHandler 80 { 81 /** 82 * @param mixed $param 83 */ 84 public function register_hook(string $event, string $advise, object $obj, string $method, $param = null): void 85 { 86 } 87 } 88 89 class Event 90 { 91 /** @var mixed */ 92 public $data; 93 94 public function stopPropagation(): void 95 { 96 } 97 98 public function preventDefault(): void 99 { 100 } 101 } 102} 103 104namespace dokuwiki\File { 105 106 class MediaResolver 107 { 108 public function __construct(string $id) 109 { 110 } 111 112 public function resolveId(string $src): string 113 { 114 return ''; 115 } 116 } 117} 118 119namespace dokuwiki\Form { 120 121 class Form 122 { 123 } 124} 125 126namespace { 127 128 class Doku_Handler 129 { 130 } 131 132 class Doku_Renderer 133 { 134 /** @var string */ 135 public string $doc = ''; 136 137 /** 138 * @param array<string, mixed> $data 139 */ 140 public function startSectionEdit(int $start, array $data): string 141 { 142 return ''; 143 } 144 145 public function finishSectionEdit(int $end = 0): void 146 { 147 } 148 } 149 150 class Doku_Form 151 { 152 public function setHiddenField(string $name, string $value): void 153 { 154 } 155 156 public function addHTML(string $html): void 157 { 158 } 159 160 /** @return int|false */ 161 public function findPositionByAttribute(string $name, string $value) 162 { 163 return false; 164 } 165 166 public function removeElement(int $pos): void 167 { 168 } 169 } 170 171 class renderer_plugin_dw2pdf extends Doku_Renderer 172 { 173 } 174 175 // DokuWiki constants 176 define('DOKU_LEXER_ENTER', 1); 177 define('DOKU_LEXER_MATCHED', 2); 178 define('DOKU_LEXER_UNMATCHED', 3); 179 define('DOKU_LEXER_EXIT', 4); 180 define('DOKU_LEXER_SPECIAL', 5); 181 define('AUTH_READ', 1); 182 define('DOKU_BASE', '/'); 183 184 /** 185 * @param string $text 186 * @return mixed[] 187 */ 188 function p_get_instructions(string $text): array 189 { 190 return []; 191 } 192 193 /** 194 * @param mixed[] $instructions 195 * @param mixed[] $info 196 */ 197 function p_render(string $mode, array $instructions, array &$info): string 198 { 199 return ''; 200 } 201 202 /** 203 * @return object|null 204 */ 205 function plugin_load(string $type, string $name) 206 { 207 return null; 208 } 209 210 function auth_quickaclcheck(string $id): int 211 { 212 return 0; 213 } 214 215 function mediaFN(string $id): string 216 { 217 return ''; 218 } 219 220 function cleanID(string $id): string 221 { 222 return ''; 223 } 224 225 function msg(string $message, int $lvl = 0): void 226 { 227 } 228} 229