Skip to content

Commit 191da4f

Browse files
committed
add strict nullable types to ObjectBuilder (+AggregateColumnRelationBehavior)
1 parent d862540 commit 191da4f

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/Propel/Generator/Behavior/AggregateColumn/AggregateColumnRelationBehavior.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function objectFilter(string &$script, AbstractOMBuilder $builder): void
111111
$relationName = $this->getRelationName($builder);
112112
$aggregateName = $this->getParameter('aggregate_name');
113113
$relatedClass = $builder->getClassNameFromBuilder($builder->getNewStubObjectBuilder($this->getForeignTable()));
114-
$search = " public function set{$relationName}({$relatedClass} \$v = null)
114+
$search = " public function set{$relationName}(?{$relatedClass} \$v = null)
115115
{";
116116
$replace = $search . "
117117
// aggregate_column_relation behavior

src/Propel/Generator/Builder/Om/ObjectBuilder.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -982,9 +982,9 @@ public function addTemporalAccessorOpen(string &$script, Column $column): void
982982
}
983983

984984
$script .= "
985-
" . $visibility . " function get$cfc(\$format = " . $format;
985+
" . $visibility . " function get$cfc(?string \$format = " . $format;
986986
if ($column->isLazyLoad()) {
987-
$script .= ', $con = null';
987+
$script .= ', ?ConnectionInterface $con = null';
988988
}
989989
$script .= ")
990990
{";
@@ -1158,9 +1158,9 @@ public function addJsonAccessorOpen(string &$script, Column $column): void
11581158
$visibility = $column->getAccessorVisibility();
11591159

11601160
$script .= "
1161-
" . $visibility . " function get$cfc(\$asArray = true";
1161+
" . $visibility . " function get$cfc(bool \$asArray = true";
11621162
if ($column->isLazyLoad()) {
1163-
$script .= ', ConnectionInterface $con = null';
1163+
$script .= ', ?ConnectionInterface $con = null';
11641164
}
11651165

11661166
$script .= ")
@@ -1278,7 +1278,7 @@ public function addBooleanAccessorOpen(string &$script, Column $column): void
12781278
$script .= "
12791279
" . $visibility . " function $name(";
12801280
if ($column->isLazyLoad()) {
1281-
$script .= 'ConnectionInterface $con = null';
1281+
$script .= '?ConnectionInterface $con = null';
12821282
}
12831283

12841284
$script .= ")
@@ -1483,7 +1483,7 @@ protected function addHasArrayElement(string &$script, Column $column): void
14831483
*/
14841484
$visibility function has$singularPhpName(\$value";
14851485
if ($column->isLazyLoad()) {
1486-
$script .= ', ConnectionInterface $con = null';
1486+
$script .= ', ?ConnectionInterface $con = null';
14871487
}
14881488

14891489
$script .= "): bool
@@ -1557,7 +1557,7 @@ public function addDefaultAccessorOpen(string &$script, Column $column): void
15571557
$script .= "
15581558
" . $visibility . " function get$cfc(";
15591559
if ($column->isLazyLoad()) {
1560-
$script .= 'ConnectionInterface $con = null';
1560+
$script .= '?ConnectionInterface $con = null';
15611561
}
15621562

15631563
$script .= ")
@@ -2206,7 +2206,7 @@ protected function addAddArrayElement(string &$script, Column $col): void
22062206
*/
22072207
$visibility function add$singularPhpName(\$value";
22082208
if ($col->isLazyLoad()) {
2209-
$script .= ', ConnectionInterface $con = null';
2209+
$script .= ', ?ConnectionInterface $con = null';
22102210
}
22112211

22122212
$script .= ")
@@ -2254,7 +2254,7 @@ protected function addRemoveArrayElement(string &$script, Column $col): void
22542254
*/
22552255
$visibility function remove$singularPhpName(\$value";
22562256
if ($col->isLazyLoad()) {
2257-
$script .= ', ConnectionInterface $con = null';
2257+
$script .= ', ?ConnectionInterface $con = null';
22582258
}
22592259
// we want to reindex the array, so array_ functions are not the best choice
22602260
$script .= ")
@@ -4141,7 +4141,7 @@ protected function addFKMutator(string &$script, ForeignKey $fk): void
41414141
* @return \$this The current object (for fluent API support)
41424142
* @throws \Propel\Runtime\Exception\PropelException
41434143
*/
4144-
public function set" . $this->getFKPhpNameAffix($fk, false) . "($className \$v = null)
4144+
public function set" . $this->getFKPhpNameAffix($fk, false) . "(?$className \$v = null)
41454145
{";
41464146

41474147
foreach ($fk->getMapping() as $map) {
@@ -4269,7 +4269,7 @@ protected function addFKAccessor(string &$script, ForeignKey $fk): void
42694269
* @return {$className}{$orNull} $returnDesc
42704270
* @throws \Propel\Runtime\Exception\PropelException
42714271
*/
4272-
public function get" . $this->getFKPhpNameAffix($fk, false) . "(?ConnectionInterface \$con = null)
4272+
public function get" . $this->getFKPhpNameAffix($fk, false) . "(?ConnectionInterface \$con = null): $className$orNull
42734273
{";
42744274
$script .= "
42754275
if (\$this->$varName === null && ($conditional)) {";
@@ -4962,7 +4962,7 @@ protected function addPKRefFKSet(string &$script, ForeignKey $refFK): void
49624962
* @return \$this The current object (for fluent API support)
49634963
* @throws \Propel\Runtime\Exception\PropelException
49644964
*/
4965-
public function set" . $this->getRefFKPhpNameAffix($refFK, false) . "($className \$v = null)
4965+
public function set" . $this->getRefFKPhpNameAffix($refFK, false) . "(?$className \$v = null)
49664966
{
49674967
\$this->$varName = \$v;
49684968
@@ -6822,7 +6822,7 @@ protected function addSaveOpen(string &$script): void
68226822
$reloadOnUpdate = $table->isReloadOnUpdate();
68236823
$reloadOnInsert = $table->isReloadOnInsert();
68246824
$script .= "
6825-
public function save(?ConnectionInterface \$con = null" . ($reloadOnUpdate || $reloadOnInsert ? ', $skipReload = false' : '') . "): int
6825+
public function save(?ConnectionInterface \$con = null" . ($reloadOnUpdate || $reloadOnInsert ? ', bool $skipReload = false' : '') . "): int
68266826
{";
68276827
}
68286828

0 commit comments

Comments
 (0)