Skip to content

Commit 0f32375

Browse files
committed
some php 7.4 changes from propelorm#1086
1 parent 37b98bd commit 0f32375

File tree

7 files changed

+14
-11
lines changed

7 files changed

+14
-11
lines changed

generator/lib/builder/om/PHP5PeerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ public static function getPrimaryKeyFromRow(\$row, \$startcol = 0)
12031203
if ($table->hasCompositePrimaryKey()) {
12041204
$script .= "
12051205
1206-
return array(" . implode($pks, ', ') . ");";
1206+
return array(" . implode(', ', $pks) . ");";
12071207
} else {
12081208
$script .= "
12091209

generator/lib/builder/om/QueryBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,10 @@ protected function addFindPk(&$script)
415415
}
416416
$pkType = 'array';
417417
$pkDescription = "
418-
A Primary key composition: " . '[' . join($colNames, ', ') . ']';
418+
A Primary key composition: " . '[' . join(', ', $colNames) . ']';
419419
$script .= "
420420
* <code>
421-
* \$obj = \$c->findPk(array(" . join($examplePk, ', ') . "), \$con);";
421+
* \$obj = \$c->findPk(array(" . join(', ', $examplePk) . "), \$con);";
422422
} else {
423423
$pkType = 'mixed';
424424
$script .= "

generator/lib/model/XMLElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected function getDefaultValueForArray($stringValue)
109109
$values[] = trim($v);
110110
}
111111

112-
$value = implode($values, ' | ');
112+
$value = implode(' | ', $values);
113113
if (empty($value) || ' | ' === $value) {
114114
return null;
115115
}

generator/lib/platform/PgsqlPlatform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ public function getModifyColumnDDL(PropelColumnDiff $columnDiff)
393393
foreach ($changedProperties as $key => $property) {
394394
switch ($key) {
395395
case 'defaultValueType':
396-
continue;
396+
continue 2;
397397
case 'size':
398398
case 'type':
399399
case 'scale':

runtime/lib/map/TableMap.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,9 @@ public function setPrefix($prefix)
786786
*/
787787
protected function hasPrefix($data)
788788
{
789+
if(!$this->prefix) {
790+
return false;
791+
}
789792
return (strpos($data, $this->prefix) === 0);
790793
}
791794

runtime/lib/parser/PropelCSVParser.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ public function fromArray($array, $isList = false, $includeHeading = true)
4545
$rows = array();
4646
if ($isList) {
4747
if ($includeHeading) {
48-
$rows[] = implode($this->formatRow(array_keys(reset($array))), $this->delimiter);
48+
$rows[] = implode($this->delimiter, $this->formatRow(array_keys(reset($array))));
4949
}
5050
foreach ($array as $row) {
51-
$rows[] = implode($this->formatRow($row), $this->delimiter);
51+
$rows[] = implode($this->delimiter, $this->formatRow($row));
5252
}
5353
} else {
5454
if ($includeHeading) {
55-
$rows[] = implode($this->formatRow(array_keys($array)), $this->delimiter);
55+
$rows[] = implode($this->delimiter, $this->formatRow(array_keys($array)));
5656
}
57-
$rows[] = implode($this->formatRow($array), $this->delimiter);
57+
$rows[] = implode($this->delimiter, $this->formatRow($array));
5858
}
5959

60-
return implode($rows, $this->lineTerminator) . $this->lineTerminator;
60+
return implode($this->lineTerminator, $rows) . $this->lineTerminator;
6161
}
6262

6363
public function listFromArray($array)

runtime/lib/validator/MatchValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class MatchValidator implements BasicValidator
5050
private function prepareRegexp($exp)
5151
{
5252
// remove surrounding '/' marks so that they don't get escaped in next step
53-
if ($exp{0} !== '/' || $exp{strlen($exp) - 1} !== '/') {
53+
if ($exp[0] !== '/' || $exp[strlen($exp) - 1] !== '/') {
5454
$exp = '/' . $exp . '/';
5555
}
5656

0 commit comments

Comments
 (0)