|
5 | 5 | * keyed by lowercase function name or "Class::method". resources/functionMetadata.php |
6 | 6 | * is generated from this file by bin/generate-function-metadata.php. |
7 | 7 | * |
8 | | - * Each entry is exactly one of these shapes: |
| 8 | + * Each entry has one of these shapes: |
9 | 9 | * |
10 | 10 | * - ['hasSideEffects' => bool] |
11 | 11 | * false: the call is pure. true: the call has side effects. |
|
17 | 17 | * the call is pure unless one of the listed (by-ref out) parameters |
18 | 18 | * (keyed by parameter name) receives an argument, e.g. str_replace() |
19 | 19 | * whose only side effect is writing to its optional 'count' argument. |
| 20 | + * |
| 21 | + * The last two can be combined for a call that is pure unless either happens, |
| 22 | + * e.g. preg_replace_callback() (impure callback or a passed 'count'). |
20 | 23 | */ |
21 | 24 |
|
22 | | -/** @var array<string, array{hasSideEffects: bool}|array{pureUnlessCallableIsImpureParameters: array<string, bool>}|array{pureUnlessParameterPassedParameters: array<string, bool>}> */ |
| 25 | +/** @var array<string, array{hasSideEffects: bool}|array{pureUnlessCallableIsImpureParameters: array<string, bool>}|array{pureUnlessParameterPassedParameters: array<string, bool>}|array{pureUnlessCallableIsImpureParameters: array<string, bool>, pureUnlessParameterPassedParameters: array<string, bool>}> */ |
23 | 26 | return [ |
24 | 27 | 'abs' => ['hasSideEffects' => false], |
25 | 28 | 'acos' => ['hasSideEffects' => false], |
|
274 | 277 | 'preg_match' => ['pureUnlessParameterPassedParameters' => ['matches' => true, 'subpatterns' => true]], |
275 | 278 | 'preg_match_all' => ['pureUnlessParameterPassedParameters' => ['matches' => true, 'subpatterns' => true]], |
276 | 279 | 'preg_replace' => ['pureUnlessParameterPassedParameters' => ['count' => true]], |
277 | | - 'preg_replace_callback' => ['pureUnlessCallableIsImpureParameters' => ['callback' => true]], |
| 280 | + 'preg_replace_callback' => ['pureUnlessCallableIsImpureParameters' => ['callback' => true], 'pureUnlessParameterPassedParameters' => ['count' => true]], |
278 | 281 | 'similar_text' => ['pureUnlessParameterPassedParameters' => ['percent' => true]], |
279 | 282 | 'readfile' => ['hasSideEffects' => true], |
280 | 283 | 'rename' => ['hasSideEffects' => true], |
|
0 commit comments