Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d7992dc

Browse files
committed
Merge branch '3.4'
* 3.4: [Yaml] fix the displayed line number feature #23294 [Yaml][Lint] Add line numbers to JSON output. (WybrenKoelmans)
2 parents 1c106da + 7787343 commit d7992dc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Symfony/Component/Yaml/Command/LintCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private function validate($content, $file = null)
105105
{
106106
$prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) {
107107
if (E_USER_DEPRECATED === $level) {
108-
throw new ParseException($message, $this->getParser()->getLastLineNumberBeforeDeprecation());
108+
throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1);
109109
}
110110

111111
return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : false;

src/Symfony/Component/Yaml/Parser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,11 @@ private function parseBlock($offset, $yaml, $flags)
413413
/**
414414
* Returns the current line number (takes the offset into account).
415415
*
416+
* @internal
417+
*
416418
* @return int The current line number
417419
*/
418-
private function getRealCurrentLineNb()
420+
public function getRealCurrentLineNb()
419421
{
420422
$realCurrentLineNumber = $this->currentLineNb + $this->offset;
421423

0 commit comments

Comments
 (0)