Skip to content

Commit d650c1b

Browse files
eelkevdbossmhg
andauthored
Fix/strict nullables (#2039)
* add strict nullable types to baseQueryExistsMethods template * add strict nullable types to baseQueryInMethods template * add strict nullable types to ObjectBuilder (+AggregateColumnRelationBehavior) * remove mixed type to support php7 --------- Co-authored-by: Sam Hauglustaine <[email protected]>
1 parent 8e66b55 commit d650c1b

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

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

Lines changed: 4 additions & 4 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,7 +1158,7 @@ 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()) {
11631163
$script .= ', ?ConnectionInterface $con = null';
11641164
}
@@ -6823,7 +6823,7 @@ protected function addSaveOpen(string &$script): void
68236823
$reloadOnUpdate = $table->isReloadOnUpdate();
68246824
$reloadOnInsert = $table->isReloadOnInsert();
68256825
$script .= "
6826-
public function save(?ConnectionInterface \$con = null" . ($reloadOnUpdate || $reloadOnInsert ? ', $skipReload = false' : '') . "): int
6826+
public function save(?ConnectionInterface \$con = null" . ($reloadOnUpdate || $reloadOnInsert ? ', bool $skipReload = false' : '') . "): int
68276827
{";
68286828
}
68296829

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ protected function addConstructorOpen(string &$script): void
377377
{
378378
$table = $this->getTable();
379379
$script .= "
380-
public function __construct(\$dbName = '" . $table->getDatabase()->getName() . "', \$modelName = '" . addslashes($this->getNewStubObjectBuilder($table)->getFullyQualifiedClassName()) . "', \$modelAlias = null)
380+
public function __construct(\$dbName = '" . $table->getDatabase()->getName() . "', \$modelName = '" . addslashes($this->getNewStubObjectBuilder($table)->getFullyQualifiedClassName()) . "', ?string \$modelAlias = null)
381381
{";
382382
}
383383

@@ -1567,7 +1567,7 @@ protected function addUseRelatedQuery(string &$script, Table $fkTable, string $q
15671567
*
15681568
* @return $queryClass A secondary query class using the current class as primary query
15691569
*/
1570-
public function use" . $relationName . 'Query($relationAlias = null, $joinType = ' . $joinType . ")
1570+
public function use" . $relationName . 'Query(?string $relationAlias = null, string $joinType = ' . $joinType . ")
15711571
{
15721572
return \$this
15731573
->join" . $relationName . "(\$relationAlias, \$joinType)

templates/Builder/Om/baseQueryExistsMethods.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
/**
33
* Use the <?= $relationDescription ?> for an EXISTS query.
44
*
@@ -10,7 +10,7 @@
1010
*
1111
* @return <?= $queryClass ?> The inner query object of the EXISTS statement
1212
*/
13-
public function use<?= $relationName ?>ExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = '<?= $existsType ?>')
13+
public function use<?= $relationName ?>ExistsQuery(?string $modelAlias = null, ?string $queryClass = null, string $typeOfExists = '<?= $existsType ?>')
1414
{
1515
/** @var $q <?= $queryClass ?> */
1616
$q = $this->useExistsQuery('<?= $relationName ?>', $modelAlias, $queryClass, $typeOfExists);
@@ -27,7 +27,7 @@ public function use<?= $relationName ?>ExistsQuery($modelAlias = null, $queryCla
2727
*
2828
* @return <?= $queryClass ?> The inner query object of the NOT EXISTS statement
2929
*/
30-
public function use<?= $relationName ?>NotExistsQuery($modelAlias = null, $queryClass = null)
30+
public function use<?= $relationName ?>NotExistsQuery(?string $modelAlias = null, ?string $queryClass = null)
3131
{
3232
/** @var $q <?= $queryClass ?> */
3333
$q = $this->useExistsQuery('<?= $relationName ?>', $modelAlias, $queryClass, '<?= $notExistsType ?>');

templates/Builder/Om/baseQueryInMethods.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @return <?= $queryClass ?> The inner query object of the IN statement
1212
*/
13-
public function useIn<?= $relationName ?>Query($modelAlias = null, $queryClass = null, $typeOfIn = '<?= $inType ?>')
13+
public function useIn<?= $relationName ?>Query(?string $modelAlias = null, ?string $queryClass = null, string $typeOfIn = '<?= $inType ?>')
1414
{
1515
/** @var $q <?= $queryClass ?> */
1616
$q = $this->useInQuery('<?= $relationName ?>', $modelAlias, $queryClass, $typeOfIn);
@@ -27,7 +27,7 @@ public function useIn<?= $relationName ?>Query($modelAlias = null, $queryClass =
2727
*
2828
* @return <?= $queryClass ?> The inner query object of the NOT IN statement
2929
*/
30-
public function useNotIn<?= $relationName ?>Query($modelAlias = null, $queryClass = null)
30+
public function useNotIn<?= $relationName ?>Query(?string $modelAlias = null, ?string $queryClass = null)
3131
{
3232
/** @var $q <?= $queryClass ?> */
3333
$q = $this->useInQuery('<?= $relationName ?>', $modelAlias, $queryClass, '<?= $notInType ?>');

0 commit comments

Comments
 (0)