1
0
Fork 0

Fix svndriver type error

pull/11398/head
Jordi Boggiano 2023-03-21 10:50:22 +01:00
parent 5f298ae294
commit 3988fe2c9c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 9 additions and 9 deletions

View File

@ -236,17 +236,17 @@ class SvnDriver extends VcsDriver
if ($this->tagsPath !== false) { if ($this->tagsPath !== false) {
$output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath); $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
if ($output) { if ($output) {
$lastRev = null; $lastRev = 0;
foreach ($this->process->splitLines($output) as $line) { foreach ($this->process->splitLines($output) as $line) {
$line = trim($line); $line = trim($line);
if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) { if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
if (isset($match[1], $match[2])) { if (isset($match[1], $match[2])) {
if ($match[2] === './') { if ($match[2] === './') {
$lastRev = $match[1]; $lastRev = (int) $match[1];
} else { } else {
$tags[rtrim($match[2], '/')] = $this->buildIdentifier( $tags[rtrim($match[2], '/')] = $this->buildIdentifier(
'/' . $this->tagsPath . '/' . $match[2], '/' . $this->tagsPath . '/' . $match[2],
max($lastRev, $match[1]) max($lastRev, (int) $match[1])
); );
} }
} }
@ -283,7 +283,7 @@ class SvnDriver extends VcsDriver
if (isset($match[1], $match[2]) && $match[2] === './') { if (isset($match[1], $match[2]) && $match[2] === './') {
$branches['trunk'] = $this->buildIdentifier( $branches['trunk'] = $this->buildIdentifier(
'/' . $this->trunkPath, '/' . $this->trunkPath,
$match[1] (int) $match[1]
); );
$this->rootIdentifier = $branches['trunk']; $this->rootIdentifier = $branches['trunk'];
break; break;
@ -296,17 +296,17 @@ class SvnDriver extends VcsDriver
if ($this->branchesPath !== false) { if ($this->branchesPath !== false) {
$output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath); $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
if ($output) { if ($output) {
$lastRev = null; $lastRev = 0;
foreach ($this->process->splitLines(trim($output)) as $line) { foreach ($this->process->splitLines(trim($output)) as $line) {
$line = trim($line); $line = trim($line);
if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) { if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
if (isset($match[1], $match[2])) { if (isset($match[1], $match[2])) {
if ($match[2] === './') { if ($match[2] === './') {
$lastRev = $match[1]; $lastRev = (int) $match[1];
} else { } else {
$branches[rtrim($match[2], '/')] = $this->buildIdentifier( $branches[rtrim($match[2], '/')] = $this->buildIdentifier(
'/' . $this->branchesPath . '/' . $match[2], '/' . $this->branchesPath . '/' . $match[2],
max($lastRev, $match[1]) max($lastRev, (int) $match[1])
); );
} }
} }
@ -409,9 +409,9 @@ class SvnDriver extends VcsDriver
* Build the identifier respecting "package-path" config option * Build the identifier respecting "package-path" config option
* *
* @param string $baseDir The path to trunk/branch/tag * @param string $baseDir The path to trunk/branch/tag
* @param string $revision The revision mark to add to identifier * @param int $revision The revision mark to add to identifier
*/ */
protected function buildIdentifier(string $baseDir, string $revision): string protected function buildIdentifier(string $baseDir, int $revision): string
{ {
return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision; return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
} }