@@ -99,7 +99,7 @@ |
||
99 | 99 | // in case a named parameter appears multiple times in the format string |
100 | 100 | if ($paramKeys[$paramName] === -1) { |
101 | 101 | // no - it needs a home |
102 | - $messageData[$nextData] =& $args[$paramName]; |
|
102 | + $messageData[$nextData] = & $args[$paramName]; |
|
103 | 103 | $paramKeys[$paramName] = $nextData; |
104 | 104 | $nextData++; |
105 | 105 | } |
@@ -52,7 +52,8 @@ discard block |
||
52 | 52 | * the unmodified $key if it is not a string |
53 | 53 | * the quoted $key if it is a string |
54 | 54 | */ |
55 | -function quote_index($key) { |
|
55 | +function quote_index($key) |
|
56 | +{ |
|
56 | 57 | if (!is_string($key)) { |
57 | 58 | return $key; |
58 | 59 | } |
@@ -68,7 +69,8 @@ discard block |
||
68 | 69 | * the property name to add braces to (if required) |
69 | 70 | * @return string |
70 | 71 | */ |
71 | -function quote_property($propertyName) { |
|
72 | +function quote_property($propertyName) |
|
73 | +{ |
|
72 | 74 | // robustness! |
73 | 75 | if (!check_is_stringy($propertyName)) { |
74 | 76 | throw new InvalidArgumentException('$propertyName is not a valid class or object property name'); |
@@ -118,14 +118,14 @@ |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | // if we get here, then $item will coerce to a PHP numeric type :) |
121 | - return [ $retval => $retval ]; |
|
121 | + return [$retval => $retval]; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | private static function fromObject($item) |
125 | 125 | { |
126 | 126 | // does this object support being converted to a string? |
127 | 127 | if (method_exists($item, '__toString')) { |
128 | - return [ 'string' => 'string' ]; |
|
128 | + return ['string' => 'string']; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // no, it does not |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | class GetStrictTypes |
50 | 50 | { |
51 | 51 | private static $dispatchMap = [ |
52 | - 'array' => [ GetArrayTypes::class, 'from' ], |
|
53 | - 'object' => [ GetObjectTypes::class, 'from' ], |
|
54 | - 'string' => [ GetStringTypes::class, 'from' ], |
|
52 | + 'array' => [GetArrayTypes::class, 'from'], |
|
53 | + 'object' => [GetObjectTypes::class, 'from'], |
|
54 | + 'string' => [GetStringTypes::class, 'from'], |
|
55 | 55 | ]; |
56 | 56 | |
57 | 57 | /** |
@@ -84,6 +84,6 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | // if we get here, then we just return the PHP scalar type |
87 | - return [ $type => $type ]; |
|
87 | + return [$type => $type]; |
|
88 | 88 | } |
89 | 89 | } |
@@ -88,7 +88,7 @@ |
||
88 | 88 | |
89 | 89 | // PHP's stack trace is a little esoteric. To find all the details about |
90 | 90 | // a caller, we have to combine information from two stack frames. |
91 | - $prevFrame = $backtrace[max($index - 1,0)]; |
|
91 | + $prevFrame = $backtrace[max($index - 1, 0)]; |
|
92 | 92 | |
93 | 93 | // find the first backtrace entry that passes our filters |
94 | 94 | for ($i = $index; $i <= $maxIndex; $i++) { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | // if we get here, then we just return the PHP scalar type |
94 | - return [ $type => $type ]; |
|
94 | + return [$type => $type]; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $retval = array_merge( |
131 | 131 | GetObjectTypes::from($item), |
132 | 132 | self::getObjectSpecialTypes($item), |
133 | - [ 'object' => 'object' ] |
|
133 | + ['object' => 'object'] |
|
134 | 134 | ); |
135 | 135 | |
136 | 136 | return $retval; |
@@ -194,7 +194,7 @@ |
||
194 | 194 | * |
195 | 195 | * @param mixed $item |
196 | 196 | * the item to examine |
197 | - * @return array |
|
197 | + * @return string[] |
|
198 | 198 | * the basic type of the examined item |
199 | 199 | */ |
200 | 200 | private static function fromString($item) |
@@ -157,7 +157,7 @@ |
||
157 | 157 | { |
158 | 158 | // does this object support being converted to a string? |
159 | 159 | if (method_exists($item, '__toString')) { |
160 | - return [ 'string' => 'string' ]; |
|
160 | + return ['string' => 'string']; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | // no, it does not |
@@ -45,17 +45,17 @@ |
||
45 | 45 | use GanbaroDigital\MissingBits\ListTraversals\TraverseList; |
46 | 46 | use GanbaroDigital\MissingBits\ListTraversals\TraverseObject; |
47 | 47 | |
48 | - /** |
|
49 | - * traverse a list held in an array |
|
50 | - * |
|
51 | - * @param array $list |
|
52 | - * the list to walk |
|
53 | - * @param string $listName |
|
54 | - * what is the name of $list in the calling code? |
|
55 | - * @param callable $callable |
|
56 | - * what are we calling |
|
57 | - * @return void |
|
58 | - */ |
|
48 | + /** |
|
49 | + * traverse a list held in an array |
|
50 | + * |
|
51 | + * @param array $list |
|
52 | + * the list to walk |
|
53 | + * @param string $listName |
|
54 | + * what is the name of $list in the calling code? |
|
55 | + * @param callable $callable |
|
56 | + * what are we calling |
|
57 | + * @return void |
|
58 | + */ |
|
59 | 59 | function traverse_array($list, $listName, callable $callable) |
60 | 60 | { |
61 | 61 | return TraverseArray::using($list, $listName, $callable); |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | /** |
544 | 544 | * is $item something that PHP will accept as a string? |
545 | 545 | * |
546 | - * @param mixed $item |
|
546 | + * @param string $item |
|
547 | 547 | * the variable to examine |
548 | 548 | * @return bool |
549 | 549 | * TRUE if PHP will happily use $item as a string |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | /** |
653 | 653 | * what PHP type is $item? |
654 | 654 | * |
655 | - * @param mixed $item |
|
655 | + * @param string $item |
|
656 | 656 | * the data to examine |
657 | 657 | * @param int $flags |
658 | 658 | * options to change what we put in the return value |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | * |
670 | 670 | * @param mixed $item |
671 | 671 | * the item to examine |
672 | - * @return array |
|
672 | + * @return string[] |
|
673 | 673 | * the list of type(s) that this item can be |
674 | 674 | */ |
675 | 675 | function get_strict_types($item) |
@@ -164,7 +164,7 @@ |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | // $item contains an <object, method> pair |
167 | - return "callable<" . get_class($item[0]). "::" . $item[1] . ">"; |
|
167 | + return "callable<" . get_class($item[0]) . "::" . $item[1] . ">"; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |