add some missing type declarations

This commit is contained in:
Christian Flothmann 2019-07-26 15:36:30 +02:00
parent 1cc7067cc1
commit f2a4a199b2
2 changed files with 5 additions and 16 deletions

View File

@ -54,10 +54,8 @@ class ParseException extends RuntimeException
/**
* Sets the snippet of code near the error.
*
* @param string $snippet The code snippet
*/
public function setSnippet($snippet)
public function setSnippet(string $snippet)
{
$this->snippet = $snippet;
@ -78,10 +76,8 @@ class ParseException extends RuntimeException
/**
* Sets the filename where the error occurred.
*
* @param string $parsedFile The filename
*/
public function setParsedFile($parsedFile)
public function setParsedFile(string $parsedFile)
{
$this->parsedFile = $parsedFile;
@ -100,10 +96,8 @@ class ParseException extends RuntimeException
/**
* Sets the line where the error occurred.
*
* @param int $parsedLine The file line
*/
public function setParsedLine($parsedLine)
public function setParsedLine(int $parsedLine)
{
$this->parsedLine = $parsedLine;

View File

@ -34,12 +34,7 @@ class Inline
private static $objectForMap = false;
private static $constantSupport = false;
/**
* @param int $flags
* @param int|null $parsedLineNumber
* @param string|null $parsedFilename
*/
public static function initialize($flags, $parsedLineNumber = null, $parsedFilename = null)
public static function initialize(int $flags, int $parsedLineNumber = null, string $parsedFilename = null)
{
self::$exceptionOnInvalidType = (bool) (Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $flags);
self::$objectSupport = (bool) (Yaml::PARSE_OBJECT & $flags);
@ -704,7 +699,7 @@ class Inline
return base64_decode($parsedBinaryData, true);
}
private static function isBinaryString(string $value)
private static function isBinaryString(string $value): bool
{
return !preg_match('//u', $value) || preg_match('/[^\x00\x07-\x0d\x1B\x20-\xff]/', $value);
}