Skip to content

Commit 5c0f6ce

Browse files
committed
Fix possible errors
1 parent 8181937 commit 5c0f6ce

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

src/Files/Line.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
class Line implements LineInterface
1414
{
15-
private $file;
16-
private $lineNr;
17-
private $line;
15+
private FileInterface $file;
16+
private int $lineNr;
17+
private string $line;
1818

1919
/**
2020
* @param FileInterface $file
@@ -32,7 +32,7 @@ public function __construct(FileInterface $file, $lineNr, $line)
3232
* Get the file for this specific line.
3333
* @return FileInterface
3434
*/
35-
public function getFile()
35+
public function getFile(): FileInterface
3636
{
3737
return $this->file;
3838
}
@@ -41,7 +41,7 @@ public function getFile()
4141
* Get the line number.
4242
* @return int
4343
*/
44-
public function getLineNr()
44+
public function getLineNr(): int
4545
{
4646
return $this->lineNr;
4747
}
@@ -50,8 +50,8 @@ public function getLineNr()
5050
* Get the actual code for this line.
5151
* @return string
5252
*/
53-
public function getLine()
53+
public function getLine(): string
5454
{
55-
return $this->getLine();
55+
return $this->line;
5656
}
5757
}

src/Files/Type/YmlFile.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function __construct($debug, $filename, $rundir)
4141
$currentPathInfo = pathinfo($filename);
4242
$dirname = $currentPathInfo['dirname'];
4343

44+
$imports = array();
4445
foreach ($content['imports'] as $import)
4546
{
4647
if (isset($import['resource']))
@@ -58,11 +59,16 @@ public function __construct($debug, $filename, $rundir)
5859
$extraContent = array();
5960
}
6061

61-
// Imports are at the top of the yaml file, so these should be loaded first.
62-
// The values of the current yaml file will overwrite existing array values of the imports.
63-
$content = array_replace_recursive($extraContent, $content);
62+
// Collect all imports
63+
$imports[] = $extraContent;
6464
}
6565
}
66+
67+
// Imports are at the top of the yaml file, so these should be loaded first.
68+
// The values of the current yaml file will overwrite existing array values of the imports.
69+
// Merge all imports and content in a single operation
70+
$imports[] = $content;
71+
$content = array_replace_recursive(...$imports);
6672
}
6773
$this->yamlFile = $content;
6874
}

src/Tests/TestStartup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private function initGit($git, $branch)
8383

8484
$this->output->writeln(sprintf("Checkout %s from git on branch %s.", $git, $branch));
8585
$tmpdir = sys_get_temp_dir();
86-
$uniq = $tmpdir . DIRECTORY_SEPARATOR . uniqid();
86+
$uniq = $tmpdir . DIRECTORY_SEPARATOR . uniqid('', true);
8787

8888
@mkdir($uniq);
8989

src/Tests/Tests/epv_test_validate_languages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function validateDirectory(array $files)
6868

6969
foreach ($files as $file)
7070
{
71-
if (preg_match('#^' . preg_quote($this->basedir) . 'language[\/\\\\]([a-z_]+?)[\/\\\\](.+\.php)$#', $file, $matches) === 1)
71+
if (preg_match('#^' . preg_quote($this->basedir, '/') . 'language[\/\\\\]([a-z_]+?)[\/\\\\](.+\.php)$#', $file, $matches) === 1)
7272
{
7373
$language = $matches[1]; // language, e.g. "en"
7474
$relative_filename = $matches[2]; // file name relative to language's base dir, e.g. "info_acp_ext.php"

0 commit comments

Comments
 (0)