diff --git a/src/Propel/Generator/Behavior/ConcreteInheritance/ConcreteInheritanceBehavior.php b/src/Propel/Generator/Behavior/ConcreteInheritance/ConcreteInheritanceBehavior.php index 432d637cbb..75b2a09fff 100644 --- a/src/Propel/Generator/Behavior/ConcreteInheritance/ConcreteInheritanceBehavior.php +++ b/src/Propel/Generator/Behavior/ConcreteInheritance/ConcreteInheritanceBehavior.php @@ -330,7 +330,7 @@ protected function addObjectGetParentOrCreate(string &$script): void /** * Get or Create the parent " . $parentClass . " object of the current object * - * @return " . $parentClass . " The parent object + * @return " . $parentClass . " The parent object */ public function getParentOrCreate(?ConnectionInterface \$con = null) { @@ -372,7 +372,7 @@ protected function addObjectGetSyncParent(string &$script): void * Create or Update the parent " . $parentTable->getPhpName() . " object * And return its primary key * - * @return " . $cptype . " The primary key of the parent object + * @return " . $cptype . " The primary key of the parent object */ public function getSyncParent(?ConnectionInterface \$con = null) { diff --git a/src/Propel/Generator/Behavior/ConcreteInheritance/ConcreteInheritanceParentBehavior.php b/src/Propel/Generator/Behavior/ConcreteInheritance/ConcreteInheritanceParentBehavior.php index 133be39586..b83fd16838 100644 --- a/src/Propel/Generator/Behavior/ConcreteInheritance/ConcreteInheritanceParentBehavior.php +++ b/src/Propel/Generator/Behavior/ConcreteInheritance/ConcreteInheritanceParentBehavior.php @@ -84,7 +84,7 @@ protected function addHasChildObject(string &$script): void /** * Whether this object is the parent of a child object * - * @return bool + * @return bool */ public function hasChildObject(): bool { diff --git a/src/Propel/Generator/Behavior/Delegate/DelegateBehavior.php b/src/Propel/Generator/Behavior/Delegate/DelegateBehavior.php index ad495cfa93..3147149019 100644 --- a/src/Propel/Generator/Behavior/Delegate/DelegateBehavior.php +++ b/src/Propel/Generator/Behavior/Delegate/DelegateBehavior.php @@ -338,21 +338,23 @@ public function queryMethods(QueryBuilder $builder): string * * @see Criteria::add() * - * @param string \$column A string representing thecolumn phpName, e.g. 'AuthorId' - * @param mixed \$value A value for the condition + * @param string \$column A string representing the column phpName, e.g. 'AuthorId' + * @param mixed \$value A value for the condition * @param string \$comparison What to use for the column comparison, defaults to Criteria::EQUAL * - * @return \$this|ModelCriteria The current object, for fluid interface + * @return \$this The current object, for fluid interface */ public function filterBy(\$column, \$value, \$comparison = Criteria::EQUAL) { if (isset(\$this->delegatedFields[\$column])) { \$methodUse = \"use{\$this->delegatedFields[\$column]}Query\"; - return \$this->{\$methodUse}()->filterBy(\$column, \$value, \$comparison)->endUse(); + \$this->{\$methodUse}()->filterBy(\$column, \$value, \$comparison)->endUse(); } else { - return \$this->add(\$this->getRealColumnName(\$column), \$value, \$comparison); + \$this->add(\$this->getRealColumnName(\$column), \$value, \$comparison); } + + return \$this; } "; } diff --git a/src/Propel/Generator/Behavior/I18n/I18nBehaviorObjectBuilderModifier.php b/src/Propel/Generator/Behavior/I18n/I18nBehaviorObjectBuilderModifier.php index ac51155462..ca27be4900 100644 --- a/src/Propel/Generator/Behavior/I18n/I18nBehaviorObjectBuilderModifier.php +++ b/src/Propel/Generator/Behavior/I18n/I18nBehaviorObjectBuilderModifier.php @@ -269,7 +269,7 @@ protected function addTranslatedColumnSetter(Column $column): string $objectBuilder->addMutatorOpenOpen($functionStatement, $column); } $comment = preg_replace('/^\t/m', '', $comment); - $comment = str_replace('@return $this|' . $i18nTablePhpName, '@return $this|' . $tablePhpName, $comment); + $comment = str_replace('@return $this|' . $i18nTablePhpName, '@return $this|' . $tablePhpName, $comment); $functionStatement = preg_replace('/^\t/m', '', $functionStatement); preg_match_all('/\$[a-z]+/i', $functionStatement, $params); diff --git a/src/Propel/Generator/Behavior/NestedSet/NestedSetBehaviorObjectBuilderModifier.php b/src/Propel/Generator/Behavior/NestedSet/NestedSetBehaviorObjectBuilderModifier.php index 8214f8c427..169f6cb0b6 100644 --- a/src/Propel/Generator/Behavior/NestedSet/NestedSetBehaviorObjectBuilderModifier.php +++ b/src/Propel/Generator/Behavior/NestedSet/NestedSetBehaviorObjectBuilderModifier.php @@ -404,8 +404,8 @@ protected function addSetRight(string &$script): void * Proxy setter method for the right value of the nested set model. * It provides a generic way to set the value, whatever the actual column name is. * - * @param int \$v The nested set right value - * @return \$this The current object (for fluent API support) + * @param int \$v The nested set right value + * @return \$this The current object (for fluent API support) */ public function setRightValue(int \$v) { @@ -430,8 +430,8 @@ protected function addSetLevel(string &$script): void * Proxy setter method for the level value of the nested set model. * It provides a generic way to set the value, whatever the actual column name is. * - * @param int \$v The nested set level value - * @return \$this The current object (for fluent API support) + * @param int \$v The nested set level value + * @return \$this The current object (for fluent API support) */ public function setLevel(int \$v) { @@ -456,8 +456,8 @@ protected function addSetScope(string &$script): void * Proxy setter method for the scope value of the nested set model. * It provides a generic way to set the value, whatever the actual column name is. * - * @param int \$v The nested set scope value - * @return \$this The current object (for fluent API support) + * @param int \$v The nested set scope value + * @return \$this The current object (for fluent API support) */ public function setScopeValue(int \$v) { @@ -481,7 +481,7 @@ protected function addMakeRoot(string &$script): void /** * Creates the supplied node as the root node. * - * @return \$this The current object (for fluent API support) + * @return \$this The current object (for fluent API support) * @throws PropelException */ public function makeRoot() @@ -510,7 +510,7 @@ protected function addIsInTree(string &$script): void /** * Tests if object is a node, i.e. if it is inserted in the tree * - * @return bool + * @return bool */ public function isInTree(): bool { @@ -550,7 +550,7 @@ protected function addIsLeaf(string &$script): void /** * Tests if node is a leaf * - * @return bool + * @return bool */ public function isLeaf(): bool { @@ -572,8 +572,8 @@ protected function addIsDescendantOf(string &$script): void /** * Tests if node is a descendant of another node * - * @param $objectClassName \$parent Propel node object - * @return bool + * @param $objectClassName \$parent Propel node object + * @return bool */ public function isDescendantOf($objectClassName \$parent): bool {"; @@ -603,8 +603,8 @@ protected function addIsAncestorOf(string &$script): void /** * Tests if node is a ancestor of another node * - * @param $objectClassName \$child Propel node object - * @return bool + * @param $objectClassName \$child Propel node object + * @return bool */ public function isAncestorOf($objectClassName \$child): bool { @@ -648,8 +648,8 @@ protected function addSetParent(string &$script): void * Warning: this does not move the current object in the tree. * Use moveTofirstChildOf() or moveToLastChildOf() for that purpose * - * @param $objectClassName \$parent - * @return \$this The current object, for fluid interface + * @param $objectClassName \$parent + * @return \$this The current object, for fluid interface */ public function setParent($objectClassName \$parent = null) { @@ -675,7 +675,7 @@ protected function addGetParent(string &$script): void * Gets parent node for the current object if it exists * The result is cached so further calls to the same method don't issue any queries * - * @param ConnectionInterface \$con Connection to use. + * @param ConnectionInterface \$con Connection to use. * @return $objectClassName|null Propel object if exists else null */ public function getParent(?ConnectionInterface \$con = null) @@ -705,8 +705,8 @@ protected function addHasPrevSibling(string &$script): void /** * Determines if the node has previous sibling * - * @param ConnectionInterface \$con Connection to use. - * @return bool + * @param ConnectionInterface \$con Connection to use. + * @return bool */ public function hasPrevSibling(?ConnectionInterface \$con = null): bool { @@ -740,8 +740,8 @@ protected function addGetPrevSibling(string &$script): void /** * Gets previous sibling for the given node if it exists * - * @param ConnectionInterface \$con Connection to use. - * @return $objectClassName|null Propel object if exists else null + * @param ConnectionInterface \$con Connection to use. + * @return $objectClassName|null Propel object if exists else null */ public function getPrevSibling(?ConnectionInterface \$con = null) { @@ -770,8 +770,8 @@ protected function addHasNextSibling(string &$script): void /** * Determines if the node has next sibling * - * @param ConnectionInterface \$con Connection to use. - * @return bool + * @param ConnectionInterface \$con Connection to use. + * @return bool */ public function hasNextSibling(?ConnectionInterface \$con = null): bool { @@ -805,8 +805,8 @@ protected function addGetNextSibling(string &$script): void /** * Gets next sibling for the given node if it exists * - * @param ConnectionInterface \$con Connection to use. - * @return $objectClassName|null Propel object if exists else null + * @param ConnectionInterface \$con Connection to use. + * @return $objectClassName|null Propel object if exists else null */ public function getNextSibling(?ConnectionInterface \$con = null) { @@ -836,7 +836,7 @@ protected function addNestedSetChildrenClear(string &$script): void * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void + * @return void */ public function clearNestedSetChildren(): void { @@ -856,7 +856,7 @@ protected function addNestedSetChildrenInit(string &$script): void /** * Initializes the \$collNestedSetChildren collection. * - * @return void + * @return void */ public function initNestedSetChildren(): void { @@ -884,9 +884,9 @@ protected function addNestedSetChildAdd(string &$script): void * Beware that this doesn't insert a node in the tree. * This method is only used to facilitate children hydration. * - * @param $objectClassName $objectName + * @param $objectClassName $objectName * - * @return void + * @return void */ public function addNestedSetChild($objectClassName $objectName): void { @@ -912,7 +912,7 @@ protected function addHasChildren(string &$script): void /** * Tests if node has children * - * @return bool + * @return bool */ public function hasChildren(): bool { @@ -935,9 +935,9 @@ protected function addGetChildren(string &$script): void /** * Gets the children of the given node * - * @param Criteria \$criteria Criteria to filter results. - * @param ConnectionInterface \$con Connection to use. - * @return ObjectCollection|{$objectClassName}[] List of $objectClassName objects + * @param Criteria \$criteria Criteria to filter results. + * @param ConnectionInterface \$con Connection to use. + * @return ObjectCollection|{$objectClassName}[] List of $objectClassName objects */ public function getChildren(?Criteria \$criteria = null, ?ConnectionInterface \$con = null) { @@ -975,9 +975,9 @@ protected function addCountChildren(string &$script): void /** * Gets number of children for the given node * - * @param Criteria \$criteria Criteria to filter results. - * @param ConnectionInterface \$con Connection to use. - * @return int Number of children + * @param Criteria \$criteria Criteria to filter results. + * @param ConnectionInterface \$con Connection to use. + * @return int Number of children */ public function countChildren(?Criteria \$criteria = null, ?ConnectionInterface \$con = null) { @@ -1009,9 +1009,9 @@ protected function addGetFirstChild(string &$script): void /** * Gets the first child of the given node * - * @param Criteria \$criteria Criteria to filter results. - * @param ConnectionInterface \$con Connection to use. - * @return $objectClassName|null First child or null if this is a leaf + * @param Criteria \$criteria Criteria to filter results. + * @param ConnectionInterface \$con Connection to use. + * @return $objectClassName|null First child or null if this is a leaf */ public function getFirstChild(?Criteria \$criteria = null, ?ConnectionInterface \$con = null) { @@ -1041,9 +1041,9 @@ protected function addGetLastChild(string &$script): void /** * Gets the last child of the given node * - * @param Criteria \$criteria Criteria to filter results. - * @param ConnectionInterface \$con Connection to use. - * @return $objectClassName|null Last child or null if this is a leaf + * @param Criteria \$criteria Criteria to filter results. + * @param ConnectionInterface \$con Connection to use. + * @return $objectClassName|null Last child or null if this is a leaf */ public function getLastChild(?Criteria \$criteria = null, ?ConnectionInterface \$con = null) { @@ -1073,8 +1073,8 @@ protected function addGetSiblings(string &$script): void /** * Gets the siblings of the given node * - * @param bool \$includeNode Whether to include the current node or not - * @param Criteria \$criteria Criteria to filter results. + * @param bool \$includeNode Whether to include the current node or not + * @param Criteria \$criteria Criteria to filter results. * @param ConnectionInterface \$con Connection to use. * * @return ObjectCollection|{$objectClassName}[] List of $objectClassName objects @@ -1111,9 +1111,9 @@ protected function addGetDescendants(string &$script): void /** * Gets descendants for the given node * - * @param Criteria \$criteria Criteria to filter results. - * @param ConnectionInterface \$con Connection to use. - * @return ObjectCollection|{$objectClassName}[] List of $objectClassName objects + * @param Criteria \$criteria Criteria to filter results. + * @param ConnectionInterface \$con Connection to use. + * @return ObjectCollection|{$objectClassName}[] List of $objectClassName objects */ public function getDescendants(?Criteria \$criteria = null, ?ConnectionInterface \$con = null) { @@ -1142,9 +1142,9 @@ protected function addCountDescendants(string &$script): void /** * Gets number of descendants for the given node * - * @param Criteria \$criteria Criteria to filter results. - * @param ConnectionInterface \$con Connection to use. - * @return int Number of descendants + * @param Criteria \$criteria Criteria to filter results. + * @param ConnectionInterface \$con Connection to use. + * @return int Number of descendants */ public function countDescendants(?Criteria \$criteria = null, ?ConnectionInterface \$con = null) { @@ -1174,9 +1174,9 @@ protected function addGetBranch(string &$script): void /** * Gets descendants for the given node, plus the current node * - * @param Criteria \$criteria Criteria to filter results. - * @param ConnectionInterface \$con Connection to use. - * @return ObjectCollection|{$objectClassName}[] List of $objectClassName objects + * @param Criteria \$criteria Criteria to filter results. + * @param ConnectionInterface \$con Connection to use. + * @return ObjectCollection|{$objectClassName}[] List of $objectClassName objects */ public function getBranch(?Criteria \$criteria = null, ?ConnectionInterface \$con = null) { @@ -1203,9 +1203,9 @@ protected function addGetAncestors(string &$script): void * Gets ancestors for the given node, starting with the root node * Use it for breadcrumb paths for instance * - * @param Criteria \$criteria Criteria to filter results. - * @param ConnectionInterface \$con Connection to use. - * @return ObjectCollection|{$objectClassName}[] List of $objectClassName objects + * @param Criteria \$criteria Criteria to filter results. + * @param ConnectionInterface \$con Connection to use. + * @return ObjectCollection|{$objectClassName}[] List of $objectClassName objects */ public function getAncestors(?Criteria \$criteria = null, ?ConnectionInterface \$con = null) { @@ -1237,9 +1237,9 @@ protected function addAddChild(string &$script): void * The modifications in the current object and the tree * are not persisted until the child object is saved. * - * @param $objectClassName \$child Propel object for child node + * @param $objectClassName \$child Propel object for child node * - * @return \$this The current Propel object + * @return \$this The current Propel object */ public function addChild($objectClassName \$child) { @@ -1270,9 +1270,9 @@ protected function addInsertAsFirstChildOf(string &$script): void * The modifications in the current object and the tree * are not persisted until the current object is saved. * - * @param $objectClassName \$parent Propel object for parent node + * @param $objectClassName \$parent Propel object for parent node * - * @return \$this The current Propel object + * @return \$this The current Propel object */ public function insertAsFirstChildOf($objectClassName \$parent) { @@ -1335,9 +1335,9 @@ protected function addInsertAsPrevSiblingOf(string &$script): void * The modifications in the current object and the tree * are not persisted until the current object is saved. * - * @param $objectClassName \$sibling Propel object for parent node + * @param $objectClassName \$sibling Propel object for parent node * - * @return \$this The current Propel object + * @return \$this The current Propel object */ public function insertAsPrevSiblingOf($objectClassName \$sibling) { @@ -1383,9 +1383,9 @@ protected function addInsertAsNextSiblingOf(string &$script): void * The modifications in the current object and the tree * are not persisted until the current object is saved. * - * @param $objectClassName \$sibling Propel object for parent node + * @param $objectClassName \$sibling Propel object for parent node * - * @return \$this The current Propel object + * @return \$this The current Propel object */ public function insertAsNextSiblingOf($objectClassName \$sibling) { @@ -1427,10 +1427,10 @@ protected function addMoveToFirstChildOf(string &$script): void * Moves current node and its subtree to be the first child of \$parent * The modifications in the current object and the tree are immediate * - * @param $objectClassName \$parent Propel object for parent node - * @param ConnectionInterface \$con Connection to use. + * @param $objectClassName \$parent Propel object for parent node + * @param ConnectionInterface \$con Connection to use. * - * @return \$this The current Propel object + * @return \$this The current Propel object */ public function moveToFirstChildOf($objectClassName \$parent, ?ConnectionInterface \$con = null) { @@ -1464,10 +1464,10 @@ protected function addMoveToLastChildOf(string &$script): void * Moves current node and its subtree to be the last child of \$parent * The modifications in the current object and the tree are immediate * - * @param $objectClassName \$parent Propel object for parent node - * @param ConnectionInterface \$con Connection to use. + * @param $objectClassName \$parent Propel object for parent node + * @param ConnectionInterface \$con Connection to use. * - * @return \$this The current Propel object + * @return \$this The current Propel object */ public function moveToLastChildOf($objectClassName \$parent, ?ConnectionInterface \$con = null) { @@ -1501,10 +1501,10 @@ protected function addMoveToPrevSiblingOf(string &$script): void * Moves current node and its subtree to be the previous sibling of \$sibling * The modifications in the current object and the tree are immediate * - * @param $objectClassName \$sibling Propel object for sibling node - * @param ConnectionInterface \$con Connection to use. + * @param $objectClassName \$sibling Propel object for sibling node + * @param ConnectionInterface \$con Connection to use. * - * @return \$this The current Propel object + * @return \$this The current Propel object */ public function moveToPrevSiblingOf($objectClassName \$sibling, ?ConnectionInterface \$con = null) { @@ -1541,10 +1541,10 @@ protected function addMoveToNextSiblingOf(string &$script): void * Moves current node and its subtree to be the next sibling of \$sibling * The modifications in the current object and the tree are immediate * - * @param $objectClassName \$sibling Propel object for sibling node - * @param ConnectionInterface \$con Connection to use. + * @param $objectClassName \$sibling Propel object for sibling node + * @param ConnectionInterface \$con Connection to use. * - * @return \$this The current Propel object + * @return \$this The current Propel object */ public function moveToNextSiblingOf($objectClassName \$sibling, ?ConnectionInterface \$con = null) { @@ -1582,9 +1582,9 @@ protected function addMoveSubtreeTo(string &$script): void /** * Move current node and its children to location \$destLeft and updates rest of tree * - * @param int \$destLeft Destination left value - * @param int \$levelDelta Delta to add to the levels - * @param ConnectionInterface \$con Connection to use. + * @param int \$destLeft Destination left value + * @param int \$levelDelta Delta to add to the levels + * @param ConnectionInterface \$con Connection to use. */ protected function moveSubtreeTo(\$destLeft, \$levelDelta" . ($this->behavior->useScope() ? ', $targetScope = null' : '') . ", ?ConnectionInterface \$con = null) { @@ -1683,9 +1683,9 @@ protected function addDeleteDescendants(string &$script): void * Instance pooling is wiped out by this command, * so existing $objectClassName instances are probably invalid (except for the current one) * - * @param ConnectionInterface \$con Connection to use. + * @param ConnectionInterface \$con Connection to use. * - * @return int number of deleted nodes + * @return int number of deleted nodes */ public function deleteDescendants(?ConnectionInterface \$con = null) { diff --git a/src/Propel/Generator/Behavior/NestedSet/NestedSetBehaviorQueryBuilderModifier.php b/src/Propel/Generator/Behavior/NestedSet/NestedSetBehaviorQueryBuilderModifier.php index c6d6b84c3e..31eea84b8c 100644 --- a/src/Propel/Generator/Behavior/NestedSet/NestedSetBehaviorQueryBuilderModifier.php +++ b/src/Propel/Generator/Behavior/NestedSet/NestedSetBehaviorQueryBuilderModifier.php @@ -154,7 +154,7 @@ protected function addTreeRoots(string &$script): void /** * Filter the query to restrict the result to root objects * - * @return \$this The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function treeRoots() { @@ -176,9 +176,9 @@ protected function addInTree(string &$script): void /** * Returns the objects in a certain tree, from the tree scope * - * @param int|null \$scope Scope to determine which objects node to return + * @param int|null \$scope Scope to determine which objects node to return * - * @return \$this The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function inTree(?int \$scope = null) { @@ -201,9 +201,9 @@ protected function addDescendantsOf(string &$script): void /** * Filter the query to restrict the result to descendants of an object * - * @param {$this->objectClassName} $objectName The object to use for descendant search + * @param {$this->objectClassName} $objectName The object to use for descendant search * - * @return \$this The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function descendantsOf($this->objectClassName $objectName) { @@ -234,9 +234,9 @@ protected function addBranchOf(string &$script): void * Filter the query to restrict the result to the branch of an object. * Same as descendantsOf(), except that it includes the object passed as parameter in the result * - * @param {$this->objectClassName} $objectName The object to use for branch search + * @param {$this->objectClassName} $objectName The object to use for branch search * - * @return \$this The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function branchOf($this->objectClassName $objectName) { @@ -266,9 +266,9 @@ protected function addChildrenOf(string &$script): void /** * Filter the query to restrict the result to children of an object * - * @param {$this->objectClassName} $objectName The object to use for child search + * @param {$this->objectClassName} $objectName The object to use for child search * - * @return \$this The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function childrenOf($this->objectClassName $objectName) { @@ -294,10 +294,10 @@ protected function addSiblingsOf(string &$script): void * Filter the query to restrict the result to siblings of an object. * The result does not include the object passed as parameter. * - * @param {$this->objectClassName} $objectName The object to use for sibling search - * @param ConnectionInterface \$con Connection to use. + * @param {$this->objectClassName} $objectName The object to use for sibling search + * @param ConnectionInterface \$con Connection to use. * - * @return \$this The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function siblingsOf($this->objectClassName $objectName, ?ConnectionInterface \$con = null) { @@ -327,9 +327,9 @@ protected function addAncestorsOf(string &$script): void /** * Filter the query to restrict the result to ancestors of an object * - * @param {$this->objectClassName} $objectName The object to use for ancestors search + * @param {$this->objectClassName} $objectName The object to use for ancestors search * - * @return \$this The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function ancestorsOf($this->objectClassName $objectName) { @@ -360,9 +360,9 @@ protected function addRootsOf(string &$script): void * Filter the query to restrict the result to roots of an object. * Same as ancestorsOf(), except that it includes the object passed as parameter in the result * - * @param {$this->objectClassName} $objectName The object to use for roots search + * @param {$this->objectClassName} $objectName The object to use for roots search * - * @return \$this The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function rootsOf($this->objectClassName $objectName) { @@ -391,9 +391,9 @@ protected function addOrderByBranch(string &$script): void /** * Order the result by branch, i.e. natural tree order * - * @param bool \$reverse if true, reverses the order + * @param bool \$reverse if true, reverses the order * - * @return \$this The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function orderByBranch(\$reverse = false) { @@ -421,9 +421,9 @@ protected function addOrderByLevel(string &$script): void /** * Order the result by level, the closer to the root first * - * @param bool \$reverse if true, reverses the order + * @param bool \$reverse if true, reverses the order * - * @return \$this The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function orderByLevel(\$reverse = false) { @@ -456,13 +456,13 @@ protected function addFindRoot(string &$script): void *"; if ($useScope) { $script .= " - * @param int \$scope Scope to determine which root node to return"; + * @param int \$scope Scope to determine which root node to return"; } $script .= " - * @param ConnectionInterface \$con Connection to use. + * @param ConnectionInterface \$con Connection to use. * - * @return {$this->objectClassName} The tree root object + * @return {$this->objectClassName} The tree root object */ public function findRoot(" . ($useScope ? '$scope = null, ' : '') . "ConnectionInterface \$con = null) { @@ -489,9 +489,9 @@ protected function addFindRoots(string &$script): void /** * Returns the root objects for all trees. * - * @param ConnectionInterface \$con Connection to use. + * @param ConnectionInterface \$con Connection to use. * - * @return {$this->objectClassName}[]|ObjectCollection|mixed the list of results, formatted by the current formatter + * @return {$this->objectClassName}[]|ObjectCollection|mixed the list of results, formatted by the current formatter */ public function findRoots(?ConnectionInterface \$con = null) { @@ -516,13 +516,13 @@ protected function addFindTree(string &$script): void *"; if ($useScope) { $script .= " - * @param int \$scope Scope to determine which tree node to return"; + * @param int \$scope Scope to determine which tree node to return"; } $script .= " - * @param ConnectionInterface \$con Connection to use. + * @param ConnectionInterface \$con Connection to use. * - * @return {$this->objectClassName}[]|ObjectCollection|mixed the list of results, formatted by the current formatter + * @return {$this->objectClassName}[]|ObjectCollection|mixed the list of results, formatted by the current formatter */ public function findTree(" . ($useScope ? '$scope = null, ' : '') . "ConnectionInterface \$con = null) { @@ -553,9 +553,9 @@ protected function addRetrieveRoots(string &$script): void /** * Returns the root nodes for the tree * - * @param Criteria \$criteria Optional Criteria to filter the query - * @param ConnectionInterface \$con Connection to use. - * @return {$this->objectClassName}[]|ObjectCollection|mixed the list of results, formatted by the current formatter + * @param Criteria \$criteria Optional Criteria to filter the query + * @param ConnectionInterface \$con Connection to use. + * @return {$this->objectClassName}[]|ObjectCollection|mixed the list of results, formatted by the current formatter */ static public function retrieveRoots(?Criteria \$criteria = null, ?ConnectionInterface \$con = null) { @@ -587,11 +587,11 @@ protected function addRetrieveRoot(string &$script): void *"; if ($useScope) { $script .= " - * @param int \$scope Scope to determine which root node to return"; + * @param int \$scope Scope to determine which root node to return"; } $script .= " - * @param ConnectionInterface \$con Connection to use. - * @return {$this->objectClassName} Propel object for root node + * @param ConnectionInterface \$con Connection to use. + * @return {$this->objectClassName} Propel object for root node */ static public function retrieveRoot(" . ($useScope ? '$scope = null, ' : '') . "ConnectionInterface \$con = null) { @@ -626,12 +626,12 @@ protected function addRetrieveTree(string &$script): void *"; if ($useScope) { $script .= " - * @param int \$scope Scope to determine which root node to return"; + * @param int \$scope Scope to determine which root node to return"; } $script .= " - * @param Criteria \$criteria Optional Criteria to filter the query - * @param ConnectionInterface \$con Connection to use. - * @return {$this->objectClassName}[]|ObjectCollection|mixed the list of results, formatted by the current formatter + * @param Criteria \$criteria Optional Criteria to filter the query + * @param ConnectionInterface \$con Connection to use. + * @return {$this->objectClassName}[]|ObjectCollection|mixed the list of results, formatted by the current formatter */ static public function retrieveTree(" . ($useScope ? '$scope = null, ' : '') . "Criteria \$criteria = null, ?ConnectionInterface \$con = null) { @@ -663,8 +663,8 @@ protected function addIsValid(string &$script): void /** * Tests if node is valid * - * @param $objectClassName \$node Propel object for src node - * @return bool + * @param $objectClassName \$node Propel object for src node + * @return bool */ static public function isValid($objectClassName \$node = null) { @@ -694,12 +694,12 @@ protected function addDeleteTree(string &$script): void * "; if ($useScope) { $script .= " - * @param int \$scope Scope to determine which tree to delete"; + * @param int \$scope Scope to determine which tree to delete"; } $script .= " - * @param ConnectionInterface \$con Connection to use. + * @param ConnectionInterface \$con Connection to use. * - * @return int The number of deleted nodes + * @return int The number of deleted nodes */ static public function deleteTree(" . ($useScope ? '$scope = null, ' : '') . "ConnectionInterface \$con = null) {"; @@ -810,15 +810,15 @@ protected function addShiftLevel(string &$script): void * Adds \$delta to level for nodes having left value >= \$first and right value <= \$last. * '\$delta' can also be negative. * - * @param int \$delta Value to be shifted by, can be negative - * @param int \$first First node to be shifted - * @param int \$last Last node to be shifted"; + * @param int \$delta Value to be shifted by, can be negative + * @param int \$first First node to be shifted + * @param int \$last Last node to be shifted"; if ($useScope) { $script .= " - * @param int \$scope Scope to use for the shift"; + * @param int \$scope Scope to use for the shift"; } $script .= " - * @param ConnectionInterface \$con Connection to use. + * @param ConnectionInterface \$con Connection to use. */ static public function shiftLevel(\$delta, \$first, \$last" . ($useScope ? ', $scope = null' : '') . ", ?ConnectionInterface \$con = null) { @@ -858,8 +858,8 @@ protected function addUpdateLoadedNodes(string &$script): void /** * Reload all already loaded nodes to sync them with updated db * - * @param $objectClassName \$prune Object to prune from the update - * @param ConnectionInterface \$con Connection to use. + * @param $objectClassName \$prune Object to prune from the update + * @param ConnectionInterface \$con Connection to use. */ static public function updateLoadedNodes(\$prune = null, ?ConnectionInterface \$con = null) { @@ -959,14 +959,14 @@ protected function addMakeRoomForLeaf(string &$script): void /** * Update the tree to allow insertion of a leaf at the specified position * - * @param int \$left left column value"; + * @param int \$left left column value"; if ($useScope) { $script .= " - * @param integer \$scope scope column value"; + * @param int \$scope scope column value"; } $script .= " - * @param mixed \$prune Object to prune from the shift - * @param ConnectionInterface \$con Connection to use. + * @param mixed \$prune Object to prune from the shift + * @param ConnectionInterface|null \$con Connection to use. */ static public function makeRoomForLeaf(\$left" . ($useScope ? ', $scope' : '') . ", \$prune = null, ?ConnectionInterface \$con = null) { @@ -997,12 +997,13 @@ protected function addFixLevels(string &$script): void *"; if ($useScope) { $script .= " - * @param integer \$scope scope column value"; + * @param int \$scope scope column value"; } $script .= " - * @param ConnectionInterface \$con Connection to use. + * @param ConnectionInterface|null \$con Connection to use. + * @return void */ -static public function fixLevels(" . ($useScope ? '$scope, ' : '') . "ConnectionInterface \$con = null) +static public function fixLevels(" . ($useScope ? '$scope, ' : '') . "?ConnectionInterface \$con = null): void { \$c = new Criteria();"; if ($useScope) { @@ -1084,10 +1085,11 @@ protected function addSetNegativeScope(string &$script): void /** * Updates all scope values for items that has negative left (<=0) values. * - * @param mixed \$scope - * @param ConnectionInterface \$con Connection to use. + * @param mixed \$scope + * @param ConnectionInterface|null \$con Connection to use. + * @return void */ -public static function setNegativeScope(\$scope, ?ConnectionInterface \$con = null) +public static function setNegativeScope(\$scope, ?ConnectionInterface \$con = null): void { //adjust scope value to \$scope \$whereCriteria = new Criteria($tableMapClassName::DATABASE_NAME); diff --git a/src/Propel/Generator/Behavior/Sluggable/SluggableBehavior.php b/src/Propel/Generator/Behavior/Sluggable/SluggableBehavior.php index 19c210bfae..68c1d4f164 100644 --- a/src/Propel/Generator/Behavior/Sluggable/SluggableBehavior.php +++ b/src/Propel/Generator/Behavior/Sluggable/SluggableBehavior.php @@ -162,12 +162,14 @@ protected function addSlugSetter(string &$script): void /** * Wrap the setter for slug value * - * @param string - * @return \$this|" . $this->getTable()->getPhpName() . " + * @param string + * @return \$this */ public function setSlug(\$v) { - return \$this->" . $this->getColumnSetter() . "(\$v); + \$this->" . $this->getColumnSetter() . "(\$v); + + return \$this; } "; } @@ -183,7 +185,7 @@ protected function addSlugGetter(string &$script): void /** * Wrap the getter for slug value * - * @return string + * @return string */ public function getSlug() { @@ -205,7 +207,7 @@ protected function addCreateSlug(string &$script): void * * @return string The object slug */ -protected function createSlug() +protected function createSlug(): string { \$slug = \$this->createRawSlug(); \$slug = \$this->limitSlugSize(\$slug); @@ -230,11 +232,11 @@ protected function addCreateRawSlug(string &$script): void * * @return string */ -protected function createRawSlug() +protected function createRawSlug(): string { "; if ($pattern) { - $script .= "return '" . str_replace(['{', '}'], ['\' . $this->cleanupSlugPart($this->get', '()) . \''], $pattern) . "';"; + $script .= "return '" . str_replace(['{', '}'], ['\' . $this->cleanupSlugPart((string)$this->get', '()) . \''], $pattern) . "';"; } else { $script .= 'return $this->cleanupSlugPart($this->__toString());'; } @@ -255,11 +257,11 @@ public function addCleanupSlugPart(string &$script): void * Cleanup a string to make a slug of it * Removes special characters, replaces blanks with a separator, and trim it * - * @param string \$slug the text to slugify - * @param string \$replacement the separator used by slug - * @return string the slugified text + * @param string \$slug the text to slugify + * @param string \$replacement the separator used by slug + * @return string the slugified text */ -protected static function cleanupSlugPart(\$slug, \$replacement = '" . $this->getParameter('replacement') . "') +protected static function cleanupSlugPart(string \$slug, string \$replacement = '" . $this->getParameter('replacement') . "'): string { // set locale explicitly \$localeOrigin = setlocale(LC_CTYPE, 0); @@ -310,11 +312,12 @@ public function addLimitSlugSize(string &$script): void /** * Make sure the slug is short enough to accommodate the column size * - * @param string \$slug the slug to check + * @param string \$slug The slug to check + * @param int \$incrementReservedSpace Space to reserve * - * @return string the truncated slug + * @return string The truncated slug */ -protected static function limitSlugSize(\$slug, \$incrementReservedSpace = 3) +protected static function limitSlugSize(string \$slug, int \$incrementReservedSpace = 3): string { // check length, as suffix could put it over maximum if (strlen(\$slug) > ($size - \$incrementReservedSpace)) { @@ -338,12 +341,12 @@ public function addMakeSlugUnique(string &$script): void /** * Get the slug, ensuring its uniqueness * - * @param string \$slug the slug to check - * @param string \$separator the separator used by slug - * @param int \$alreadyExists false for the first try, true for the second, and take the high count + 1 - * @return string the unique slug + * @param string \$slug the slug to check + * @param string \$separator the separator used by slug + * @param bool \$alreadyExists false for the first try, true for the second, and take the high count + 1 + * @return string the unique slug */ -protected function makeSlugUnique(\$slug, \$separator = '" . $this->getParameter('separator') . "', \$alreadyExists = false) +protected function makeSlugUnique(string \$slug, string \$separator = '" . $this->getParameter('separator') . "', bool \$alreadyExists = false) {"; $getter = $this->getColumnGetter(); $script .= " @@ -406,12 +409,12 @@ protected function makeSlugUnique(\$slug, \$separator = '" . $this->getParameter ->findOne(); // First duplicate slug - if (null == \$object) { + if (\$object === null) { return \$slug2 . '1'; } \$slugNum = substr(\$object->" . $getter . "(), strlen(\$slug) + 1); - if (0 == \$slugNum[0]) { + if (\$slugNum[0] == 0) { \$slugNum[0] = 1; } @@ -449,13 +452,15 @@ protected function addFilterBySlug(string &$script): void /** * Filter the query on the slug column * - * @param string \$slug The value to use as filter. + * @param string \$slug The value to use as filter. * - * @return \$this|" . $this->builder->getQueryClassName() . " The current query, for fluid interface + * @return \$this The current query, for fluid interface */ -public function filterBySlug(\$slug) +public function filterBySlug(string \$slug) { - return \$this->addUsingAlias(" . $this->builder->getColumnConstant($this->getColumnForParameter('slug_column')) . ", \$slug, Criteria::EQUAL); + \$this->addUsingAlias(" . $this->builder->getColumnConstant($this->getColumnForParameter('slug_column')) . ", \$slug, Criteria::EQUAL); + + return \$this; } "; } @@ -471,12 +476,12 @@ protected function addFindOneBySlug(string &$script): void /** * Find one object based on its slug * - * @param string \$slug The value to use as filter. - * @param ConnectionInterface \$con The optional connection object + * @param string \$slug The value to use as filter. + * @param ConnectionInterface \$con The optional connection object * - * @return " . $this->builder->getObjectClassName() . " the result, formatted by the current formatter + * @return " . $this->builder->getObjectClassName() . " the result, formatted by the current formatter */ -public function findOneBySlug(\$slug, \$con = null) +public function findOneBySlug(string \$slug, ?ConnectionInterface \$con = null) { return \$this->filterBySlug(\$slug)->findOne(\$con); } diff --git a/src/Propel/Generator/Behavior/Sortable/SortableBehavior.php b/src/Propel/Generator/Behavior/Sortable/SortableBehavior.php index 3ca16da8e3..bd46698a3d 100644 --- a/src/Propel/Generator/Behavior/Sortable/SortableBehavior.php +++ b/src/Propel/Generator/Behavior/Sortable/SortableBehavior.php @@ -151,7 +151,7 @@ public function generateScopePhp(): array $buildScope[] = " \$scope[] = $param;\n"; $buildScopeVars[] = " $param = \$scope[$idx];\n"; - $paramsDoc[] = ' * @param ' . $column->getPhpType() . " $param Scope value for column `" . $column->getPhpName() . '`'; + $paramsDoc[] = ' * @param ' . $column->getPhpType() . " $param Scope value for column `" . $column->getPhpName() . '`'; if (!$column->isNotNull()) { $param .= ' = null'; diff --git a/src/Propel/Generator/Behavior/Sortable/SortableBehaviorObjectBuilderModifier.php b/src/Propel/Generator/Behavior/Sortable/SortableBehaviorObjectBuilderModifier.php index 9d1c8b20df..81bc8f4524 100644 --- a/src/Propel/Generator/Behavior/Sortable/SortableBehaviorObjectBuilderModifier.php +++ b/src/Propel/Generator/Behavior/Sortable/SortableBehaviorObjectBuilderModifier.php @@ -315,7 +315,7 @@ protected function addRankAccessors(string &$script): void /** * Wrap the getter for rank value * - * @return int + * @return int */ public function getRank() { @@ -325,8 +325,8 @@ public function getRank() /** * Wrap the setter for rank value * - * @param int - * @return \$this + * @param int + * @return \$this */ public function setRank(\$v) { @@ -399,8 +399,8 @@ public function getScopeValue(\$returnNulls = true) /** * Wrap the setter for scope value * - * @param mixed A array or a native type - * @return \$this + * @param mixed A array or a native type + * @return \$this */ public function setScopeValue(\$v) { @@ -457,9 +457,9 @@ protected function addIsLast(string &$script): void /** * Check if the object is last in the list, i.e. if its rank is the highest rank * - * @param ConnectionInterface \$con optional connection + * @param ConnectionInterface \$con optional connection * - * @return bool + * @return bool */ public function isLast(?ConnectionInterface \$con = null) { @@ -484,9 +484,9 @@ protected function addGetNext(string &$script): void /** * Get the next item in the list, i.e. the one for which rank is immediately higher * - * @param ConnectionInterface \$con optional connection + * @param ConnectionInterface \$con optional connection * - * @return {$this->objectClassName} + * @return {$this->objectClassName} */ public function getNext(?ConnectionInterface \$con = null) {"; @@ -533,9 +533,9 @@ protected function addGetPrevious(string &$script): void /** * Get the previous item in the list, i.e. the one for which rank is immediately lower * - * @param ConnectionInterface \$con optional connection + * @param ConnectionInterface \$con optional connection * - * @return {$this->objectClassName} + * @return {$this->objectClassName} */ public function getPrevious(?ConnectionInterface \$con = null) {"; @@ -579,10 +579,10 @@ protected function addInsertAtRank(string &$script): void * Insert at specified rank * The modifications are not persisted until the object is saved. * - * @param integer \$rank rank value - * @param ConnectionInterface \$con optional connection + * @param int \$rank rank value + * @param ConnectionInterface \$con optional connection * - * @return \$this The current object + * @return \$this The current object * * @throws PropelException */ @@ -623,7 +623,7 @@ protected function addInsertAtBottom(string &$script): void * * @param ConnectionInterface \$con optional connection * - * @return \$this the current object + * @return \$this the current object * * @throws PropelException */ @@ -649,7 +649,7 @@ protected function addInsertAtTop(string &$script): void * Insert in the first rank * The modifications are not persisted until the object is saved. * - * @return \$this the current object + * @return \$this the current object */ public function insertAtTop() { @@ -673,10 +673,10 @@ protected function addMoveToRank(string &$script): void * Move the object to a new rank, and shifts the rank * Of the objects inbetween the old and new rank accordingly * - * @param integer \$newRank rank value - * @param ConnectionInterface \$con optional connection + * @param int \$newRank rank value + * @param ConnectionInterface \$con optional connection * - * @return \$this the current object + * @return \$this the current object * * @throws PropelException */ @@ -723,10 +723,10 @@ protected function addSwapWith(string &$script): void /** * Exchange the rank of the object with the one passed as argument, and saves both objects * - * @param {$this->objectClassName} \$object - * @param ConnectionInterface \$con optional connection + * @param {$this->objectClassName} \$object + * @param ConnectionInterface \$con optional connection * - * @return \$this the current object + * @return \$this the current object * * @throws Exception if the database cannot execute the two updates */ @@ -773,9 +773,9 @@ protected function addMoveUp(string &$script): void /** * Move the object higher in the list, i.e. exchanges its rank with the one of the previous object * - * @param ConnectionInterface \$con optional connection + * @param ConnectionInterface \$con optional connection * - * @return \$this the current object + * @return \$this the current object */ public function moveUp(?ConnectionInterface \$con = null) { @@ -806,9 +806,9 @@ protected function addMoveDown(string &$script): void /** * Move the object higher in the list, i.e. exchanges its rank with the one of the next object * - * @param ConnectionInterface \$con optional connection + * @param ConnectionInterface \$con optional connection * - * @return \$this the current object + * @return \$this the current object */ public function moveDown(?ConnectionInterface \$con = null) { @@ -839,9 +839,9 @@ protected function addMoveToTop(string &$script): void /** * Move the object to the top of the list * - * @param ConnectionInterface \$con optional connection + * @param ConnectionInterface \$con optional connection * - * @return \$this the current object + * @return \$this the current object */ public function moveToTop(?ConnectionInterface \$con = null) { @@ -868,7 +868,7 @@ protected function addMoveToBottom(string &$script): void /** * Move the object to the bottom of the list * - * @param ConnectionInterface \$con optional connection + * @param ConnectionInterface \$con optional connection * * @return \$this|{$this->objectClassName}|null The old object's rank or null if already last */ @@ -903,7 +903,7 @@ protected function addRemoveFromList(string &$script): void * Removes the current object from the list" . ($useScope ? ' (moves it to the null scope)' : '') . ". * The modifications are not persisted until the object is saved. * - * @return \$this the current object + * @return \$this the current object */ public function removeFromList() {"; diff --git a/src/Propel/Generator/Behavior/Sortable/SortableBehaviorQueryBuilderModifier.php b/src/Propel/Generator/Behavior/Sortable/SortableBehaviorQueryBuilderModifier.php index 900001c7ad..9bfb50f230 100644 --- a/src/Propel/Generator/Behavior/Sortable/SortableBehaviorQueryBuilderModifier.php +++ b/src/Propel/Generator/Behavior/Sortable/SortableBehaviorQueryBuilderModifier.php @@ -150,12 +150,12 @@ public function addSortableApplyScopeCriteria(string &$script): void /** * Applies all scope fields to the given criteria. * - * @param Criteria \$criteria Applies the values directly to this criteria. - * @param mixed \$scope The scope value as scalar type or array(\$value1, ...). - * @param string \$method The method we use to apply the values. + * @param Criteria \$criteria Applies the values directly to this criteria. + * @param mixed \$scope The scope value as scalar type or array(\$value1, ...). + * @param string \$method The method we use to apply the values. * */ -static public function sortableApplyScopeCriteria(Criteria \$criteria, \$scope, \$method = 'add') +static public function sortableApplyScopeCriteria(Criteria \$criteria, \$scope, string \$method = 'add') { "; if ($this->behavior->hasMultipleScopes()) { @@ -189,7 +189,7 @@ protected function addInList(string &$script): void * $paramsDoc * - * @return \$this The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function inList($methodSignature) { @@ -217,7 +217,7 @@ protected function addFilterByRank(string &$script): void /** * Filter the query based on a rank in the list * - * @param integer \$rank rank"; + * @param int \$rank rank"; if ($useScope) { $script .= " $paramsDoc @@ -225,7 +225,7 @@ protected function addFilterByRank(string &$script): void } $script .= " * - * @return " . $this->queryClassName . " The current query, for fluid interface + * @return " . $this->queryClassName . " The current query, for fluid interface */ public function filterByRank(\$rank" . ($useScope ? ", $methodSignature" : '') . ") {"; @@ -259,20 +259,22 @@ protected function addOrderByRank(string &$script): void * Order the query based on the rank in the list. * Using the default \$order, returns the item with the lowest rank first * - * @param string \$order either Criteria::ASC (default) or Criteria::DESC + * @param string \$order either Criteria::ASC (default) or Criteria::DESC * - * @return \$this|" . $this->queryClassName . " The current query, for fluid interface + * @return \$this The current query, for fluid interface */ -public function orderByRank(\$order = Criteria::ASC) +public function orderByRank(string \$order = Criteria::ASC) { \$order = strtoupper(\$order); switch (\$order) { case Criteria::ASC: - return \$this->addAscendingOrderByColumn(\$this->getAliasedColName({$this->tableMapClassName}::RANK_COL)); - break; + \$this->addAscendingOrderByColumn(\$this->getAliasedColName({$this->tableMapClassName}::RANK_COL)); + + return \$this; case Criteria::DESC: - return \$this->addDescendingOrderByColumn(\$this->getAliasedColName({$this->tableMapClassName}::RANK_COL)); - break; + \$this->addDescendingOrderByColumn(\$this->getAliasedColName({$this->tableMapClassName}::RANK_COL)); + + return \$this; default: throw new \Propel\Runtime\Exception\PropelException('{$this->queryClassName}::orderBy() only accepts \"asc\" or \"desc\" as argument'); } @@ -296,17 +298,17 @@ protected function addFindOneByRank(string &$script): void /** * Get an item from the list based on its rank * - * @param integer \$rank rank"; + * @param int \$rank rank"; if ($useScope) { $script .= " $paramsDoc"; } $script .= " - * @param ConnectionInterface \$con optional connection + * @param ConnectionInterface \$con optional connection * - * @return {$this->objectClassName} + * @return {$this->objectClassName} */ -public function findOneByRank(\$rank, " . ($useScope ? "$methodSignature, " : '') . "ConnectionInterface \$con = null) +public function findOneByRank(\$rank, " . ($useScope ? "$methodSignature, " : '') . "?ConnectionInterface \$con = null) {"; if ($useScope) { $methodSignature = str_replace(' = null', '', $methodSignature); @@ -344,9 +346,9 @@ protected function addFindList(string &$script): void } $script .= " - * @param ConnectionInterface \$con Connection to use. + * @param ConnectionInterface \$con Connection to use. * - * @return mixed the list of results, formatted by the current formatter + * @return mixed the list of results, formatted by the current formatter */ public function findList(" . ($useScope ? "$methodSignature, " : '') . "\$con = null) {"; @@ -391,11 +393,11 @@ protected function addGetMaxRank(string &$script): void $paramsDoc"; } $script .= " - * @param ConnectionInterface optional connection + * @param ConnectionInterface|null optional connection * - * @return integer highest position + * @return int|null Highest position */ -public function getMaxRank(" . ($useScope ? "$methodSignature, " : '') . "ConnectionInterface \$con = null) +public function getMaxRank(" . ($useScope ? "$methodSignature, " : '') . "?ConnectionInterface \$con = null): ?int { if (null === \$con) { \$con = Propel::getServiceContainer()->getReadConnection({$this->tableMapClassName}::DATABASE_NAME); @@ -430,15 +432,15 @@ protected function addGetMaxRankArray(string &$script): void * "; if ($useScope) { $script .= " - * @param mixed \$scope The scope value as scalar type or array(\$value1, ...). + * @param mixed \$scope The scope value as scalar type or array(\$value1, ...). "; } $script .= " - * @param ConnectionInterface optional connection + * @param ConnectionInterface optional connection * - * @return integer highest position + * @return int|null Highest position */ -public function getMaxRankArray(" . ($useScope ? '$scope, ' : '') . "ConnectionInterface \$con = null) +public function getMaxRankArray(" . ($useScope ? '$scope, ' : '') . "ConnectionInterface \$con = null): ?int { if (\$con === null) { \$con = Propel::getConnection({$this->tableMapClassName}::DATABASE_NAME); @@ -472,10 +474,10 @@ protected function addReorder(string &$script): void * Beware that there is no check made on the positions passed * So incoherent positions will result in an incoherent list * - * @param mixed \$order id => rank pairs - * @param ConnectionInterface \$con optional connection + * @param mixed \$order id => rank pairs + * @param ConnectionInterface \$con optional connection * - * @return bool true if the reordering took place, false if a database problem prevented it + * @return bool true if the reordering took place, false if a database problem prevented it */ public function reorder(\$order, ?ConnectionInterface \$con = null) { @@ -512,13 +514,13 @@ protected function addRetrieveByRank(string &$script): void /** * Get an item from the list based on its rank * - * @param integer \$rank rank"; + * @param int \$rank rank"; if ($useScope) { $script .= " - * @param int \$scope Scope to determine which suite to consider"; + * @param int \$scope Scope to determine which suite to consider"; } $script .= " - * @param ConnectionInterface \$con optional connection + * @param ConnectionInterface \$con optional connection * * @return {$this->objectClassName} */ @@ -553,11 +555,11 @@ protected function addDoSelectOrderByRank(string &$script): void /** * Return an array of sortable objects ordered by position * - * @param Criteria \$criteria optional criteria object - * @param string \$order sorting order, to be chosen between Criteria::ASC (default) and Criteria::DESC - * @param ConnectionInterface \$con optional connection + * @param Criteria \$criteria optional criteria object + * @param string \$order sorting order, to be chosen between Criteria::ASC (default) and Criteria::DESC + * @param ConnectionInterface \$con optional connection * - * @return array list of sortable objects + * @return array list of sortable objects */ static public function doSelectOrderByRank(?Criteria \$criteria = null, \$order = Criteria::ASC, ?ConnectionInterface \$con = null) { @@ -595,11 +597,11 @@ protected function addRetrieveList(string &$script): void /** * Return an array of sortable objects in the given scope ordered by position * - * @param int \$scope the scope of the list - * @param string \$order sorting order, to be chosen between Criteria::ASC (default) and Criteria::DESC - * @param ConnectionInterface \$con optional connection + * @param int \$scope the scope of the list + * @param string \$order sorting order, to be chosen between Criteria::ASC (default) and Criteria::DESC + * @param ConnectionInterface \$con optional connection * - * @return \Propel\Runtime\Collection\ObjectCollection List of sortable objects + * @return \Propel\Runtime\Collection\ObjectCollection List of sortable objects */ static public function retrieveList(\$scope, \$order = Criteria::ASC, ?ConnectionInterface \$con = null) { @@ -622,10 +624,10 @@ protected function addCountList(string &$script): void /** * Return the number of sortable objects in the given scope * - * @param int \$scope the scope of the list - * @param ConnectionInterface \$con optional connection + * @param int \$scope the scope of the list + * @param ConnectionInterface \$con optional connection * - * @return int Count. + * @return int Count. */ static public function countList(\$scope, ?ConnectionInterface \$con = null): int { @@ -648,10 +650,10 @@ protected function addDeleteList(string &$script): void /** * Deletes the sortable objects in the given scope * - * @param int \$scope the scope of the list - * @param ConnectionInterface \$con optional connection + * @param int \$scope the scope of the list + * @param ConnectionInterface \$con optional connection * - * @return int number of deleted objects + * @return int number of deleted objects */ static public function deleteList(\$scope, ?ConnectionInterface \$con = null): int { @@ -676,15 +678,15 @@ protected function addShiftRank(string &$script): void * Adds \$delta to all Rank values that are >= \$first and <= \$last. * '\$delta' can also be negative. * - * @param int \$delta Value to be shifted by, can be negative - * @param int \$first First node to be shifted - * @param int \$last Last node to be shifted"; + * @param int \$delta Value to be shifted by, can be negative + * @param int \$first First node to be shifted + * @param int \$last Last node to be shifted"; if ($useScope) { $script .= " - * @param int \$scope Scope to use for the shift"; + * @param int \$scope Scope to use for the shift"; } $script .= " - * @param ConnectionInterface \$con Connection to use. + * @param ConnectionInterface \$con Connection to use. */ static public function sortableShiftRank(\$delta, \$first, \$last = null, " . ($useScope ? '$scope = null, ' : '') . "ConnectionInterface \$con = null) { diff --git a/src/Propel/Generator/Behavior/Timestampable/TimestampableBehavior.php b/src/Propel/Generator/Behavior/Timestampable/TimestampableBehavior.php index 929a10ae41..2cf0e62d50 100644 --- a/src/Propel/Generator/Behavior/Timestampable/TimestampableBehavior.php +++ b/src/Propel/Generator/Behavior/Timestampable/TimestampableBehavior.php @@ -163,7 +163,7 @@ public function objectMethods(AbstractOMBuilder $builder): string /** * Mark the current object so that the update date doesn't get updated during next save * - * @return \$this|" . $builder->getObjectClassName() . " The current object (for fluent API support) + * @return \$this|" . $builder->getObjectClassName() . " The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { @@ -191,9 +191,9 @@ public function queryMethods(AbstractOMBuilder $builder): string /** * Filter by the latest updated * - * @param int \$nbDays Maximum age of the latest update in days + * @param int \$nbDays Maximum age of the latest update in days * - * @return \$this|$queryClassName The current query, for fluid interface + * @return \$this|$queryClassName The current query, for fluid interface */ public function recentlyUpdated(\$nbDays = 7) { @@ -203,7 +203,7 @@ public function recentlyUpdated(\$nbDays = 7) /** * Order by update date desc * - * @return \$this|$queryClassName The current query, for fluid interface + * @return \$this|$queryClassName The current query, for fluid interface */ public function lastUpdatedFirst() { @@ -213,7 +213,7 @@ public function lastUpdatedFirst() /** * Order by update date asc * - * @return \$this|$queryClassName The current query, for fluid interface + * @return \$this|$queryClassName The current query, for fluid interface */ public function firstUpdatedFirst() { @@ -228,7 +228,7 @@ public function firstUpdatedFirst() /** * Order by create date desc * - * @return \$this|$queryClassName The current query, for fluid interface + * @return \$this|$queryClassName The current query, for fluid interface */ public function lastCreatedFirst() { @@ -238,9 +238,9 @@ public function lastCreatedFirst() /** * Filter by the latest created * - * @param int \$nbDays Maximum age of in days + * @param int \$nbDays Maximum age of in days * - * @return \$this|$queryClassName The current query, for fluid interface + * @return \$this|$queryClassName The current query, for fluid interface */ public function recentlyCreated(\$nbDays = 7) { @@ -250,7 +250,7 @@ public function recentlyCreated(\$nbDays = 7) /** * Order by create date asc * - * @return \$this|$queryClassName The current query, for fluid interface + * @return \$this|$queryClassName The current query, for fluid interface */ public function firstCreatedFirst() { diff --git a/src/Propel/Generator/Behavior/Versionable/VersionableBehaviorObjectBuilderModifier.php b/src/Propel/Generator/Behavior/Versionable/VersionableBehaviorObjectBuilderModifier.php index da939e69b5..4a1607fd41 100644 --- a/src/Propel/Generator/Behavior/Versionable/VersionableBehaviorObjectBuilderModifier.php +++ b/src/Propel/Generator/Behavior/Versionable/VersionableBehaviorObjectBuilderModifier.php @@ -260,12 +260,14 @@ protected function addVersionSetter(string &$script): void /** * Wrap the setter for version value * - * @param string - * @return \$this|" . $this->table->getPhpName() . " + * @param string + * @return \$this */ public function setVersion(\$v) { - return \$this->" . $this->getColumnSetter() . "(\$v); + \$this->" . $this->getColumnSetter() . "(\$v); + + return \$this; } "; } @@ -281,7 +283,7 @@ protected function addVersionGetter(string &$script): void /** * Wrap the getter for version value * - * @return string + * @return string */ public function getVersion() { @@ -326,8 +328,8 @@ protected function addIsVersioningNecessary(string &$script): void /** * Checks whether the current state must be recorded as a version * - * @param ConnectionInterface \$con The ConnectionInterface connection to use. - * @return bool + * @param ConnectionInterface \$con The ConnectionInterface connection to use. + * @return bool */ public function isVersioningNecessary(?ConnectionInterface \$con = null): bool { @@ -412,9 +414,9 @@ protected function addAddVersion(string &$script): void /** * Creates a version of the current object and saves it. * - * @param ConnectionInterface \$con The ConnectionInterface connection to use. + * @param ConnectionInterface \$con The ConnectionInterface connection to use. * - * @return {$versionARClassName} A version object + * @return {$versionARClassName} A version object */ public function addVersion(?ConnectionInterface \$con = null) { @@ -483,10 +485,10 @@ protected function addToVersion(string &$script): void /** * Sets the properties of the current object to the value they had at a specific version * - * @param integer \$versionNumber The version number to read - * @param ConnectionInterface \$con The ConnectionInterface connection to use. + * @param int \$versionNumber The version number to read + * @param ConnectionInterface|null \$con The ConnectionInterface connection to use. * - * @return \$this The current object (for fluent API support) + * @return \$this The current object (for fluent API support) */ public function toVersion(\$versionNumber, ?ConnectionInterface \$con = null) { @@ -519,8 +521,8 @@ protected function addPopulateFromVersion(string &$script): void * Sets the properties of the current object to the value they had at a specific version * * @param {$versionARClassName} \$version The version object to use - * @param ConnectionInterface \$con the connection to use - * @param array \$loadedObjects objects that been loaded in a chain of populateFromVersion calls on referrer or fk objects. + * @param ConnectionInterface \$con the connection to use + * @param array \$loadedObjects objects that been loaded in a chain of populateFromVersion calls on referrer or fk objects. * * @return \$this The current object (for fluent API support) */ @@ -623,7 +625,7 @@ protected function addGetLastVersionNumber(string &$script): void /** * Gets the latest persisted version number for the current object * - * @param ConnectionInterface \$con The ConnectionInterface connection to use. + * @param ConnectionInterface \$con The ConnectionInterface connection to use. * * @return int */ @@ -653,9 +655,9 @@ protected function addIsLastVersion(string &$script): void /** * Checks whether the current object is the latest one * - * @param ConnectionInterface \$con The ConnectionInterface connection to use. + * @param ConnectionInterface \$con The ConnectionInterface connection to use. * - * @return bool + * @return bool */ public function isLastVersion(?ConnectionInterface \$con = null) { @@ -676,10 +678,10 @@ protected function addGetOneVersion(string &$script): void /** * Retrieves a version object for this entity and a version number * - * @param integer \$versionNumber The version number to read - * @param ConnectionInterface \$con The ConnectionInterface connection to use. + * @param int \$versionNumber The version number to read + * @param ConnectionInterface|null \$con The ConnectionInterface connection to use. * - * @return {$versionARClassName} A version object + * @return {$versionARClassName} A version object */ public function getOneVersion(int \$versionNumber, ?ConnectionInterface \$con = null) { @@ -709,9 +711,9 @@ protected function addGetAllVersions(string &$script): void /** * Gets all the versions of this object, in incremental order * - * @param ConnectionInterface \$con The ConnectionInterface connection to use. + * @param ConnectionInterface \$con The ConnectionInterface connection to use. * - * @return ObjectCollection|{$versionARClassName}[] A list of {$versionARClassName} objects + * @return ObjectCollection|{$versionARClassName}[] A list of {$versionARClassName} objects */ public function getAllVersions(?ConnectionInterface \$con = null) { @@ -741,12 +743,12 @@ protected function addComputeDiff(string &$script): void * ); * * - * @param array \$fromVersion An array representing the original version. - * @param array \$toVersion An array representing the destination version. - * @param string \$keys Main key used for the result diff (versions|columns). - * @param array \$ignoredColumns The columns to exclude from the diff. + * @param array \$fromVersion An array representing the original version. + * @param array \$toVersion An array representing the destination version. + * @param string \$keys Main key used for the result diff (versions|columns). + * @param array \$ignoredColumns The columns to exclude from the diff. * - * @return array A list of differences + * @return array A list of differences */ protected function computeDiff(\$fromVersion, \$toVersion, \$keys = 'columns', \$ignoredColumns = []) { @@ -812,14 +814,14 @@ protected function addCompareVersion(string &$script): void * ); * * - * @param integer \$versionNumber - * @param string \$keys Main key used for the result diff (versions|columns) - * @param ConnectionInterface \$con The ConnectionInterface connection to use. - * @param array \$ignoredColumns The columns to exclude from the diff. + * @param int \$versionNumber + * @param string \$keys Main key used for the result diff (versions|columns) + * @param ConnectionInterface \$con The ConnectionInterface connection to use. + * @param array \$ignoredColumns The columns to exclude from the diff. * - * @return array A list of differences + * @return array A list of differences */ -public function compareVersion(\$versionNumber, \$keys = 'columns', ?ConnectionInterface \$con = null, \$ignoredColumns = []) +public function compareVersion(int \$versionNumber, string \$keys = 'columns', ?ConnectionInterface \$con = null, array \$ignoredColumns = []): array { \$fromVersion = \$this->toArray(); \$toVersion = \$this->getOneVersion(\$versionNumber, \$con)->toArray(); @@ -847,13 +849,13 @@ protected function addCompareVersions(string &$script): void * ); * * - * @param integer \$fromVersionNumber - * @param integer \$toVersionNumber - * @param string \$keys Main key used for the result diff (versions|columns) - * @param ConnectionInterface \$con The ConnectionInterface connection to use. - * @param array \$ignoredColumns The columns to exclude from the diff. + * @param int \$fromVersionNumber + * @param int \$toVersionNumber + * @param string \$keys Main key used for the result diff (versions|columns) + * @param ConnectionInterface|null \$con The ConnectionInterface connection to use. + * @param array \$ignoredColumns The columns to exclude from the diff. * - * @return array A list of differences + * @return array A list of differences */ public function compareVersions(int \$fromVersionNumber, int \$toVersionNumber, string \$keys = 'columns', ?ConnectionInterface \$con = null, array \$ignoredColumns = []): array { @@ -885,9 +887,9 @@ protected function addGetLastVersions(string &$script): void /** * retrieve the last \$number versions. * - * @param Integer \$number The number of record to return. - * @param Criteria \$criteria The Criteria object containing modified values. - * @param ConnectionInterface \$con The ConnectionInterface connection to use. + * @param Integer \$number The number of record to return. + * @param Criteria \$criteria The Criteria object containing modified values. + * @param ConnectionInterface \$con The ConnectionInterface connection to use. * * @return PropelCollection|{$versionARClassName}[] List of {$versionARClassName} objects */ diff --git a/src/Propel/Generator/Behavior/Versionable/VersionableBehaviorQueryBuilderModifier.php b/src/Propel/Generator/Behavior/Versionable/VersionableBehaviorQueryBuilderModifier.php index a9b2227f27..f991c23e3f 100644 --- a/src/Propel/Generator/Behavior/Versionable/VersionableBehaviorQueryBuilderModifier.php +++ b/src/Propel/Generator/Behavior/Versionable/VersionableBehaviorQueryBuilderModifier.php @@ -170,9 +170,9 @@ protected function addFilterByVersion(string &$script): void /** * Wrap the filter on the version column * - * @param int|null \$version - * @param string|null \$comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * @return \$this The current query, for fluid interface + * @param int|null \$version + * @param string|null \$comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @return \$this The current query, for fluid interface */ public function filterByVersion(\$version = null, ?string \$comparison = null) { @@ -194,8 +194,8 @@ protected function addOrderByVersion(string &$script): void /** * Wrap the order on the version column * - * @param string \$order The sorting order. Criteria::ASC by default, also accepts Criteria::DESC - * @return \$this The current query, for fluid interface + * @param string \$order The sorting order. Criteria::ASC by default, also accepts Criteria::DESC + * @return \$this The current query, for fluid interface */ public function orderByVersion(string \$order = Criteria::ASC) { diff --git a/src/Propel/Generator/Builder/Om/ObjectBuilder.php b/src/Propel/Generator/Builder/Om/ObjectBuilder.php index 5ad48165da..47d016ef53 100644 --- a/src/Propel/Generator/Builder/Om/ObjectBuilder.php +++ b/src/Propel/Generator/Builder/Om/ObjectBuilder.php @@ -1118,7 +1118,7 @@ public function addJsonAccessorComment(string &$script, Column $column): void "; if ($column->isLazyLoad()) { $script .= " - * @param ConnectionInterface \$con An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; + * @param ConnectionInterface \$con An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; } $script .= " * @return object|array{$orNull} @@ -1324,7 +1324,7 @@ public function addEnumAccessorComment(string &$script, Column $column): void * " . $column->getDescription(); if ($column->isLazyLoad()) { $script .= " - * @param ConnectionInterface An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; + * @param ConnectionInterface An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; } $script .= " * @return string{$orNull} @@ -1393,7 +1393,7 @@ public function addSetAccessorComment(string &$script, Column $column): void * " . $column->getDescription(); if ($column->isLazyLoad()) { $script .= " - * @param ConnectionInterface An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; + * @param ConnectionInterface An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; } $script .= " * @return array|null @@ -1455,11 +1455,11 @@ protected function addHasArrayElement(string &$script, Column $column): void $script .= " /** * Test the presence of a value in the [$clo] $columnType column value. - * @param mixed \$value + * @param mixed \$value * " . $column->getDescription(); if ($column->isLazyLoad()) { $script .= " - * @param ConnectionInterface \$con An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; + * @param ConnectionInterface \$con An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; } $script .= " * @return bool @@ -1517,7 +1517,7 @@ public function addDefaultAccessorComment(string &$script, Column $column): void * " . $column->getDescription(); if ($column->isLazyLoad()) { $script .= " - * @param ConnectionInterface \$con An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; + * @param ConnectionInterface \$con An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; } $script .= " * @return " . ($column->getTypeHint() ?: ($column->getPhpType() ?: 'mixed')) . $orNull . " @@ -1616,7 +1616,7 @@ protected function addLazyLoaderComment(string &$script, Column $column): void * the [$clo] column, since it is not populated by * the hydrate() method. * - * @param \$con ConnectionInterface (optional) The ConnectionInterface connection to use. + * @param \$con ConnectionInterface (optional) The ConnectionInterface connection to use. * @return void * @throws \Propel\Runtime\Exception\PropelException - any underlying error will be wrapped and re-thrown. */"; @@ -2063,7 +2063,7 @@ public function addTemporalMutatorComment(string &$script, Column $col): void /** * Sets the value of [$clo] column to a normalized version of the date/time value specified. * " . $col->getDescription() . " - * @param string|integer|\DateTimeInterface{$orNull} \$v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface{$orNull} \$v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. * @return \$this The current object (for fluent API support) */"; @@ -2219,11 +2219,11 @@ protected function addRemoveArrayElement(string &$script, Column $col): void $script .= " /** * Removes a value from the [$clo] $columnType column value. - * @param mixed \$value + * @param mixed \$value * " . $col->getDescription(); if ($col->isLazyLoad()) { $script .= " - * @param ConnectionInterface \$con An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; + * @param ConnectionInterface \$con An optional ConnectionInterface connection to use for fetching this lazy-loaded column."; } $script .= " * @return \$this The current object (for fluent API support) @@ -2304,7 +2304,7 @@ public function addEnumMutatorComment(string &$script, Column $column): void /** * Set the value of [$clo] column. * " . $column->getDescription() . " - * @param string{$orNull} \$v new value + * @param string{$orNull} \$v new value * @return \$this The current object (for fluent API support) * @throws \\Propel\\Runtime\\Exception\\PropelException */"; @@ -2369,7 +2369,7 @@ public function addSetMutatorComment(string &$script, Column $column): void /** * Set the value of [$clo] column. * " . $column->getDescription() . " - * @param array{$orNull} \$v new value + * @param array{$orNull} \$v new value * @return \$this The current object (for fluent API support) * @throws \\Propel\\Runtime\\Exception\\PropelException */"; @@ -2430,7 +2430,7 @@ public function addBooleanMutatorComment(string &$script, Column $col): void * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * " . $col->getDescription() . " - * @param bool|integer|string{$orNull} \$v The new value + * @param bool|integer|string{$orNull} \$v The new value * @return \$this The current object (for fluent API support) */"; } @@ -2618,14 +2618,14 @@ protected function addHydrateComment(string &$script): void * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array \$row The row returned by DataFetcher->fetch(). - * @param int \$startcol 0-based offset column which indicates which restultset column to start with. - * @param bool \$rehydrate Whether this object is being re-hydrated from the database. - * @param string \$indexType The index type of \$row. Mostly DataFetcher->getIndexType(). + * @param array \$row The row returned by DataFetcher->fetch(). + * @param int \$startcol 0-based offset column which indicates which restultset column to start with. + * @param bool \$rehydrate Whether this object is being re-hydrated from the database. + * @param string \$indexType The index type of \$row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column + * @return int next starting column * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */"; } @@ -2989,14 +2989,14 @@ protected function addToArray(string &$script): void * You can specify the key type of the array by passing one of the class * type constants. * - * @param string \$keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string \$keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::$defaultKeyType. - * @param bool \$includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array \$alreadyDumpedObjects List of objects to skip to avoid recursion"; + * @param bool \$includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array \$alreadyDumpedObjects List of objects to skip to avoid recursion"; if ($hasFks) { $script .= " - * @param bool \$includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE."; + * @param bool \$includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE."; } $script .= " * @@ -3145,8 +3145,8 @@ protected function addGetByNameComment(string &$script): void /** * Retrieves a field from the object by name passed in as a string. * - * @param string \$name name - * @param string \$type The type of fieldname the \$name is of: + * @param string \$name name + * @param string \$type The type of fieldname the \$name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::$defaultKeyType. @@ -3315,9 +3315,9 @@ protected function addSetByName(string &$script): void /** * Sets a field from the object by name passed in as a string. * - * @param string \$name - * @param mixed \$value field value - * @param string \$type The type of fieldname the \$name is of: + * @param string \$name + * @param mixed \$value field value + * @param string \$type The type of fieldname the \$name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::$defaultKeyType. @@ -3347,8 +3347,8 @@ protected function addSetByPosition(string &$script): void * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int \$pos position in xml schema - * @param mixed \$value field value + * @param int \$pos position in xml schema + * @param mixed \$value field value * @return \$this */ public function setByPosition(int \$pos, \$value) @@ -3424,9 +3424,9 @@ protected function addFromArray(string &$script): void * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::$defaultKeyType. * - * @param array \$arr An array to populate the object from. - * @param string \$keyType The type of keys the array uses. - * @return \$this + * @param array \$arr An array to populate the object from. + * @param string \$keyType The type of keys the array uses. + * @return \$this */ public function fromArray(array \$arr, string \$keyType = TableMap::$defaultKeyType) { @@ -3518,7 +3518,7 @@ protected function addDeleteComment(string &$script): void /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface \$con + * @param ConnectionInterface \$con * @return void * @throws \Propel\Runtime\Exception\PropelException * @see $className::setDeleted() @@ -3626,8 +3626,8 @@ protected function addReload(string &$script): void * * This will only work if the object has been saved and has a valid primary key set. * - * @param bool \$deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface \$con (optional) The ConnectionInterface connection to use. + * @param bool \$deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface \$con (optional) The ConnectionInterface connection to use. * @return void * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ @@ -3930,7 +3930,7 @@ protected function addSetPrimaryKeySinglePK(string &$script): void /** * Generic method to set the primary key ($clo column). * - * @param $ctype \$key Primary key. + * @param $ctype \$key Primary key. * @return void */ public function setPrimaryKey(\$key): void @@ -3953,7 +3953,7 @@ protected function addSetPrimaryKeyMultiPK(string &$script): void /** * Set the [composite] primary key. * - * @param array \$keys The elements of the composite key (order must match the order in XML file). + * @param array \$keys The elements of the composite key (order must match the order in XML file). * @return void */ public function setPrimaryKey(\$keys): void @@ -4138,7 +4138,7 @@ protected function addFKMutator(string &$script, ForeignKey $fk): void /** * Declares an association between this object and a $className object. * - * @param {$className}{$orNull} \$v + * @param {$className}{$orNull} \$v * @return \$this The current object (for fluent API support) * @throws \Propel\Runtime\Exception\PropelException */ @@ -4267,7 +4267,7 @@ protected function addFKAccessor(string &$script, ForeignKey $fk): void /** * Get the associated $className object * - * @param ConnectionInterface \$con Optional Connection object. + * @param ConnectionInterface \$con Optional Connection object. * @return {$className}{$orNull} $returnDesc * @throws \Propel\Runtime\Exception\PropelException */ @@ -4359,9 +4359,9 @@ protected function addRefFKGetJoinMethods(string &$script, ForeignKey $refFK): v * api reasonable. You can provide public methods for those you * actually need in " . $table->getPhpName() . ". * - * @param Criteria \$criteria optional Criteria object to narrow the query - * @param ConnectionInterface \$con optional connection object - * @param string \$joinBehavior optional join type to use (defaults to $joinBehavior) + * @param Criteria \$criteria optional Criteria object to narrow the query + * @param ConnectionInterface \$con optional connection object + * @param string \$joinBehavior optional join type to use (defaults to $joinBehavior) * @return ObjectCollection|{$className}[] List of $className objects * @phpstan-return ObjectCollection&\Traversable<$className}> List of $className objects */ @@ -4460,7 +4460,7 @@ protected function addInitRelations(string &$script, array $referrers): void * Avoids crafting an 'init[\$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string \$relationName The name of the relation to initialize + * @param string \$relationName The name of the relation to initialize * @return void */ public function initRelation(\$relationName) @@ -4534,12 +4534,12 @@ protected function addRefFKInit(string &$script, ForeignKey $refFK): void * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param bool \$overrideExisting If set to true, the method call initializes + * @param bool \$overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function init$relCol(\$overrideExisting = true) + public function init$relCol(bool \$overrideExisting = true): void { if (null !== \$this->$collName && !\$overrideExisting) { return; @@ -4580,7 +4580,7 @@ protected function addRefFKAdd(string &$script, ForeignKey $refFK): void * Method called to associate a $className object to this object * through the $className foreign key attribute. * - * @param $className \$l $className + * @param $className \$l $className * @return \$this The current object (for fluent API support) */ public function add" . $this->getRefFKPhpNameAffix($refFK, false) . "($className \$l) @@ -4624,13 +4624,13 @@ protected function addRefFKCount(string &$script, ForeignKey $refFK): void /** * Returns the number of related $className objects. * - * @param Criteria \$criteria - * @param bool \$distinct - * @param ConnectionInterface \$con - * @return int Count of related $className objects. + * @param Criteria \$criteria + * @param bool \$distinct + * @param ConnectionInterface \$con + * @return int Count of related $className objects. * @throws \Propel\Runtime\Exception\PropelException */ - public function count{$relCol}(?Criteria \$criteria = null, \$distinct = false, ?ConnectionInterface \$con = null) + public function count{$relCol}(?Criteria \$criteria = null, bool \$distinct = false, ?ConnectionInterface \$con = null): int { \$partial = \$this->{$collName}Partial && !\$this->isNew(); if (null === \$this->$collName || null !== \$criteria || \$partial) { @@ -4683,8 +4683,8 @@ protected function addRefFKGet(string &$script, ForeignKey $refFK): void * If this " . $this->getObjectClassName() . " is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria \$criteria optional Criteria object to narrow the query - * @param ConnectionInterface \$con optional connection object + * @param Criteria \$criteria optional Criteria object to narrow the query + * @param ConnectionInterface \$con optional connection object * @return ObjectCollection|{$className}[] List of $className objects * @phpstan-return ObjectCollection&\Traversable<{$className}> List of $className objects * @throws \Propel\Runtime\Exception\PropelException @@ -4770,9 +4770,9 @@ protected function addRefFKSet(string &$script, ForeignKey $refFK): void * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection \${$inputCollection} A Propel collection. - * @param ConnectionInterface \$con Optional connection object - * @return \$this|" . $this->getObjectClassname() . " The current object (for fluent API support) + * @param Collection \${$inputCollection} A Propel collection. + * @param ConnectionInterface \$con Optional connection object + * @return \$this The current object (for fluent API support) */ public function set{$relatedName}(Collection \${$inputCollection}, ?ConnectionInterface \$con = null) { @@ -4871,8 +4871,8 @@ protected function addRefFKRemove(string &$script, ForeignKey $refFK): void $script .= " /** - * @param {$className} \${$lowerRelatedObjectClassName} The $className object to remove. - * @return \$this|" . $this->getObjectClassname() . " The current object (for fluent API support) + * @param {$className} \${$lowerRelatedObjectClassName} The $className object to remove. + * @return \$this The current object (for fluent API support) */ public function remove{$relatedObjectClassName}($className \${$lowerRelatedObjectClassName}) { @@ -4922,7 +4922,7 @@ protected function addPKRefFKGet(string &$script, ForeignKey $refFK): void /** * Gets a single $className object, which is related to this object by a one-to-one relationship. * - * @param ConnectionInterface \$con optional connection object + * @param ConnectionInterface \$con optional connection object * @return $className|null * @throws \Propel\Runtime\Exception\PropelException */ @@ -4958,7 +4958,7 @@ 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 \$v $className * @return \$this The current object (for fluent API support) * @throws \Propel\Runtime\Exception\PropelException */ @@ -5628,8 +5628,8 @@ protected function addCrossFKGet(string &$script, CrossForeignKeys $crossFKs): v * If this " . $this->getObjectClassName() . " is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria \$criteria Optional query object to filter the query - * @param ConnectionInterface \$con Optional connection object + * @param Criteria \$criteria Optional query object to filter the query + * @param ConnectionInterface \$con Optional connection object * * @return ObjectCombinationCollection Combination list of {$classNames} objects */ @@ -5753,8 +5753,8 @@ public function get{$firstFkName}($signature, ?Criteria \$criteria = null, ?Conn * If this " . $this->getObjectClassName() . " is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria \$criteria Optional query object to filter the query - * @param ConnectionInterface \$con Optional connection object + * @param Criteria \$criteria Optional query object to filter the query + * @param ConnectionInterface \$con Optional connection object * * @return ObjectCollection|{$relatedObjectClassName}[] List of {$relatedObjectClassName} objects * @phpstan-return ObjectCollection&\Traversable<{$relatedObjectClassName}> List of {$relatedObjectClassName} objects @@ -5831,9 +5831,9 @@ protected function addCrossFKSet(string &$script, CrossForeignKeys $crossFKs): v * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection \${$inputCollection} A Propel collection. - * @param ConnectionInterface \$con Optional connection object - * @return \$this|" . $this->getObjectClassname() . " The current object (for fluent API support) + * @param Collection \${$inputCollection} A Propel collection. + * @param ConnectionInterface \$con Optional connection object + * @return \$this The current object (for fluent API support) */ public function set{$relatedNamePlural}(Collection \${$inputCollection}, ?ConnectionInterface \$con = null) { @@ -5908,9 +5908,9 @@ protected function addCrossFKCount(string &$script, CrossForeignKeys $crossFKs): * Gets the number of $relatedObjectClassName objects related by a many-to-many relationship * to the current object by way of the $crossRefTableName cross-reference table. * - * @param Criteria \$criteria Optional query object to filter the query - * @param bool \$distinct Set to true to force count distinct - * @param ConnectionInterface \$con Optional connection object + * @param Criteria \$criteria Optional query object to filter the query + * @param bool \$distinct Set to true to force count distinct + * @param ConnectionInterface \$con Optional connection object * * @return int The number of related $relatedObjectClassName objects */ @@ -6286,13 +6286,13 @@ protected function addDoSave(string &$script): void * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface \$con"; + * @param ConnectionInterface \$con"; if ($reloadOnUpdate || $reloadOnInsert) { $script .= " - * @param bool \$skipReload Whether to skip the reload for this object from database."; + * @param bool \$skipReload Whether to skip the reload for this object from database."; } $script .= " - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws \Propel\Runtime\Exception\PropelException * @see save() */ @@ -6433,7 +6433,7 @@ protected function addDoInsert(): string /** * Insert the row in the database. * - * @param ConnectionInterface \$con + * @param ConnectionInterface \$con * * @throws \Propel\Runtime\Exception\PropelException * @see doSave() @@ -6677,7 +6677,7 @@ protected function addDoUpdate(): string /** * Update the row in the database. * - * @param ConnectionInterface \$con + * @param ConnectionInterface \$con * * @return int Number of updated rows * @see doSave() @@ -6766,13 +6766,13 @@ protected function addSaveComment(string &$script): void } $script .= " * - * @param ConnectionInterface \$con"; + * @param ConnectionInterface \$con"; if ($reloadOnUpdate || $reloadOnInsert) { $script .= " - * @param boolean \$skipReload Whether to skip the reload for this object from database."; + * @param boolean \$skipReload Whether to skip the reload for this object from database."; } $script .= " - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */"; @@ -6999,7 +6999,7 @@ protected function addCopy(string &$script): void * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param bool \$deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool \$deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return " . $this->getObjectClassName(true) . " Clone of current object. * @throws \Propel\Runtime\Exception\PropelException */ @@ -7034,9 +7034,9 @@ protected function addCopyInto(string &$script): void * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object \$copyObj An object of " . $this->getObjectClassName(true) . " (or compatible) type. - * @param bool \$deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param bool \$makeNew Whether to reset autoincrement PKs and make the object new. + * @param object \$copyObj An object of " . $this->getObjectClassName(true) . " (or compatible) type. + * @param bool \$deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool \$makeNew Whether to reset autoincrement PKs and make the object new. * @throws \Propel\Runtime\Exception\PropelException * @return void */ diff --git a/src/Propel/Generator/Builder/Om/QueryBuilder.php b/src/Propel/Generator/Builder/Om/QueryBuilder.php index b495d8077e..c668ca6749 100644 --- a/src/Propel/Generator/Builder/Om/QueryBuilder.php +++ b/src/Propel/Generator/Builder/Om/QueryBuilder.php @@ -442,9 +442,9 @@ protected function addConstructorComment(string &$script): void /** * Initializes internal state of " . $this->getClassName() . " object. * - * @param string \$dbName The database name - * @param string \$modelName The phpName of a model, e.g. 'Book' - * @param string \$modelAlias The alias for the model in this query, e.g. 'b' + * @param string \$dbName The database name + * @param string \$modelName The phpName of a model, e.g. 'Book' + * @param string \$modelAlias The alias for the model in this query, e.g. 'b' */"; } @@ -519,8 +519,8 @@ protected function addFactoryComment(string &$script): void /** * Returns a new " . $classname . " object. * - * @param string \$modelAlias The alias of a model in the query - * @param Criteria \$criteria Optional Criteria to build the query from + * @param string \$modelAlias The alias of a model in the query + * @param Criteria \$criteria Optional Criteria to build the query from * * @return " . $classname . " */"; @@ -734,8 +734,8 @@ protected function findPkSimple(\$key, ConnectionInterface \$con) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed \$key Primary key to use for the query - * @param ConnectionInterface \$con A connection object + * @param mixed \$key Primary key to use for the query + * @param ConnectionInterface \$con A connection object * * @throws \\Propel\\Runtime\\Exception\\PropelException * @@ -807,8 +807,8 @@ protected function addFindPkComplex(string &$script): void /** * Find object by primary key. * - * @param mixed \$key Primary key to use for the query - * @param ConnectionInterface \$con A connection object + * @param mixed \$key Primary key to use for the query + * @param ConnectionInterface \$con A connection object * * @return " . $class . "|array|mixed the result, formatted by the current formatter */ @@ -855,8 +855,8 @@ protected function addFindPks(string &$script): void } $script .= " * - * @param array \$keys Primary keys to use for the query - * @param ConnectionInterface \$con an optional connection object + * @param array \$keys Primary keys to use for the query + * @param ConnectionInterface \$con an optional connection object * * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter */ @@ -900,9 +900,9 @@ protected function addFilterByPrimaryKey(string &$script): void /** * Filter the query by primary key * - * @param mixed \$key Primary key to use for the query + * @param mixed \$key Primary key to use for the query * - * @return \$this|" . $this->getQueryClassName() . " The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function filterByPrimaryKey(\$key) {"; @@ -925,7 +925,9 @@ public function filterByPrimaryKey(\$key) $const = $this->getColumnConstant($col); $script .= " - return \$this->addUsingAlias($const, \$key, Criteria::EQUAL);"; + \$this->addUsingAlias($const, \$key, Criteria::EQUAL); + + return \$this;"; } else { // composite primary key $i = 0; @@ -957,9 +959,9 @@ protected function addFilterByPrimaryKeys(string &$script): void /** * Filter the query by a list of primary keys * - * @param array \$keys The list of primary key to use for the query + * @param array|int \$keys The list of primary key to use for the query * - * @return \$this|" . $this->getQueryClassName() . " The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function filterByPrimaryKeys(\$keys) {"; @@ -982,12 +984,16 @@ public function filterByPrimaryKeys(\$keys) $const = $this->getColumnConstant($col); $script .= " - return \$this->addUsingAlias($const, \$keys, Criteria::IN);"; + \$this->addUsingAlias($const, \$keys, Criteria::IN); + + return \$this;"; } else { // composite primary key $script .= " if (empty(\$keys)) { - return \$this->add(null, '1<>1', Criteria::CUSTOM); + \$this->add(null, '1<>1', Criteria::CUSTOM); + + return \$this; } foreach (\$keys as \$key) {"; $i = 0; @@ -1048,7 +1054,7 @@ protected function addFilterByCol(string &$script, Column $col): void } $script .= " * - * @param mixed \$$variableName The value to use as filter. + * @param mixed \$$variableName The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => \$minValue, 'max' => \$maxValue) for intervals."; @@ -1061,7 +1067,7 @@ protected function addFilterByCol(string &$script, Column $col): void * \$query->filterBy$colPhpName(array('max' => 'yesterday')); // WHERE $colName > '2011-03-13' * * - * @param mixed \$$variableName The value to use as filter. + * @param mixed \$$variableName The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. @@ -1069,7 +1075,7 @@ protected function addFilterByCol(string &$script, Column $col): void * Use associative array('min' => \$minValue, 'max' => \$maxValue) for intervals."; } elseif ($col->getType() == PropelTypes::PHP_ARRAY) { $script .= " - * @param array \$$variableName The values to use as filter."; + * @param array \$$variableName The values to use as filter."; } elseif ($col->isTextType()) { $script .= " * Example usage: @@ -1079,7 +1085,7 @@ protected function addFilterByCol(string &$script, Column $col): void * \$query->filterBy$colPhpName(['foo', 'bar']); // WHERE $colName IN ('foo', 'bar') * * - * @param string|string[] \$$variableName The value to use as filter."; + * @param string|string[] \$$variableName The value to use as filter."; } elseif ($col->isBooleanType()) { $script .= " * Example usage: @@ -1088,17 +1094,17 @@ protected function addFilterByCol(string &$script, Column $col): void * \$query->filterBy$colPhpName('yes'); // WHERE $colName = true * * - * @param bool|string \$$variableName The value to use as filter. + * @param bool|string \$$variableName The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false')."; } else { $script .= " - * @param mixed \$$variableName The value to use as filter"; + * @param mixed \$$variableName The value to use as filter"; } $script .= " - * @param string \$comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string \$comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return \$this|" . $this->getQueryClassName() . " The current query, for fluid interface */ @@ -1255,10 +1261,10 @@ protected function addFilterByArrayCol(string &$script, Column $col): void $script .= " /** * Filter the query on the $colName column - * @param mixed \$$variableName The value to use as filter - * @param string \$comparison Operator to use for the column comparison, defaults to Criteria::CONTAINS_ALL + * @param mixed \$$variableName The value to use as filter + * @param string \$comparison Operator to use for the column comparison, defaults to Criteria::CONTAINS_ALL * - * @return \$this|" . $this->getQueryClassName() . " The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function filterBy$singularPhpName(\$$variableName = null, \$comparison = null) { @@ -1281,7 +1287,9 @@ public function filterBy$singularPhpName(\$$variableName = null, \$comparison = return \$this; } - return \$this->addUsingAlias($qualifiedName, \$$variableName, \$comparison); + \$this->addUsingAlias($qualifiedName, \$$variableName, \$comparison); + + return \$this; } "; } @@ -1303,8 +1311,8 @@ protected function addFilterBySetCol(string &$script, Column $col): void $script .= " /** * Filter the query on the $colName column - * @param mixed \$$variableName The value to use as filter - * @param string \$comparison Operator to use for the column comparison, defaults to Criteria::CONTAINS_ALL + * @param mixed \$$variableName The value to use as filter + * @param string \$comparison Operator to use for the column comparison, defaults to Criteria::CONTAINS_ALL * * @return \$this|" . $this->getQueryClassName() . " The current query, for fluid interface */ @@ -1529,10 +1537,10 @@ protected function addJoinRelated( /** * Adds a JOIN clause to the query using the " . $relationName . " relation * - * @param string \$relationAlias optional alias for the relation - * @param string \$joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string \$relationAlias optional alias for the relation + * @param string \$joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return \$this|" . $queryClass . " The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function join" . $relationName . '($relationAlias = null, $joinType = ' . $joinType . ") { @@ -1621,9 +1629,9 @@ protected function addUseRelatedQuery(string &$script, Table $fkTable, string $q * * @see useQuery() * - * @param string \$relationAlias optional alias for the relation, + * @param string \$relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string \$joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string \$joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return $queryClass A secondary query class using the current class as primary query */ @@ -1787,9 +1795,9 @@ protected function addPrune(string &$script): void /** * Exclude object from result * - * @param $class $objectName Object to remove from the list of results + * @param $class $objectName Object to remove from the list of results * - * @return \$this|" . $this->getQueryClassName() . " The current query, for fluid interface + * @return \$this The current query, for fluid interface */ public function prune($objectName = null) { @@ -1846,7 +1854,7 @@ protected function addBasePreSelect(string &$script): void /** * Code to execute before every SELECT statement * - * @param ConnectionInterface \$con The connection object used by the query + * @param ConnectionInterface \$con The connection object used by the query */ protected function basePreSelect(ConnectionInterface \$con): void {" . $behaviorCode . " @@ -1874,7 +1882,7 @@ protected function addBasePreDelete(string &$script): void /** * Code to execute before every DELETE statement * - * @param ConnectionInterface \$con The connection object used by the query + * @param ConnectionInterface \$con The connection object used by the query * @return int|null */ protected function basePreDelete(ConnectionInterface \$con): ?int @@ -1903,8 +1911,8 @@ protected function addBasePostDelete(string &$script): void /** * Code to execute after every DELETE statement * - * @param int \$affectedRows the number of deleted rows - * @param ConnectionInterface \$con The connection object used by the query + * @param int \$affectedRows the number of deleted rows + * @param ConnectionInterface \$con The connection object used by the query * @return int|null */ protected function basePostDelete(int \$affectedRows, ConnectionInterface \$con): ?int @@ -1933,9 +1941,9 @@ protected function addBasePreUpdate(string &$script): void /** * Code to execute before every UPDATE statement * - * @param array \$values The associative array of columns and values for the update - * @param ConnectionInterface \$con The connection object used by the query - * @param bool \$forceIndividualSaves If false (default), the resulting call is a Criteria::doUpdate(), otherwise it is a series of save() calls on all the found objects + * @param array \$values The associative array of columns and values for the update + * @param ConnectionInterface \$con The connection object used by the query + * @param bool \$forceIndividualSaves If false (default), the resulting call is a Criteria::doUpdate(), otherwise it is a series of save() calls on all the found objects * * @return int|null */ @@ -1965,8 +1973,8 @@ protected function addBasePostUpdate(string &$script): void /** * Code to execute after every UPDATE statement * - * @param int \$affectedRows the number of updated rows - * @param ConnectionInterface \$con The connection object used by the query + * @param int \$affectedRows the number of updated rows + * @param ConnectionInterface \$con The connection object used by the query * * @return int|null */ @@ -2033,7 +2041,7 @@ protected function addDelete(string &$script): void * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface \$con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. diff --git a/src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php b/src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php index 9f08fb947d..4990fc7430 100644 --- a/src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php +++ b/src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php @@ -200,8 +200,8 @@ protected function addFactory(string &$script): void /** * Returns a new " . $classname . " object. * - * @param string \$modelAlias The alias of a model in the query - * @param Criteria \$criteria Optional Criteria to build the query from + * @param string \$modelAlias The alias of a model in the query + * @param Criteria \$criteria Optional Criteria to build the query from * * @return " . $classname . " */ diff --git a/src/Propel/Generator/Builder/Om/TableMapBuilder.php b/src/Propel/Generator/Builder/Om/TableMapBuilder.php index 9eacda7ded..5d56228fbe 100644 --- a/src/Propel/Generator/Builder/Om/TableMapBuilder.php +++ b/src/Propel/Generator/Builder/Om/TableMapBuilder.php @@ -353,19 +353,19 @@ public function addInheritanceColumnConstants(string &$script): void $script .= " /** A key representing a particular subclass */ - const CLASSKEY_" . $child->getConstantSuffix() . " = '" . $child->getKey() . "'; + public const CLASSKEY_" . $child->getConstantSuffix() . " = '" . $child->getKey() . "'; "; if (strtoupper($child->getClassName()) != $child->getConstantSuffix()) { $script .= " /** A key representing a particular subclass */ - const CLASSKEY_" . strtoupper($child->getClassname()) . " = '" . $fqcn . "'; + public const CLASSKEY_" . strtoupper($child->getClassname()) . " = '" . $fqcn . "'; "; } $script .= " /** A class that can be returned by this tableMap. */ - const CLASSNAME_" . $child->getConstantSuffix() . " = '" . $fqcn . "'; + public const CLASSNAME_" . $child->getConstantSuffix() . " = '" . $fqcn . "'; "; } } @@ -885,8 +885,8 @@ protected function addGetPrimaryKeyHash(string &$script): void * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array \$row resultset row. - * @param int \$offset The 0-based offset for reading from the resultset row. + * @param array \$row resultset row. + * @param int \$offset The 0-based offset for reading from the resultset row. * @param string \$indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * @@ -927,8 +927,8 @@ protected function addGetPrimaryKeyFromRow(string &$script): void * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array \$row resultset row. - * @param int \$offset The 0-based offset for reading from the resultset row. + * @param array \$row resultset row. + * @param int \$offset The 0-based offset for reading from the resultset row. * @param string \$indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * @@ -1024,8 +1024,8 @@ protected function addGetOMClassInheritance(string &$script): void * The returned Class will contain objects of the default type or * objects that inherit from the default. * - * @param array \$row ConnectionInterface result row. - * @param int \$colNum Column to examine for OM class information (first is 0). + * @param array \$row ConnectionInterface result row. + * @param int \$colNum Column to examine for OM class information (first is 0). * @param bool \$withPrefix Whether to return the path with the class name * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. @@ -1148,15 +1148,15 @@ protected function addPopulateObject(string &$script): void /** * Populates an object of the default type or an object that inherit from the default. * - * @param array \$row row returned by DataFetcher->fetch(). - * @param int \$offset The 0-based offset for reading from the resultset row. + * @param array \$row row returned by DataFetcher->fetch(). + * @param int \$offset The 0-based offset for reading from the resultset row. * @param string \$indexType The index type of \$row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (" . $this->getObjectClassName() . " object, last column rank) + * @return array (" . $this->getObjectClassName() . " object, last column rank) */ public static function populateObject(array \$row, int \$offset = 0, string \$indexType = TableMap::TYPE_NUM): array { @@ -1421,10 +1421,10 @@ protected function addDoDelete(string &$script): void /** * Performs a DELETE on the database, given a " . $this->getObjectClassName() . " or Criteria object OR a primary key value. * - * @param mixed \$values Criteria or " . $this->getObjectClassName() . " object or primary key or array of primary keys + * @param mixed \$values Criteria or " . $this->getObjectClassName() . " object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface \$con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface \$con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. @@ -1528,9 +1528,9 @@ protected function addDoInsert(string &$script): void /** * Performs an INSERT on the database, given a " . $this->getObjectClassName() . " or Criteria object. * - * @param mixed \$criteria Criteria or " . $this->getObjectClassName() . " object containing data that is used to create the INSERT statement. + * @param mixed \$criteria Criteria or " . $this->getObjectClassName() . " object containing data that is used to create the INSERT statement. * @param ConnectionInterface \$con the ConnectionInterface connection to use - * @return mixed The new primary key. + * @return mixed The new primary key. * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ diff --git a/templates/Behavior/Archivable/objectArchive.php b/templates/Behavior/Archivable/objectArchive.php index 5ebaecc2d4..18eba1ca3d 100644 --- a/templates/Behavior/Archivable/objectArchive.php +++ b/templates/Behavior/Archivable/objectArchive.php @@ -4,13 +4,13 @@ * If the current object has already been archived, the archived object * is updated and not duplicated. * - * @param ConnectionInterface $con Optional connection object + * @param ConnectionInterface|null $con Optional connection object * * @throws \Propel\Runtime\Exception\PropelException If the object is new * - * @return The archive object based on this object + * @return The archive object based on this object */ -public function archive(ConnectionInterface $con = null) +public function archive(?ConnectionInterface $con = null) { if ($this->isNew()) { throw new PropelException('New objects cannot be archived. You must save the current object before calling archive().'); diff --git a/templates/Behavior/Archivable/objectDeleteWithoutArchive.php b/templates/Behavior/Archivable/objectDeleteWithoutArchive.php index fda5d4a92c..bdd2eddd27 100644 --- a/templates/Behavior/Archivable/objectDeleteWithoutArchive.php +++ b/templates/Behavior/Archivable/objectDeleteWithoutArchive.php @@ -2,11 +2,11 @@ /** * Removes the object from the database without archiving it. * - * @param ConnectionInterface $con Optional connection object + * @param ConnectionInterface|null $con Optional connection object * * @return $this| The current object (for fluent API support) */ -public function deleteWithoutArchive(ConnectionInterface $con = null) +public function deleteWithoutArchive(?ConnectionInterface $con = null) { $this->archiveOnDelete = false; diff --git a/templates/Behavior/Archivable/objectGetArchive.php b/templates/Behavior/Archivable/objectGetArchive.php index d814f6d706..ee7cea1143 100644 --- a/templates/Behavior/Archivable/objectGetArchive.php +++ b/templates/Behavior/Archivable/objectGetArchive.php @@ -2,11 +2,11 @@ /** * Get an archived version of the current object. * - * @param ConnectionInterface $con Optional connection object + * @param ConnectionInterface|null $con Optional connection object * - * @return An archive object, or null if the current object was never archived + * @return An archive object, or null if the current object was never archived */ -public function getArchive(ConnectionInterface $con = null) +public function getArchive(?ConnectionInterface $con = null) { if ($this->isNew()) { return null; diff --git a/templates/Behavior/Archivable/objectPopulateFromArchive.php b/templates/Behavior/Archivable/objectPopulateFromArchive.php index f1a8a9888e..27ccfb4260 100644 --- a/templates/Behavior/Archivable/objectPopulateFromArchive.php +++ b/templates/Behavior/Archivable/objectPopulateFromArchive.php @@ -2,16 +2,17 @@ /** * Populates the the current object based on a $archiveTablePhpName archive object. * - * @param $archive An archived object based on the same class + * @param $archive An archived object based on the same class - * @param bool $populateAutoIncrementPrimaryKeys + * @param bool $populateAutoIncrementPrimaryKeys * If true, autoincrement columns are copied from the archive object. * If false, autoincrement columns are left intact. * - * @return The current object (for fluent API support) + * @return The current object (for fluent API support) */ -public function populateFromArchive($archive, $populateAutoIncrementPrimaryKeys = false) { +public function populateFromArchive($archive, bool $populateAutoIncrementPrimaryKeys = false) +{ if ($populateAutoIncrementPrimaryKeys) { diff --git a/templates/Behavior/Archivable/objectRestoreFromArchive.php b/templates/Behavior/Archivable/objectRestoreFromArchive.php index b9c371a322..e0c12d073d 100644 --- a/templates/Behavior/Archivable/objectRestoreFromArchive.php +++ b/templates/Behavior/Archivable/objectRestoreFromArchive.php @@ -3,13 +3,13 @@ * Revert the the current object to the state it had when it was last archived. * The object must be saved afterwards if the changes must persist. * - * @param ConnectionInterface $con Optional connection object + * @param ConnectionInterface|null $con Optional connection object * * @throws \Propel\Runtime\Exception\PropelException If the object has no corresponding archive. * * @return $this The current object (for fluent API support) */ -public function restoreFromArchive(ConnectionInterface $con = null) +public function restoreFromArchive(?ConnectionInterface $con = null) { $archive = $this->getArchive($con); if (!$archive) { diff --git a/templates/Behavior/Archivable/objectSaveWithoutArchive.php b/templates/Behavior/Archivable/objectSaveWithoutArchive.php index e6faf7d3c7..d95ffcf456 100644 --- a/templates/Behavior/Archivable/objectSaveWithoutArchive.php +++ b/templates/Behavior/Archivable/objectSaveWithoutArchive.php @@ -2,11 +2,11 @@ /** * Persists the object to the database without archiving it. * - * @param ConnectionInterface $con Optional connection object + * @param ConnectionInterface|null $con Optional connection object * * @return $this| The current object (for fluent API support) */ -public function saveWithoutArchive(ConnectionInterface $con = null) +public function saveWithoutArchive(?ConnectionInterface $con = null) { if (!$this->isNew()) { diff --git a/templates/Behavior/Archivable/queryArchive.php b/templates/Behavior/Archivable/queryArchive.php index a8d190d795..f2292db86c 100644 --- a/templates/Behavior/Archivable/queryArchive.php +++ b/templates/Behavior/Archivable/queryArchive.php @@ -6,12 +6,12 @@ * is updated and not duplicated. * Warning: This termination methods issues 2n+1 queries. * - * @param ConnectionInterface $con Connection to use. - * @param bool $useLittleMemory Whether to use OnDemandFormatter to retrieve objects. + * @param ConnectionInterface|null $con Connection to use. + * @param bool $useLittleMemory Whether to use OnDemandFormatter to retrieve objects. * Set to false if the identity map matters. * Set to true (default) to use less memory. * - * @return int the number of archived objects + * @return int the number of archived objects */ public function archive($con = null, $useLittleMemory = true) { diff --git a/templates/Behavior/Archivable/queryDeleteWithoutArchive.php b/templates/Behavior/Archivable/queryDeleteWithoutArchive.php index 2f44ce651c..64df2dbc9f 100644 --- a/templates/Behavior/Archivable/queryDeleteWithoutArchive.php +++ b/templates/Behavior/Archivable/queryDeleteWithoutArchive.php @@ -2,7 +2,7 @@ /** * Delete records matching the current query without archiving them. * - * @param ConnectionInterface $con Connection to use. + * @param ConnectionInterface|null $con Connection to use. * * @return int The number of deleted rows */ @@ -16,7 +16,7 @@ public function deleteWithoutArchive($con = null): int /** * Delete all records without archiving them. * - * @param ConnectionInterface $con Connection to use. + * @param ConnectionInterface|null $con Connection to use. * * @return int The number of deleted rows */ diff --git a/templates/Behavior/Archivable/querySetArchiveOnDelete.php b/templates/Behavior/Archivable/querySetArchiveOnDelete.php index d33e590fa2..f67b3632cd 100644 --- a/templates/Behavior/Archivable/querySetArchiveOnDelete.php +++ b/templates/Behavior/Archivable/querySetArchiveOnDelete.php @@ -4,7 +4,7 @@ * * @param bool True if the query must archive deleted objects, false otherwise. */ -public function setArchiveOnDelete($archiveOnDelete) +public function setArchiveOnDelete(bool $archiveOnDelete) { $this->archiveOnDelete = $archiveOnDelete; } diff --git a/templates/Behavior/Archivable/querySetArchiveOnUpdate.php b/templates/Behavior/Archivable/querySetArchiveOnUpdate.php index cb5c33354b..6b8b06c76f 100644 --- a/templates/Behavior/Archivable/querySetArchiveOnUpdate.php +++ b/templates/Behavior/Archivable/querySetArchiveOnUpdate.php @@ -4,7 +4,7 @@ * * @param bool True if the query must archive updated objects, false otherwise. */ -public function setArchiveOnUpdate($archiveOnUpdate) +public function setArchiveOnUpdate(bool $archiveOnUpdate) { $this->archiveOnUpdate = $archiveOnUpdate; } diff --git a/templates/Behavior/Archivable/queryUpdateWithoutArchive.php b/templates/Behavior/Archivable/queryUpdateWithoutArchive.php index c5f58213f2..529c3f2599 100644 --- a/templates/Behavior/Archivable/queryUpdateWithoutArchive.php +++ b/templates/Behavior/Archivable/queryUpdateWithoutArchive.php @@ -2,13 +2,13 @@ /** * Delete records matching the current query without archiving them. * - * @param array $values Associative array of keys and values to replace - * @param ConnectionInterface $con an optional connection object - * @param bool $forceIndividualSaves If false (default), the resulting call is a Criteria::doUpdate(), ortherwise it is a series of save() calls on all the found objects + * @param array $values Associative array of keys and values to replace + * @param ConnectionInterface|null $con an optional connection object + * @param bool $forceIndividualSaves If false (default), the resulting call is a Criteria::doUpdate(), ortherwise it is a series of save() calls on all the found objects * * @return int The number of deleted rows */ -public function updateWithoutArchive($values, $con = null, $forceIndividualSaves = false): int +public function updateWithoutArchive(array $values, $con = null, bool $forceIndividualSaves = false): int { $this->archiveOnUpdate = false; diff --git a/templates/Behavior/Delegate/queryMethodsTemplate.php b/templates/Behavior/Delegate/queryMethodsTemplate.php index 71c4c9f865..64169cf552 100644 --- a/templates/Behavior/Delegate/queryMethodsTemplate.php +++ b/templates/Behavior/Delegate/queryMethodsTemplate.php @@ -8,11 +8,11 @@ * $query->filterBy(array('min' => 12)); // WHERE >= 12 * * -* @param mixed $value The value to use as filter. +* @param mixed $value The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. -* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL +* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return $this| The current query, for fluid interface */ @@ -31,11 +31,11 @@ public function filterBy($value = null, $comparison = null) * $c->orderBy('Book.CategoryId', 'desc') * => $c->addDescendingOrderByColumn(BookTableMap::CATEGORY_ID) * -* @param string $order The sorting order. Criteria::ASC by default, also accepts Criteria::DESC +* @param string $order The sorting order. Criteria::ASC by default, also accepts Criteria::DESC * * @return $this|ModelCriteria The current object, for fluid interface */ -public function orderBy($order = Criteria::ASC) +public function orderBy(string $order = Criteria::ASC) { return $this->useQuery()->orderBy($order)->endUse(); } diff --git a/templates/Behavior/I18n/objectGetCurrentTranslation.php b/templates/Behavior/I18n/objectGetCurrentTranslation.php index 63723fadd9..7599465ba1 100644 --- a/templates/Behavior/I18n/objectGetCurrentTranslation.php +++ b/templates/Behavior/I18n/objectGetCurrentTranslation.php @@ -2,11 +2,11 @@ /** * Returns the current translation * - * @param ConnectionInterface $con an optional connection object + * @param ConnectionInterface|null $con an optional connection object * * @return */ -public function getCurrentTranslation(ConnectionInterface $con = null) +public function getCurrentTranslation(?ConnectionInterface $con = null) { return $this->getTranslation($this->get(), $con); } diff --git a/templates/Behavior/I18n/objectGetLocale.php b/templates/Behavior/I18n/objectGetLocale.php index 4b45923eac..31d71b0350 100644 --- a/templates/Behavior/I18n/objectGetLocale.php +++ b/templates/Behavior/I18n/objectGetLocale.php @@ -2,7 +2,7 @@ /** * Gets the locale for translations * - * @return string $locale Locale to use for the translation, e.g. 'fr_FR' + * @return string $locale Locale to use for the translation, e.g. 'fr_FR' */ public function get() { diff --git a/templates/Behavior/I18n/objectGetLocaleAlias.php b/templates/Behavior/I18n/objectGetLocaleAlias.php index e733e43976..bcb69a4407 100644 --- a/templates/Behavior/I18n/objectGetLocaleAlias.php +++ b/templates/Behavior/I18n/objectGetLocaleAlias.php @@ -3,7 +3,7 @@ * Gets the locale for translations. * Alias for getLocale(), for BC purpose. * - * @return string $locale Locale to use for the translation, e.g. 'fr_FR' + * @return string $locale Locale to use for the translation, e.g. 'fr_FR' */ public function get() { diff --git a/templates/Behavior/I18n/objectGetTranslation.php b/templates/Behavior/I18n/objectGetTranslation.php index b3eae11f23..1dc967e51b 100644 --- a/templates/Behavior/I18n/objectGetTranslation.php +++ b/templates/Behavior/I18n/objectGetTranslation.php @@ -2,12 +2,12 @@ /** * Returns the current translation for a given locale * - * @param string $locale Locale to use for the translation, e.g. 'fr_FR' - * @param ConnectionInterface $con an optional connection object + * @param string $locale Locale to use for the translation, e.g. 'fr_FR' + * @param ConnectionInterface|null $con an optional connection object * * @return */ -public function getTranslation($locale = '', ConnectionInterface $con = null) +public function getTranslation(string $locale = '', ?ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->) { diff --git a/templates/Behavior/I18n/objectRemoveTranslation.php b/templates/Behavior/I18n/objectRemoveTranslation.php index 8339b02587..68756fae38 100644 --- a/templates/Behavior/I18n/objectRemoveTranslation.php +++ b/templates/Behavior/I18n/objectRemoveTranslation.php @@ -2,12 +2,12 @@ /** * Remove the translation for a given locale * - * @param string $locale Locale to use for the translation, e.g. 'fr_FR' - * @param ConnectionInterface $con an optional connection object + * @param string $locale Locale to use for the translation, e.g. 'fr_FR' + * @param ConnectionInterface|null $con an optional connection object * - * @return $this The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ -public function removeTranslation($locale = '', ConnectionInterface $con = null) +public function removeTranslation(string $locale = '', ?ConnectionInterface $con = null) { if (!$this->isNew()) { ::create() diff --git a/templates/Behavior/I18n/objectSetLocale.php b/templates/Behavior/I18n/objectSetLocale.php index 91d933fc4c..827897f1b6 100644 --- a/templates/Behavior/I18n/objectSetLocale.php +++ b/templates/Behavior/I18n/objectSetLocale.php @@ -2,9 +2,9 @@ /** * Sets the locale for translations * - * @param string $locale Locale to use for the translation, e.g. 'fr_FR' + * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * - * @return $this The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function set($locale = '') { diff --git a/templates/Behavior/I18n/objectSetLocaleAlias.php b/templates/Behavior/I18n/objectSetLocaleAlias.php index cb981e6966..92b1bd4cee 100644 --- a/templates/Behavior/I18n/objectSetLocaleAlias.php +++ b/templates/Behavior/I18n/objectSetLocaleAlias.php @@ -3,9 +3,9 @@ * Sets the locale for translations. * Alias for setLocale(), for BC purpose. * - * @param string $locale Locale to use for the translation, e.g. 'fr_FR' + * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * - * @return $this| The current object (for fluent API support) + * @return $this| The current object (for fluent API support) */ public function set($locale = '') { diff --git a/templates/Behavior/I18n/objectSetTranslation.php b/templates/Behavior/I18n/objectSetTranslation.php index b3ca12fcfb..64e6a2a22f 100644 --- a/templates/Behavior/I18n/objectSetTranslation.php +++ b/templates/Behavior/I18n/objectSetTranslation.php @@ -2,10 +2,10 @@ /** * Sets the translation for a given locale * - * @param $translation The translation object - * @param string $locale Locale to use for the translation, e.g. 'fr_FR' + * @param $translation The translation object + * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * - * @return $this The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setTranslation($translation, $locale = '') { diff --git a/templates/Behavior/I18n/queryJoinI18n.php b/templates/Behavior/I18n/queryJoinI18n.php index 9008c024fa..054cda2305 100644 --- a/templates/Behavior/I18n/queryJoinI18n.php +++ b/templates/Behavior/I18n/queryJoinI18n.php @@ -2,11 +2,11 @@ /** * Adds a JOIN clause to the query using the i18n relation * - * @param string $locale Locale to use for the join condition, e.g. 'fr_FR' - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join. + * @param string $locale Locale to use for the join condition, e.g. 'fr_FR' + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join. * - * @return The current query, for fluid interface + * @return The current query, for fluid interface */ public function joinI18n($locale = '', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { diff --git a/templates/Behavior/I18n/queryJoinWithI18n.php b/templates/Behavior/I18n/queryJoinWithI18n.php index ade74adead..092ce5cd0e 100644 --- a/templates/Behavior/I18n/queryJoinWithI18n.php +++ b/templates/Behavior/I18n/queryJoinWithI18n.php @@ -3,10 +3,10 @@ * Adds a JOIN clause to the query and hydrates the related I18n object. * Shortcut for $c->joinI18n($locale)->with() * - * @param string $locale Locale to use for the join condition, e.g. 'fr_FR' - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join. + * @param string $locale Locale to use for the join condition, e.g. 'fr_FR' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join. * - * @return $this The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function joinWithI18n($locale = '', $joinType = Criteria::LEFT_JOIN) { diff --git a/templates/Behavior/I18n/queryUseI18nQuery.php b/templates/Behavior/I18n/queryUseI18nQuery.php index 80ce2bcad3..31b26180f9 100644 --- a/templates/Behavior/I18n/queryUseI18nQuery.php +++ b/templates/Behavior/I18n/queryUseI18nQuery.php @@ -4,11 +4,11 @@ * * @see useQuery() * - * @param string $locale Locale to use for the join condition, e.g. 'fr_FR' - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join. + * @param string $locale Locale to use for the join condition, e.g. 'fr_FR' + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join. * - * @return A secondary query class using the current class as primary query + * @return A secondary query class using the current class as primary query */ public function useI18nQuery($locale = '', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { diff --git a/templates/Behavior/NestedSet/objectInsertAsLastChildOf.php b/templates/Behavior/NestedSet/objectInsertAsLastChildOf.php index c9da83bf6a..5abaad2f71 100644 --- a/templates/Behavior/NestedSet/objectInsertAsLastChildOf.php +++ b/templates/Behavior/NestedSet/objectInsertAsLastChildOf.php @@ -4,7 +4,7 @@ * The modifications in the current object and the tree * are not persisted until the current object is saved. * - * @param $parent Propel object for parent node + * @param $parent Propel object for parent node * @return $this| The current Propel object */ public function insertAsLastChildOf( $parent) diff --git a/templates/Behavior/NestedSet/objectSetLeft.php b/templates/Behavior/NestedSet/objectSetLeft.php index 8679521d70..81233e9865 100644 --- a/templates/Behavior/NestedSet/objectSetLeft.php +++ b/templates/Behavior/NestedSet/objectSetLeft.php @@ -3,7 +3,7 @@ * Proxy setter method for the left value of the nested set model. * It provides a generic way to set the value, whatever the actual column name is. * - * @param int $v The nested set left value + * @param int $v The nested set left value * @return $this| The current object (for fluent API support) */ public function setLeftValue($v) diff --git a/templates/Behavior/Validate/objectGetValidationFailures.php b/templates/Behavior/Validate/objectGetValidationFailures.php index 4a15761cd1..6a46ca58f0 100644 --- a/templates/Behavior/Validate/objectGetValidationFailures.php +++ b/templates/Behavior/Validate/objectGetValidationFailures.php @@ -3,7 +3,7 @@ * Gets any ConstraintViolation objects that resulted from last call to validate(). * * - * @return ConstraintViolationList + * @return ConstraintViolationList * @see validate() */ public function getValidationFailures() diff --git a/templates/Behavior/Validate/objectValidate.php b/templates/Behavior/Validate/objectValidate.php index 66010a49f0..878e3fe7b6 100644 --- a/templates/Behavior/Validate/objectValidate.php +++ b/templates/Behavior/Validate/objectValidate.php @@ -3,8 +3,8 @@ * Validates the object and all objects related to this table. * * @see getValidationFailures() - * @param ValidatorInterface|null $validator A Validator class instance - * @return bool Whether all objects pass validation. + * @param ValidatorInterface|null $validator A Validator class instance + * @return bool Whether all objects pass validation. */ public function validate(ValidatorInterface $validator = null) { diff --git a/templates/Builder/Om/baseObjectMethodHook.php b/templates/Builder/Om/baseObjectMethodHook.php index 909688fbed..ad945a8e42 100644 --- a/templates/Builder/Om/baseObjectMethodHook.php +++ b/templates/Builder/Om/baseObjectMethodHook.php @@ -2,10 +2,10 @@ /** * Code to be run before persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null) { if (is_callable('parent::preSave')) { @@ -19,10 +19,10 @@ public function preSave(ConnectionInterface $con = null) /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con * @return void */ - public function postSave(ConnectionInterface $con = null): void + public function postSave(?ConnectionInterface $con = null): void { if (is_callable('parent::postSave')) { @@ -35,10 +35,10 @@ public function postSave(ConnectionInterface $con = null): void /** * Code to be run before inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null) { if (is_callable('parent::preInsert')) { @@ -52,10 +52,10 @@ public function preInsert(ConnectionInterface $con = null) /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con * @return void */ - public function postInsert(ConnectionInterface $con = null): void + public function postInsert(?ConnectionInterface $con = null): void { if (is_callable('parent::postInsert')) { @@ -68,10 +68,10 @@ public function postInsert(ConnectionInterface $con = null): void /** * Code to be run before updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null) { if (is_callable('parent::preUpdate')) { @@ -85,10 +85,10 @@ public function preUpdate(ConnectionInterface $con = null) /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con * @return void */ - public function postUpdate(ConnectionInterface $con = null): void + public function postUpdate(?ConnectionInterface $con = null): void { if (is_callable('parent::postUpdate')) { @@ -101,10 +101,10 @@ public function postUpdate(ConnectionInterface $con = null): void /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null) { if (is_callable('parent::preDelete')) { @@ -118,10 +118,10 @@ public function preDelete(ConnectionInterface $con = null) /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con * @return void */ - public function postDelete(ConnectionInterface $con = null): void + public function postDelete(?ConnectionInterface $con = null): void { if (is_callable('parent::postDelete')) { diff --git a/templates/Builder/Om/baseObjectMethodMagicCall.php b/templates/Builder/Om/baseObjectMethodMagicCall.php index 3b9c638dd4..fc0d0e72de 100644 --- a/templates/Builder/Om/baseObjectMethodMagicCall.php +++ b/templates/Builder/Om/baseObjectMethodMagicCall.php @@ -7,7 +7,7 @@ * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -26,7 +26,7 @@ public function __call($name, $params) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ diff --git a/templates/Builder/Om/baseObjectMethods.php b/templates/Builder/Om/baseObjectMethods.php index 11dcdceba2..2c496c9c8e 100644 --- a/templates/Builder/Om/baseObjectMethods.php +++ b/templates/Builder/Om/baseObjectMethods.php @@ -4,7 +4,7 @@ * * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -15,7 +15,7 @@ public function isModified() * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -24,7 +24,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -36,7 +36,7 @@ public function getModifiedColumns() * * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -47,36 +47,36 @@ public function isNew() * * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b) { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param bool $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted($b): void { $this->deleted = (boolean) $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { unset($this->modifiedColumns[$col]); @@ -93,7 +93,7 @@ public function resetModified($col = null) * @param mixed $obj The object to compare to. * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -115,7 +115,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -123,10 +123,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -134,15 +134,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -151,12 +151,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -166,11 +166,11 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { Propel::log(get_class($this) . ': ' . $msg, $priority); } @@ -183,12 +183,12 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); diff --git a/templates/Builder/Om/tableMapConstants.php b/templates/Builder/Om/tableMapConstants.php index 7383a26fdf..1f2f861b42 100644 --- a/templates/Builder/Om/tableMapConstants.php +++ b/templates/Builder/Om/tableMapConstants.php @@ -1,51 +1,51 @@ /** * The (dot-path) name of this class */ - const CLASS_NAME = ''; + public const CLASS_NAME = ''; /** * The default database name for this class */ - const DATABASE_NAME = ''; + public const DATABASE_NAME = ''; /** * The table name for this class */ - const TABLE_NAME = ''; + public const TABLE_NAME = ''; /** * The related Propel class for this table */ - const OM_CLASS = ''; + public const OM_CLASS = ''; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = ''; + public const CLASS_DEFAULT = ''; /** * The total number of columns */ - const NUM_COLUMNS = ; + public const NUM_COLUMNS = ; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = ; + public const NUM_LAZY_LOAD_COLUMNS = ; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = ; + public const NUM_HYDRATE_COLUMNS = ; /** * the column name for the getName() ?> field */ - const getConstantName() ?> = '.getName() ?>'; + public const getConstantName() ?> = '.getName() ?>'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = ''; + public const DEFAULT_STRING_FORMAT = ''; diff --git a/templates/Builder/Om/tableMapFields.php b/templates/Builder/Om/tableMapFields.php index 0ed69a43b9..26c542136d 100644 --- a/templates/Builder/Om/tableMapFields.php +++ b/templates/Builder/Om/tableMapFields.php @@ -5,13 +5,13 @@ * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ - protected static $fieldNames = array ( - self::TYPE_PHPNAME => array(), - self::TYPE_CAMELNAME => array(), - self::TYPE_COLNAME => array(), - self::TYPE_FIELDNAME => array(), - self::TYPE_NUM => array() - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => [], + self::TYPE_CAMELNAME => [], + self::TYPE_COLNAME => [], + self::TYPE_FIELDNAME => [], + self::TYPE_NUM => [] + ]; /** * holds an array of keys for quick access to the fieldnames array @@ -19,10 +19,10 @@ * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ - protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array(), - self::TYPE_CAMELNAME => array(), - self::TYPE_COLNAME => array(), - self::TYPE_FIELDNAME => array(), - self::TYPE_NUM => array() - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => [], + self::TYPE_CAMELNAME => [], + self::TYPE_COLNAME => [], + self::TYPE_FIELDNAME => [], + self::TYPE_NUM => [] + ]; diff --git a/templates/Builder/Om/tableMapInstancePool.php b/templates/Builder/Om/tableMapInstancePool.php index f66effe6de..a7296c3a09 100644 --- a/templates/Builder/Om/tableMapInstancePool.php +++ b/templates/Builder/Om/tableMapInstancePool.php @@ -8,7 +8,7 @@ * and findPk*() calls. * * @param $obj A object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + * @param string|null $key Key (optional) to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool($obj, $key = null) { diff --git a/tests/Propel/Tests/Common/Config/Loader/YamlFileLoaderTest.php b/tests/Propel/Tests/Common/Config/Loader/YamlFileLoaderTest.php index 70855600e3..87519faab2 100644 --- a/tests/Propel/Tests/Common/Config/Loader/YamlFileLoaderTest.php +++ b/tests/Propel/Tests/Common/Config/Loader/YamlFileLoaderTest.php @@ -20,7 +20,7 @@ class YamlFileLoaderTest extends TestCase { use VfsTrait; - /** @var YamlFileLoader */ + /** @var YamlFileLoader */ protected $loader; /** diff --git a/tests/Propel/Tests/Generator/Behavior/Sluggable/SluggableBehaviorTestClasses.php b/tests/Propel/Tests/Generator/Behavior/Sluggable/SluggableBehaviorTestClasses.php index 8aacf87bc1..e33c4e7fad 100644 --- a/tests/Propel/Tests/Generator/Behavior/Sluggable/SluggableBehaviorTestClasses.php +++ b/tests/Propel/Tests/Generator/Behavior/Sluggable/SluggableBehaviorTestClasses.php @@ -13,40 +13,40 @@ class TestableTable13 extends Table13 { - public function createSlug() + public function createSlug(): string { return parent::createSlug(); } - public function createRawSlug() + public function createRawSlug(): string { return parent::createRawSlug(); } - public static function cleanupSlugPart($slug, $separator = '-') + public static function cleanupSlugPart(string $slug, string $separator = '-'): string { return parent::cleanupSlugPart($slug, $separator); } - public function makeSlugUnique($slug, $separator = '-', $increment = 0) + public function makeSlugUnique(string $slug, string $separator = '-', bool $alreadyExists = false): ?string { - return parent::makeSlugUnique($slug, $separator, $increment); + return parent::makeSlugUnique($slug, $separator, $alreadyExists); } } class TestableTable14 extends Table14 { - public function createSlug() + public function createSlug(): string { return parent::createSlug(); } - public function createRawSlug() + public function createRawSlug(): string { return parent::createRawSlug(); } - public static function limitSlugSize($slug, $incrementReservedSpace = 3) + public static function limitSlugSize(string $slug, int $incrementReservedSpace = 3): string { return parent::limitSlugSize($slug, $incrementReservedSpace); }