Skip to content

Commit b8e3f3b

Browse files
TysonAndrefabpot
authored andcommitted
Fix minor phpdoc mismatches with the code(detected by phan)
1 parent add8d73 commit b8e3f3b

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

Escaper.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ class Escaper
3131
"\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f",
3232
"\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17",
3333
"\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f",
34-
"\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9");
34+
"\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",
35+
);
3536
private static $escaped = array('\\\\', '\\"', '\\\\', '\\"',
3637
'\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a',
3738
'\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f',
3839
'\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17',
3940
'\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f',
40-
'\\N', '\\_', '\\L', '\\P');
41+
'\\N', '\\_', '\\L', '\\P',
42+
);
4143

4244
/**
4345
* Determines if a PHP value would require double quoting in YAML.
@@ -48,7 +50,7 @@ class Escaper
4850
*/
4951
public static function requiresDoubleQuoting($value)
5052
{
51-
return preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value);
53+
return 0 < preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value);
5254
}
5355

5456
/**
@@ -80,7 +82,7 @@ public static function requiresSingleQuoting($value)
8082

8183
// Determines if the PHP value contains any single characters that would
8284
// cause it to require single quoting in YAML.
83-
return preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value);
85+
return 0 < preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value);
8486
}
8587

8688
/**

Exception/ParseException.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ class ParseException extends RuntimeException
2626
/**
2727
* Constructor.
2828
*
29-
* @param string $message The error message
30-
* @param int $parsedLine The line where the error occurred
31-
* @param int $snippet The snippet of code near the problem
32-
* @param string $parsedFile The file name where the error occurred
33-
* @param \Exception $previous The previous exception
29+
* @param string $message The error message
30+
* @param int $parsedLine The line where the error occurred
31+
* @param string|null $snippet The snippet of code near the problem
32+
* @param string|null $parsedFile The file name where the error occurred
33+
* @param \Exception|null $previous The previous exception
3434
*/
3535
public function __construct($message, $parsedLine = -1, $snippet = null, $parsedFile = null, \Exception $previous = null)
3636
{

Inline.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,12 @@ private static function dumpArray($value, $exceptionOnInvalidType, $objectSuppor
212212
/**
213213
* Parses a YAML scalar.
214214
*
215-
* @param string $scalar
216-
* @param string $delimiters
217-
* @param array $stringDelimiters
218-
* @param int &$i
219-
* @param bool $evaluate
220-
* @param array $references
215+
* @param string $scalar
216+
* @param string[] $delimiters
217+
* @param string[] $stringDelimiters
218+
* @param int &$i
219+
* @param bool $evaluate
220+
* @param array $references
221221
*
222222
* @return string
223223
*
@@ -443,7 +443,7 @@ private static function parseMapping($mapping, &$i = 0, $references = array())
443443
* @param string $scalar
444444
* @param array $references
445445
*
446-
* @return string A YAML string
446+
* @return mixed The evaluated YAML string
447447
*
448448
* @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved
449449
*/

0 commit comments

Comments
 (0)