Skip to content

Fix/strict nullables #2039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Propel/Generator/Builder/Om/ObjectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -982,9 +982,9 @@ public function addTemporalAccessorOpen(string &$script, Column $column): void
}

$script .= "
" . $visibility . " function get$cfc(\$format = " . $format;
" . $visibility . " function get$cfc(?string \$format = " . $format;
if ($column->isLazyLoad()) {
$script .= ', $con = null';
$script .= ', ?ConnectionInterface $con = null';
}
$script .= ")
{";
Expand Down Expand Up @@ -1158,7 +1158,7 @@ public function addJsonAccessorOpen(string &$script, Column $column): void
$visibility = $column->getAccessorVisibility();

$script .= "
" . $visibility . " function get$cfc(\$asArray = true";
" . $visibility . " function get$cfc(bool \$asArray = true";
if ($column->isLazyLoad()) {
$script .= ', ?ConnectionInterface $con = null';
}
Expand Down Expand Up @@ -6823,7 +6823,7 @@ protected function addSaveOpen(string &$script): void
$reloadOnUpdate = $table->isReloadOnUpdate();
$reloadOnInsert = $table->isReloadOnInsert();
$script .= "
public function save(?ConnectionInterface \$con = null" . ($reloadOnUpdate || $reloadOnInsert ? ', $skipReload = false' : '') . "): int
public function save(?ConnectionInterface \$con = null" . ($reloadOnUpdate || $reloadOnInsert ? ', bool $skipReload = false' : '') . "): int
{";
}

Expand Down
8 changes: 4 additions & 4 deletions src/Propel/Generator/Builder/Om/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ protected function addConstructorOpen(string &$script): void
{
$table = $this->getTable();
$script .= "
public function __construct(\$dbName = '" . $table->getDatabase()->getName() . "', \$modelName = '" . addslashes($this->getNewStubObjectBuilder($table)->getFullyQualifiedClassName()) . "', \$modelAlias = null)
public function __construct(\$dbName = '" . $table->getDatabase()->getName() . "', \$modelName = '" . addslashes($this->getNewStubObjectBuilder($table)->getFullyQualifiedClassName()) . "', ?string \$modelAlias = null)
{";
}

Expand Down Expand Up @@ -1190,7 +1190,7 @@ protected function addFilterByArrayCol(string &$script, Column $col): void
*
* @return \$this The current query, for fluid interface
*/
public function filterBy$singularPhpName(\$$variableName = null, ?string \$comparison = null)
public function filterBy$singularPhpName(mixed \$$variableName = null, ?string \$comparison = null)
{
if (null === \$comparison || \$comparison == Criteria::CONTAINS_ALL) {
if (is_scalar(\$$variableName)) {
Expand Down Expand Up @@ -1240,7 +1240,7 @@ protected function addFilterBySetCol(string &$script, Column $col): void
*
* @return \$this The current query, for fluid interface
*/
public function filterBy$singularPhpName(\$$variableName = null, ?string \$comparison = null)
public function filterBy$singularPhpName(mixed \$$variableName = null, ?string \$comparison = null)
{
\$this->filterBy$colPhpName(\$$variableName, \$comparison);
Expand Down Expand Up @@ -1567,7 +1567,7 @@ protected function addUseRelatedQuery(string &$script, Table $fkTable, string $q
*
* @return $queryClass A secondary query class using the current class as primary query
*/
public function use" . $relationName . 'Query($relationAlias = null, $joinType = ' . $joinType . ")
public function use" . $relationName . 'Query(?string $relationAlias = null, string $joinType = ' . $joinType . ")
{
return \$this
->join" . $relationName . "(\$relationAlias, \$joinType)
Expand Down
6 changes: 3 additions & 3 deletions templates/Builder/Om/baseQueryExistsMethods.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

/**
* Use the <?= $relationDescription ?> for an EXISTS query.
*
Expand All @@ -10,7 +10,7 @@
*
* @return <?= $queryClass ?> The inner query object of the EXISTS statement
*/
public function use<?= $relationName ?>ExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = '<?= $existsType ?>')
public function use<?= $relationName ?>ExistsQuery(?string $modelAlias = null, ?string $queryClass = null, string $typeOfExists = '<?= $existsType ?>')
{
/** @var $q <?= $queryClass ?> */
$q = $this->useExistsQuery('<?= $relationName ?>', $modelAlias, $queryClass, $typeOfExists);
Expand All @@ -27,7 +27,7 @@ public function use<?= $relationName ?>ExistsQuery($modelAlias = null, $queryCla
*
* @return <?= $queryClass ?> The inner query object of the NOT EXISTS statement
*/
public function use<?= $relationName ?>NotExistsQuery($modelAlias = null, $queryClass = null)
public function use<?= $relationName ?>NotExistsQuery(?string $modelAlias = null, ?string $queryClass = null)
{
/** @var $q <?= $queryClass ?> */
$q = $this->useExistsQuery('<?= $relationName ?>', $modelAlias, $queryClass, '<?= $notExistsType ?>');
Expand Down
4 changes: 2 additions & 2 deletions templates/Builder/Om/baseQueryInMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @return <?= $queryClass ?> The inner query object of the IN statement
*/
public function useIn<?= $relationName ?>Query($modelAlias = null, $queryClass = null, $typeOfIn = '<?= $inType ?>')
public function useIn<?= $relationName ?>Query(?string $modelAlias = null, ?string $queryClass = null, string $typeOfIn = '<?= $inType ?>')
{
/** @var $q <?= $queryClass ?> */
$q = $this->useInQuery('<?= $relationName ?>', $modelAlias, $queryClass, $typeOfIn);
Expand All @@ -27,7 +27,7 @@ public function useIn<?= $relationName ?>Query($modelAlias = null, $queryClass =
*
* @return <?= $queryClass ?> The inner query object of the NOT IN statement
*/
public function useNotIn<?= $relationName ?>Query($modelAlias = null, $queryClass = null)
public function useNotIn<?= $relationName ?>Query(?string $modelAlias = null, ?string $queryClass = null)
{
/** @var $q <?= $queryClass ?> */
$q = $this->useInQuery('<?= $relationName ?>', $modelAlias, $queryClass, '<?= $notInType ?>');
Expand Down
Loading