8000 [Yaml] add some missing type declarations by xabbuh · Pull Request #32761 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Yaml] add some missing type declarations #32761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/Symfony/Component/Yaml/Exception/ParseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ public function getSnippet()

/**
* 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;

Expand All @@ -78,10 +76,8 @@ public function getParsedFile()

/**
* Sets the filename where the error occurred.
*
* @param string $parsedFile The filename
*/
public function setParsedFile($parsedFile)
public function setParsedFile(string $parsedFile)
{
$this->parsedFile = $parsedFile;

Expand All @@ -100,10 +96,8 @@ public function getParsedLine()

/**
* 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;

Expand Down
9 changes: 2 additions & 7 deletions src/Symfony/Component/Yaml/Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -704,7 +699,7 @@ public static function evaluateBinaryScalar(string $scalar): string
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);
}
Expand Down
0