Skip to content

Commit

Permalink
PHP 8.4: fix deprecation notice
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan committed Dec 10, 2024
1 parent bbb64a8 commit 8bbe5b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions src/Propel/Generator/Builder/Om/ObjectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ public function addJsonAccessorOpen(string &$script, Column $column): void
$script .= "
" . $visibility . " function get$cfc(\$asArray = true";
if ($column->isLazyLoad()) {
$script .= ', ConnectionInterface $con = null';
$script .= ', ?ConnectionInterface $con = null';
}

$script .= ")
Expand Down Expand Up @@ -1278,7 +1278,7 @@ public function addBooleanAccessorOpen(string &$script, Column $column): void
$script .= "
" . $visibility . " function $name(";
if ($column->isLazyLoad()) {
$script .= 'ConnectionInterface $con = null';
$script .= '?ConnectionInterface $con = null';
}

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

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

$script .= ")
Expand Down Expand Up @@ -1852,6 +1852,7 @@ public function addMutatorOpenOpen(string &$script, Column $column): void
$typeHint .= ' ';

if (!$column->isNotNull()) {
$typeHint = '?' . $typeHint;
$null = ' = null';
}
}
Expand Down Expand Up @@ -2206,7 +2207,7 @@ protected function addAddArrayElement(string &$script, Column $col): void
*/
$visibility function add$singularPhpName(\$value";
if ($col->isLazyLoad()) {
$script .= ', ConnectionInterface $con = null';
$script .= ', ?ConnectionInterface $con = null';
}

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

foreach ($fk->getMapping() as $map) {
Expand Down Expand Up @@ -4958,11 +4959,11 @@ protected function addPKRefFKSet(string &$script, ForeignKey $refFK): void
/**
* Sets a single $className object as related to this object by a one-to-one relationship.
*
* @param $className \$v $className
* @param $className|null \$v $className
* @return \$this The current object (for fluent API support)
* @throws \Propel\Runtime\Exception\PropelException
*/
public function set" . $this->getRefFKPhpNameAffix($refFK, false) . "($className \$v = null)
public function set" . $this->getRefFKPhpNameAffix($refFK, false) . "(?$className \$v = null)
{
\$this->$varName = \$v;
Expand Down
2 changes: 1 addition & 1 deletion src/Propel/Generator/Builder/Om/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ protected function addWithRelatedQuery(string &$script, Table $fkTable, string $
*/
public function with{$relationName}Query(
callable \$callable,
string \$relationAlias = null,
?string \$relationAlias = null,
?string \$joinType = {$joinType}
) {
\$relatedQuery = \$this->use{$relationName}Query(
Expand Down

0 comments on commit 8bbe5b5

Please sign in to comment.