Skip to content

Commit e9e3c1b

Browse files
committed
Align PHPDoc @param and callback signatures with official PHP documentation, improving clarity and consistency across stubs.
1 parent aff8564 commit e9e3c1b

3 files changed

Lines changed: 63 additions & 37 deletions

File tree

PDO/PDO.php

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,21 +2268,26 @@ class Sqlite extends PDO
22682268
* @param string $name The name of the function used in SQL statements.
22692269
* @param callable $step Callback function called for each row of the result set. The
22702270
* callback should accumulate the result and store it in the aggregation context. This
2271-
* function need to be defined as: mixedstep mixedcontext intrownumber mixedvalue
2272-
* mixedvalues context null for the first row; on subsequent rows it will have the value
2273-
* that was previously returned from the step function; you should use this to maintain the
2274-
* aggregate state. rownumber The current row number. value The first argument passed to the
2275-
* aggregate. values Further arguments passed to the aggregate. The return value of this
2276-
* function will be used as the context argument in the next call of the step or finalize
2277-
* functions.
2271+
* function need to be defined as:
2272+
* <code>step ( mixed $context , int $rownumber , mixed $value , mixed $values ): mixed</code>
2273+
* <br/>$context - null for the first row; on subsequent rows it will have the value that was
2274+
* previously returned from the step function; you should use this to maintain the aggregate
2275+
* state.
2276+
* <br/>$rownumber - The current row number.
2277+
* <br/>$value - The first argument passed to the aggregate.
2278+
* <br/>$values - Further arguments passed to the aggregate.
2279+
* <br/>The return value of this function will be used as the context argument in the next
2280+
* call of the step or finalize functions.
22782281
* @param callable $finalize Callback function to aggregate the "stepped" data from each
22792282
* row. Once all the rows have been processed, this function will be called, and it should
22802283
* then take the data from the aggregation context and return the result. This callback
22812284
* function should return a type understood by SQLite (i.e. scalar type). This function need
2282-
* to be defined as: mixedfini mixedcontext introwcount context Holds the return value from
2283-
* the very last call to the step function. rowcount Holds the number of rows over which the
2284-
* aggregate was performed. The return value of this function will be used as the return
2285-
* value for the aggregate.
2285+
* to be defined as:
2286+
* <code>fini ( mixed $context , int $rowcount ): mixed</code>
2287+
* <br/>$context - Holds the return value from the very last call to the step function.
2288+
* <br/>$rowcount - Holds the number of rows over which the aggregate was performed.
2289+
* <br/>The return value of this function will be used as the return value for the
2290+
* aggregate.
22862291
* @param int $numArgs Hint to the SQLite parser if the callback function accepts a
22872292
* predetermined number of arguments.
22882293
* @return bool Returns true on success or false on failure.
@@ -2322,8 +2327,10 @@ public function createCollation(string $name, callable $callback): bool {}
23222327
* @param string $function_name The name of the function used in SQL statements.
23232328
* @param callable $callback Callback function to handle the defined SQL function. Callback
23242329
* functions should return a type understood by SQLite (i.e. scalar type). This function
2325-
* need to be defined as: mixedcallback mixedvalue mixedvalues value The first argument
2326-
* passed to the SQL function. values Further arguments passed to the SQL function.
2330+
* need to be defined as:
2331+
* <code>callback ( mixed $value , mixed $values ): mixed</code>
2332+
* <br/>$value - The first argument passed to the SQL function.
2333+
* <br/>$values - Further arguments passed to the SQL function.
23272334
* @param int $num_args The number of arguments that the SQL function takes. If this
23282335
* parameter is -1, then the SQL function may take any number of arguments.
23292336
* @param int $flags A bitmask of flags. Currently, only Pdo\Sqlite::DETERMINISTIC is

ds_v2/ds.php

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,10 @@ public function __construct(iterable $values = []) {}
280280
public function allocate(int $capacity): void {}
281281

282282
/**
283-
* @param callable(TKey, TValue): TValue $callback mixed callback mixedkey mixedvalue A callable
284-
* to apply to each value in the map. The callback should return what the value should be
285-
* replaced by.
283+
* @param callable(TKey, TValue): TValue $callback
284+
* <code>callback ( mixed $key , mixed $value ): mixed</code>
285+
* <br/>A callable to apply to each value in the map. The callback should return what the value
286+
* should be replaced by.
286287
*/
287288
public function apply(callable $callback): void {}
288289

@@ -304,9 +305,11 @@ public function count(): int {}
304305
public function diff(Map $map): Map {}
305306

306307
/**
307-
* @param null|callable(TKey, TValue): bool $callback bool callback mixedkey mixedvalue Optional
308-
* callable which returns true if the pair should be included, false otherwise. If a callback is
309-
* not provided, only values which are true (see converting to boolean) will be included.
308+
* @param null|callable(TKey, TValue): bool $callback
309+
* <code>callback ( mixed $key , mixed $value ): bool</code>
310+
* <br/>Optional callable which returns true if the pair should be included, false otherwise. If
311+
* a callback is not provided, only values which are true (see converting to boolean) will be
312+
* included.
310313
* @return Map<TKey, TValue> A new map containing all the pairs for which either the callback
311314
* returned true, or all values that convert to true if a callback was not provided.
312315
*/
@@ -382,9 +385,10 @@ public function last(): Pair {}
382385

383386
/**
384387
* @template TReturn
385-
* @param callable(TKey, TValue): TReturn $callback mixed callback mixedkey mixedvalue A
386-
* callable to apply to each value in the map. The callable should return what the key will be
387-
* mapped to in the resulting map.
388+
* @param callable(TKey, TValue): TReturn $callback
389+
* <code>callback ( mixed $key , mixed $value ): mixed</code>
390+
* <br/>A callable to apply to each value in the map. The callable should return what the key
391+
* will be mapped to in the resulting map.
388392
* @return Map<TKey, TReturn> The result of applying a callback to each value in the map. The
389393
* keys and values of the current instance won't be affected.
390394
*/
@@ -415,10 +419,12 @@ public function putAll($values): void {}
415419
/**
416420
* @template TInitial
417421
* @template TReturn
418-
* @param callable(TInitial|TReturn|null, TKey, TValue): TReturn $callback mixedcallback
419-
* mixedcarry mixedkey mixedvalue carry The return value of the previous callback, or initial if
420-
* it's the first iteration. key The key of the current iteration. value The value of the
421-
* current iteration.
422+
* @param callable(TInitial|TReturn|null, TKey, TValue): TReturn $callback
423+
* <code>callback ( mixed $carry , mixed $key , mixed $value ): mixed</code>
424+
* <br/>$carry - The return value of the previous callback, or initial if it's the first
425+
* iteration.
426+
* <br/>$key - The key of the current iteration.
427+
* <br/>$value - The value of the current iteration.
422428
* @param TInitial|null $initial The initial value of the carry value. Can be null.
423429
* @return TReturn|null The return value of the final callback.
424430
*/
@@ -591,9 +597,11 @@ public function count(): int {}
591597
public function diff(Set $set): Set {}
592598

593599
/**
594-
* @param null|callable(TValue): bool $callback bool callback mixedvalue Optional callable which
595-
* returns true if the value should be included, false otherwise. If a callback is not provided,
596-
* only values which are true (see converting to boolean) will be included.
600+
* @param null|callable(TValue): bool $callback
601+
* <code>callback ( mixed $value ): bool</code>
602+
* <br/>Optional callable which returns true if the value should be included, false otherwise.
603+
* If a callback is not provided, only values which are true (see converting to boolean) will be
604+
* included.
597605
* @return Set<TValue> A new set containing all the values for which either the callback
598606
* returned true, or all values that convert to true if a callback was not provided.
599607
*/
@@ -632,7 +640,8 @@ public function last() {}
632640
/**
633641
* @template TReturn
634642
* @param callable(TValue): TReturn $callback The callback to apply to each value in the set
635-
* must have the following signature: mixed callback mixedvalue
643+
* must have the following signature:
644+
* <code>callback ( mixed $value ): mixed</code>
636645
* @return Set<TReturn> Returns a new Ds\Set instance where each value is the result of applying
637646
* the callback to each value of the set.
638647
*/
@@ -649,9 +658,11 @@ public function merge($values): Set {}
649658
/**
650659
* @template TInitial
651660
* @template TReturn
652-
* @param callable(TInitial|TReturn|null, TValue): TReturn $callback mixedcallback mixedcarry
653-
* mixedvalue carry The return value of the previous callback, or initial if it's the first
654-
* iteration. value The value of the current iteration.
661+
* @param callable(TInitial|TReturn|null, TValue): TReturn $callback
662+
* <code>callback ( mixed $carry , mixed $value ): mixed</code>
663+
* <br/>$carry - The return value of the previous callback, or initial if it's the first
664+
* iteration.
665+
* <br/>$value - The value of the current iteration.
655666
* @param TInitial|null $initial The initial value of the carry value. Can be null.
656667
* @return TReturn|null The return value of the final callback.
657668
*/

standard/standard_10.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
* @template TValue
1111
* @param array<TKey, TValue> $array The array that should be searched.
1212
* @param callable(TValue, TKey): bool $callback The callback function to call to check each element, which must be of
13-
* the following signature: boolcallback mixedvalue mixedkey If this function returns true, the
13+
* the following signature:
14+
* <code>callback ( mixed $value , mixed $key ): bool</code>
15+
* <br/>If this function returns true, the
1416
* value is returned from array_find and the callback will not be called for further elements.
1517
* @return TValue|null The function returns the value of the first element for which the callback
1618
* returns true. If no matching element is found the function returns null.
@@ -26,7 +28,9 @@ function array_find(array $array, callable $callback): mixed {}
2628
* @template TValue
2729
* @param array<TKey, TValue> $array The array that should be searched.
2830
* @param callable(TValue, TKey): bool $callback The callback function to call to check each element, which must be of
29-
* the following signature: boolcallback mixedvalue mixedkey If this function returns true, the key
31+
* the following signature:
32+
* <code>callback ( mixed $value , mixed $key ): bool</code>
33+
* <br/>If this function returns true, the key
3034
* is returned from array_find_key and the callback will not be called for further elements.
3135
* @return TKey|null The function returns the key of the first element for which the callback
3236
* returns true. If no matching element is found the function returns null.
@@ -44,7 +48,9 @@ function array_find_key(array $array, callable $callback): mixed {}
4448
* @template TValue
4549
* @param array<TKey, TValue> $array The array that should be searched.
4650
* @param callable(TValue, TKey): bool $callback The callback function to call to check each element, which must be of
47-
* the following signature: boolcallback mixedvalue mixedkey If this function returns true, true is
51+
* the following signature:
52+
* <code>callback ( mixed $value , mixed $key ): bool</code>
53+
* <br/>If this function returns true, true is
4854
* returned from array_any and the callback will not be called for further elements.
4955
* @return bool The function returns true, if there is at least one element for which callback
5056
* returns true. Otherwise the function returns false.
@@ -60,7 +66,9 @@ function array_any(array $array, callable $callback): bool {}
6066
* @template TValue
6167
* @param array<TKey, TValue> $array The array that should be searched.
6268
* @param callable(TValue, TKey): bool $callback The callback function to call to check each element, which must be of
63-
* the following signature: boolcallback mixedvalue mixedkey If this function returns false, false
69+
* the following signature:
70+
* <code>callback ( mixed $value , mixed $key ): bool</code>
71+
* <br/>If this function returns false, false
6472
* is returned from array_all and the callback will not be called for further elements.
6573
* @return bool The function returns true, if callback returns true for all elements. Otherwise the
6674
* function returns false.

0 commit comments

Comments
 (0)