diff --git a/generator/lib/builder/om/PHP5PeerBuilder.php b/generator/lib/builder/om/PHP5PeerBuilder.php index bd0fe2b16..30f9abe57 100644 --- a/generator/lib/builder/om/PHP5PeerBuilder.php +++ b/generator/lib/builder/om/PHP5PeerBuilder.php @@ -1164,7 +1164,7 @@ public static function getPrimaryKeyFromRow(\$row, \$startcol = 0) if ($table->hasCompositePrimaryKey()) { $script .= " - return array(" . implode($pks, ', '). ");"; + return array(" . implode(', ', $pks). ");"; } else { $script .= " diff --git a/generator/lib/builder/om/QueryBuilder.php b/generator/lib/builder/om/QueryBuilder.php index 30c0c44cc..46cae0f98 100644 --- a/generator/lib/builder/om/QueryBuilder.php +++ b/generator/lib/builder/om/QueryBuilder.php @@ -395,10 +395,10 @@ protected function addFindPk(&$script) } $pkType = 'array'; $pkDescription = " - A Primary key composition: ".'['. join($colNames, ', ') . ']'; + A Primary key composition: ".'['. join(', ', $colNames) . ']'; $script .= " * - * \$obj = \$c->findPk(array(" . join($examplePk, ', ') . "), \$con);"; + * \$obj = \$c->findPk(array(" . join(', ', $examplePk) . "), \$con);"; } else { $pkType = 'mixed'; $script .= " diff --git a/generator/lib/model/Database.php b/generator/lib/model/Database.php index cd48d033a..8d2a4089f 100644 --- a/generator/lib/model/Database.php +++ b/generator/lib/model/Database.php @@ -390,7 +390,7 @@ public function addTable($data) $this->tablesByName[$tbl->getName()] = $tbl; $this->tablesByLowercaseName[strtolower($tbl->getName())] = $tbl; $this->tablesByPhpName[$tbl->getPhpName()] = $tbl; - if (strpos($tbl->getNamespace(), '\\') === 0) { + if (strpos((string) $tbl->getNamespace(), '\\') === 0) { $tbl->setNamespace(substr($tbl->getNamespace(), 1)); } elseif ($namespace = $this->getNamespace()) { if ($tbl->getNamespace() === null) { diff --git a/generator/lib/model/XMLElement.php b/generator/lib/model/XMLElement.php index 1a0959fd9..31f46a580 100644 --- a/generator/lib/model/XMLElement.php +++ b/generator/lib/model/XMLElement.php @@ -85,7 +85,7 @@ protected function booleanValue($val) if (is_numeric($val)) { return (bool) $val; } else { - return (in_array(strtolower($val), array('true', 't', 'y', 'yes'), true) ? true : false); + return (in_array(strtolower((string) $val), array('true', 't', 'y', 'yes'), true) ? true : false); } } diff --git a/runtime/lib/collection/PropelCollection.php b/runtime/lib/collection/PropelCollection.php index 79d7cc0f8..26637b5f0 100644 --- a/runtime/lib/collection/PropelCollection.php +++ b/runtime/lib/collection/PropelCollection.php @@ -359,7 +359,7 @@ public function diff(PropelCollection $collection) /** * @return string */ - public function serialize() + public function serialize(): string { $repr = array( 'data' => $this->getArrayCopy(), @@ -371,10 +371,8 @@ public function serialize() /** * @param string $data - * - * @return void */ - public function unserialize($data) + public function unserialize($data): void { $repr = unserialize($data); $this->exchangeArray($repr['data']); @@ -389,7 +387,7 @@ public function unserialize($data) * * @return ArrayIterator */ - public function getIterator() + public function getIterator(): Iterator { $this->iterator = new ArrayIterator($this); diff --git a/runtime/lib/collection/PropelObjectCollection.php b/runtime/lib/collection/PropelObjectCollection.php index 22e6784cb..c67587421 100644 --- a/runtime/lib/collection/PropelObjectCollection.php +++ b/runtime/lib/collection/PropelObjectCollection.php @@ -134,10 +134,8 @@ public function fromArray($arr) * 'Book_1' => $book1, * ) * - * - * @return array */ - public function getArrayCopy($keyColumn = null, $usePrefix = false) + public function getArrayCopy($keyColumn = null, $usePrefix = false): array { if (null === $keyColumn && false === $usePrefix) { return parent::getArrayCopy(); diff --git a/runtime/lib/config/PropelConfiguration.php b/runtime/lib/config/PropelConfiguration.php index cc5238be8..777ecdae4 100644 --- a/runtime/lib/config/PropelConfiguration.php +++ b/runtime/lib/config/PropelConfiguration.php @@ -44,9 +44,8 @@ public function __construct(array $parameters = array()) * @see http://www.php.net/ArrayAccess * * @param integer $offset - * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return array_key_exists($offset, $this->parameters); } @@ -57,7 +56,7 @@ public function offsetExists($offset) * @param integer $offset * @param mixed $value */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->parameters[$offset] = $value; $this->isFlattened = false; @@ -69,7 +68,7 @@ public function offsetSet($offset, $value) * @param integer $offset * @return array */ - public function offsetGet($offset) + public function offsetGet($offset): array { return $this->parameters[$offset]; } diff --git a/runtime/lib/connection/DebugPDOStatement.php b/runtime/lib/connection/DebugPDOStatement.php index 3f0ca3715..e70520b3c 100644 --- a/runtime/lib/connection/DebugPDOStatement.php +++ b/runtime/lib/connection/DebugPDOStatement.php @@ -82,9 +82,8 @@ public function getExecutedQueryString() * Overridden for query counting and logging. * * @param string $input_parameters - * @return boolean */ - public function execute($input_parameters = null) + public function execute($input_parameters = null): bool { $debug = $this->pdo->getDebugSnapshot(); $return = parent::execute($input_parameters); @@ -104,10 +103,8 @@ public function execute($input_parameters = null) * @param integer $pos Parameter identifier (for determining what to replace in the query). * @param mixed $value The value to bind to the parameter. * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants. Defaults to PDO::PARAM_STR. - * - * @return boolean */ - public function bindValue($pos, $value, $type = PDO::PARAM_STR) + public function bindValue($pos, $value, $type = PDO::PARAM_STR): bool { $debug = $this->pdo->getDebugSnapshot(); $typestr = isset(self::$typeMap[$type]) ? self::$typeMap[$type] : '(default)'; @@ -133,10 +130,8 @@ public function bindValue($pos, $value, $type = PDO::PARAM_STR) * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants. Defaults to PDO::PARAM_STR. * @param integer $length Length of the data type. To indicate that a parameter is an OUT parameter from a stored procedure, you must explicitly set the length. * @param mixed $driver_options - * - * @return boolean */ - public function bindParam($pos, &$value, $type = PDO::PARAM_STR, $length = 0, $driver_options = null) + public function bindParam($pos, &$value, $type = PDO::PARAM_STR, $length = 0, $driver_options = null): bool { $debug = $this->pdo->getDebugSnapshot(); $typestr = isset(self::$typeMap[$type]) ? self::$typeMap[$type] : '(default)'; diff --git a/runtime/lib/connection/PropelPDO.php b/runtime/lib/connection/PropelPDO.php index ba184d669..15c78774d 100644 --- a/runtime/lib/connection/PropelPDO.php +++ b/runtime/lib/connection/PropelPDO.php @@ -224,10 +224,8 @@ public function isCommitable() /** * Overrides PDO::beginTransaction() to prevent errors due to already-in-progress transaction. - * - * @return boolean */ - public function beginTransaction() + public function beginTransaction(): bool { $return = true; if (!$this->nestedTransactionCount) { @@ -246,11 +244,9 @@ public function beginTransaction() * Overrides PDO::commit() to only commit the transaction if we are in the outermost * transaction nesting level. * - * @return boolean - * * @throws PropelException */ - public function commit() + public function commit(): bool { $return = true; $opcount = $this->nestedTransactionCount; @@ -279,7 +275,7 @@ public function commit() * * @return boolean Whether operation was successful. */ - public function rollBack() + public function rollBack(): bool { $return = true; $opcount = $this->nestedTransactionCount; @@ -301,11 +297,11 @@ public function rollBack() } /** - * Rollback the whole transaction, even if this is a nested rollback - * and reset the nested transaction count to 0. + * Rollback the whole transaction, even if this is a nested rollback + * and reset the nested transaction count to 0. * - * @return boolean Whether operation was successful. - */ + * @return boolean Whether operation was successful. + */ public function forceRollBack() { $return = true; @@ -334,10 +330,8 @@ public function forceRollBack() * * @param integer $attribute The attribute to set (e.g. PropelPDO::PROPEL_ATTR_CACHE_PREPARES). * @param mixed $value The attribute value. - * - * @return void */ - public function setAttribute($attribute, $value) + public function setAttribute($attribute, $value): bool { switch ($attribute) { case self::PROPEL_ATTR_CACHE_PREPARES: @@ -347,8 +341,9 @@ public function setAttribute($attribute, $value) $this->connectionName = $value; break; default: - parent::setAttribute($attribute, $value); + return parent::setAttribute($attribute, $value); } + return true; } /** @@ -415,9 +410,8 @@ public function prepare($sql, $driver_options = array()) * Overrides PDO::exec() to log queries when required * * @param string $sql - * @return integer */ - public function exec($sql) + public function exec($sql): int { if ($this->useDebug) { $debug = $this->getDebugSnapshot(); @@ -657,7 +651,7 @@ public function getDebugSnapshot() 'microtime' => microtime(true), 'memory_get_usage' => memory_get_usage($this->getLoggingConfig('realmemoryusage', false)), 'memory_get_peak_usage' => memory_get_peak_usage($this->getLoggingConfig('realmemoryusage', false)), - ); + ); } else { throw new PropelException('Should not get debug snapshot when not debugging'); } diff --git a/runtime/lib/query/Criteria.php b/runtime/lib/query/Criteria.php index 82e7fd028..f14ff2ea6 100644 --- a/runtime/lib/query/Criteria.php +++ b/runtime/lib/query/Criteria.php @@ -261,7 +261,7 @@ public function __construct($dbName = null) * Implementing SPL IteratorAggregate interface. This allows * you to foreach () over a Criteria object. */ - public function getIterator() + public function getIterator(): Traversable { return new CriterionIterator($this); } diff --git a/runtime/lib/query/ModelCriteria.php b/runtime/lib/query/ModelCriteria.php index ac498c8ab..8cecbba5a 100644 --- a/runtime/lib/query/ModelCriteria.php +++ b/runtime/lib/query/ModelCriteria.php @@ -56,7 +56,7 @@ class ModelCriteria extends Criteria * Creates a new instance with the default capacity which corresponds to * the specified database. * - * @param string $dbName The dabase name + * @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' */