Skip to content

Commit

Permalink
some php 7.4 changes from propelorm#1086
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGoodwin committed Sep 16, 2020
1 parent 37b98bd commit 0f32375
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5PeerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ public static function getPrimaryKeyFromRow(\$row, \$startcol = 0)
if ($table->hasCompositePrimaryKey()) {
$script .= "
return array(" . implode($pks, ', ') . ");";
return array(" . implode(', ', $pks) . ");";
} else {
$script .= "
Expand Down
4 changes: 2 additions & 2 deletions generator/lib/builder/om/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,10 @@ protected function addFindPk(&$script)
}
$pkType = 'array';
$pkDescription = "
A Primary key composition: " . '[' . join($colNames, ', ') . ']';
A Primary key composition: " . '[' . join(', ', $colNames) . ']';
$script .= "
* <code>
* \$obj = \$c->findPk(array(" . join($examplePk, ', ') . "), \$con);";
* \$obj = \$c->findPk(array(" . join(', ', $examplePk) . "), \$con);";
} else {
$pkType = 'mixed';
$script .= "
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/model/XMLElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function getDefaultValueForArray($stringValue)
$values[] = trim($v);
}

$value = implode($values, ' | ');
$value = implode(' | ', $values);
if (empty($value) || ' | ' === $value) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/platform/PgsqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public function getModifyColumnDDL(PropelColumnDiff $columnDiff)
foreach ($changedProperties as $key => $property) {
switch ($key) {
case 'defaultValueType':
continue;
continue 2;
case 'size':
case 'type':
case 'scale':
Expand Down
3 changes: 3 additions & 0 deletions runtime/lib/map/TableMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,9 @@ public function setPrefix($prefix)
*/
protected function hasPrefix($data)
{
if(!$this->prefix) {
return false;
}
return (strpos($data, $this->prefix) === 0);
}

Expand Down
10 changes: 5 additions & 5 deletions runtime/lib/parser/PropelCSVParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ public function fromArray($array, $isList = false, $includeHeading = true)
$rows = array();
if ($isList) {
if ($includeHeading) {
$rows[] = implode($this->formatRow(array_keys(reset($array))), $this->delimiter);
$rows[] = implode($this->delimiter, $this->formatRow(array_keys(reset($array))));
}
foreach ($array as $row) {
$rows[] = implode($this->formatRow($row), $this->delimiter);
$rows[] = implode($this->delimiter, $this->formatRow($row));
}
} else {
if ($includeHeading) {
$rows[] = implode($this->formatRow(array_keys($array)), $this->delimiter);
$rows[] = implode($this->delimiter, $this->formatRow(array_keys($array)));
}
$rows[] = implode($this->formatRow($array), $this->delimiter);
$rows[] = implode($this->delimiter, $this->formatRow($array));
}

return implode($rows, $this->lineTerminator) . $this->lineTerminator;
return implode($this->lineTerminator, $rows) . $this->lineTerminator;
}

public function listFromArray($array)
Expand Down
2 changes: 1 addition & 1 deletion runtime/lib/validator/MatchValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MatchValidator implements BasicValidator
private function prepareRegexp($exp)
{
// remove surrounding '/' marks so that they don't get escaped in next step
if ($exp{0} !== '/' || $exp{strlen($exp) - 1} !== '/') {
if ($exp[0] !== '/' || $exp[strlen($exp) - 1] !== '/') {
$exp = '/' . $exp . '/';
}

Expand Down

0 comments on commit 0f32375

Please sign in to comment.