Permalink
Browse files

add @throws and @return where missing

* replace some @deprecated method calls
* add return statements where missing
* fix @param type hints
  • Loading branch information...
1 parent 94aae82 commit 841d477db7e30c0066860ccda580217cd7f9204b @havvg havvg committed Jun 13, 2012
Showing with 224 additions and 22 deletions.
  1. +4 −0 generator/lib/builder/om/OMBuilder.php
  2. +1 −0 generator/lib/builder/om/PHP5ObjectBuilder.php
  3. +1 −0 generator/lib/builder/om/PHP5ObjectNoCollectionBuilder.php
  4. +3 −1 generator/lib/builder/om/PHP5PeerBuilder.php
  5. +3 −0 generator/lib/builder/util/PropelTemplate.php
  6. +3 −0 generator/lib/builder/util/XmlToAppData.php
  7. +1 −0 generator/lib/builder/util/XmlToDataSQL.php
  8. +2 −0 generator/lib/config/GeneratorConfig.php
  9. +5 −1 generator/lib/model/AppData.php
  10. +2 −0 generator/lib/model/Behavior.php
  11. +9 −2 generator/lib/model/Column.php
  12. +3 −1 generator/lib/model/Database.php
  13. +1 −0 generator/lib/model/Domain.php
  14. +4 −2 generator/lib/model/Table.php
  15. +2 −0 generator/lib/model/VendorInfo.php
  16. +1 −0 generator/lib/model/XMLElement.php
  17. +1 −0 generator/lib/platform/DefaultPlatform.php
  18. +2 −0 generator/lib/reverse/BaseSchemaParser.php
  19. +1 −0 generator/lib/reverse/oracle/OracleSchemaParser.php
  20. +1 −0 generator/lib/reverse/pgsql/PgsqlSchemaParser.php
  21. +4 −2 generator/lib/task/AbstractPropelDataModelTask.php
  22. +1 −1 generator/lib/task/BasePropelMigrationTask.php
  23. +1 −0 generator/lib/task/PropelDataSQLTask.php
  24. +1 −0 generator/lib/task/PropelOMTask.php
  25. +2 −0 generator/lib/task/PropelSQLExec.php
  26. +5 −0 generator/lib/task/PropelSchemaReverseTask.php
  27. +5 −0 generator/lib/util/PropelSqlManager.php
  28. +1 −0 generator/pear/BuildPropelGenPEARPackageTask.php
  29. +2 −0 runtime/lib/Propel.php
  30. +3 −0 runtime/lib/adapter/DBMSSQL.php
  31. +2 −0 runtime/lib/adapter/DBMySQL.php
  32. +2 −0 runtime/lib/adapter/DBOracle.php
  33. +4 −0 runtime/lib/adapter/DBPostgres.php
  34. +2 −0 runtime/lib/adapter/MSSQL/MssqlPropelPDO.php
  35. +4 −0 runtime/lib/collection/PropelArrayCollection.php
  36. +10 −0 runtime/lib/collection/PropelCollection.php
  37. +6 −0 runtime/lib/collection/PropelObjectCollection.php
  38. +4 −0 runtime/lib/collection/PropelOnDemandCollection.php
  39. +6 −0 runtime/lib/connection/PropelPDO.php
  40. +3 −0 runtime/lib/map/ColumnMap.php
  41. +4 −0 runtime/lib/map/RelationMap.php
  42. +4 −2 runtime/lib/map/TableMap.php
  43. +4 −0 runtime/lib/om/BaseObject.php
  44. +2 −0 runtime/lib/parser/PropelCSVParser.php
  45. +6 −0 runtime/lib/parser/PropelParser.php
  46. +23 −5 runtime/lib/query/Criteria.php
  47. +4 −0 runtime/lib/query/Criterion.php
  48. +2 −0 runtime/lib/query/Join.php
  49. +38 −2 runtime/lib/query/ModelCriteria.php
  50. +4 −0 runtime/lib/query/ModelCriterion.php
  51. +6 −2 runtime/lib/util/BasePeer.php
  52. +1 −1 runtime/lib/util/NodePeer.php
  53. +2 −0 runtime/lib/util/PropelAutoloader.php
  54. +2 −0 runtime/lib/util/PropelDateTime.php
  55. +2 −0 runtime/lib/validator/TypeValidator.php
  56. +2 −0 runtime/pear/BuildPropelPEARPackageTask.php
@@ -295,6 +295,8 @@ public function getObjectClassname()
* @param string $classname The Peer classname to use.
*
* @return string If $classname is provided, then will return $classname::COLUMN_NAME; if not, then the peername is looked up for current table to yield $currTablePeer::COLUMN_NAME.
+ *
+ * @throws Exception
*/
public function getColumnConstant($col, $classname = null)
{
@@ -397,6 +399,8 @@ public function getFKPhpNameAffix(ForeignKey $fk, $plural = false)
* will be appended.
*
* @return string
+ *
+ * @throws Exception
*/
protected static function getRelatedBySuffix(ForeignKey $fk)
{
@@ -130,6 +130,7 @@ protected function getTemporalFormatter(Column $col)
* Returns the type-casted and stringified default value for the specified Column.
* This only works for scalar default values currently.
* @return string The default value or 'NULL' if there is none.
+ * @throws EngineException
*/
protected function getDefaultValueString(Column $col)
{
@@ -555,6 +555,7 @@ public function get".$this->getFKPhpNameAffix($fk, $plural = false)."(PropelPDO
/**
* Adds the method that fetches fkey-related (referencing) objects but also joins in data from another table.
* @param string &$script The script will be modified in this method.
+ * @throws EngineException
*/
protected function addRefFKGetJoinMethods(&$script, ForeignKey $refFK)
{
@@ -789,6 +789,8 @@ public static function doSelectStmt(Criteria \$criteria, PropelPDO \$con = null)
* Adds the PHP code to return a instance pool key for the passed-in primary key variable names.
*
* @param array $pkphp An array of PHP var names / method calls representing complete pk.
+ *
+ * @return string
*/
public function getInstancePoolKeySnippet($pkphp)
{
@@ -1841,7 +1843,7 @@ public static function doValidate(\$obj, \$cols = null)
}
foreach (\$cols as \$colName) {
- if (\$tableMap->containsColumn(\$colName)) {
+ if (\$tableMap->hasColumn(\$colName)) {
\$get = 'get' . \$tableMap->getColumn(\$colName)->getPhpName();
\$columns[\$colName] = \$obj->\$get();
}
@@ -61,6 +61,9 @@ public function setTemplateFile($filePath)
* @param array $vars An associative array of argumens to be rendered
*
* @return string The rendered template
+ *
+ * @throws InvalidArgumentException
+ * @throws Exception
*/
public function render($vars = array())
{
@@ -101,6 +101,7 @@ public function parseFile($xmlFile)
* @param string $xmlString The input string to parse.
* @param string $xmlFile The input file name.
* @return AppData populated by <code>xmlFile</code>.
+ * @throws Exception
*/
public function parseString($xmlString, $xmlFile = null)
{
@@ -138,6 +139,8 @@ public function parseString($xmlString, $xmlFile = null)
* @param string $rawName The qualified name (with prefix), or the empty string if
* qualified names are not available.
* @param string $attributes The specified or defaulted attributes
+ *
+ * @throws SchemaException
*/
public function startElement($parser, $name, $attributes)
{
@@ -108,6 +108,7 @@ public function __construct(Database $database, GeneratorConfig $config, $encodi
*
* @param PhingFile $xmlFile
* @param Writer $out
+ * @throws BuildException
*/
public function transform(PhingFile $xmlFile, Writer $out)
{
@@ -151,6 +151,7 @@ public function getBuilderClassname($type)
*
* @param PDO $con
* @return Platform
+ * @throws BuildException
*/
public function getConfiguredPlatform(PDO $con = null, $database = null)
{
@@ -179,6 +180,7 @@ public function getConfiguredPlatform(PDO $con = null, $database = null)
* Creates and configures a new SchemaParser class for specified platform.
* @param PDO $con
* @return SchemaParser
+ * @throws BuildException
*/
public function getConfiguredSchemaParser(PDO $con = null)
{
@@ -211,7 +211,9 @@ public function hasDatabase($name)
* Add a database to the list and sets the AppData property to this
* AppData
*
- * @param db the database to add
+ * @param Datebase|string $db the database to add
+ *
+ * @return Database
*/
public function addDatabase($db)
{
@@ -253,6 +255,8 @@ public function doFinalInitialization()
* Merge other appData objects into this object
*
* @param array[AppData] $ads
+ *
+ * @throws Exception
*/
public function joinAppDatas($ads)
{
@@ -197,6 +197,8 @@ public function isTableModified()
* @param string $templateDir The name of the template subdirectory
*
* @return string The rendered template
+ *
+ * @throws InvalidArgumentException
*/
public function renderTemplate($filename, $vars = array(), $templateDir = '/templates/')
{
@@ -113,6 +113,8 @@ public function __construct($name = null)
* @param columns Either a list of <code>Column</code> objects, or
* a list of <code>String</code> objects with column names.
* @deprecated Use the Platform::getColumnListDDL() method instead
+ *
+ * @return string
*/
public static function makeList($columns, PropelPlatformInterface $platform)
{
@@ -533,7 +535,9 @@ public function getTableName()
/**
* Adds a new inheritance definition to the inheritance list and set the
* parent column of the inheritance to the current column
- * @param mixed $inhdata Inheritance or XML data.
+ * @param Inheritance|string $inhdata Inheritance or XML data.
+ *
+ * @return Inheritance
*/
public function addInheritance($inhdata)
{
@@ -1115,7 +1119,9 @@ public function getDefaultValueString()
/**
* Set a string that will give this column a default value.
*
- * @param ColumnDefaultValue|scalar column default value
+ * @param ColumnDefaultValue|int|float|bool|string column default value
+ *
+ * @return Column
*/
public function setDefaultValue($def)
{
@@ -1168,6 +1174,7 @@ public function isLazyLoad()
/**
* Gets the auto-increment string.
* @return string
+ * @throws EngineException
*/
public function getAutoIncrementString()
{
@@ -432,7 +432,9 @@ public function getAppData()
/**
* Adds Domain object from <domain> tag.
- * @param mixed XML attributes (array) or Domain object.
+ * @param Domain|string $data XML attributes (array) or Domain object.
+ *
+ * @return Domain
*/
public function addDomain($data)
{
@@ -265,6 +265,7 @@ public function getDefaultValue()
* Gets the default value, type-casted for use in PHP OM.
* @return mixed
* @see getDefaultValue()
+ * @throws EngineException
*/
public function getPhpDefaultValue()
{
@@ -674,8 +674,9 @@ public function setBasePeer($v)
* A utility function to create a new column from attrib and add it to this
* table.
*
- * @param $coldata xml attributes or Column class for the column to add
- * @return the added column
+ * @param Column|string $coldata xml attributes or Column class for the column to add
+ * @return Column the added column
+ * @throws EngineException
*/
public function addColumn($data)
{
@@ -711,6 +712,7 @@ public function addColumn($data)
/**
* Removed a column from the table
* @param Column|string $col the column to remove
+ * @throws EngineException
*/
public function removeColumn($col)
{
@@ -114,6 +114,8 @@ public function getParameter($name)
* Whether parameter exists.
*
* @param string $name
+ *
+ * @return bool
*/
public function hasParameter($name)
{
@@ -140,6 +140,7 @@ public function getVendorInfoForType($type)
*
* @param string $bname behavior name, e.g. 'timestampable'
* @return string behavior class name, e.g. 'TimestampableBehavior'
+ * @throws InvalidArgumentException
*/
public function getConfiguredBehavior($bname)
{
@@ -163,6 +163,7 @@ public function isNativeIdMethodAutoIncrement()
*
* @param string $propelType the Propel type name.
* @return Domain The db specific domain.
+ * @throws EngineException
*/
public function getDomainForType($propelType)
{
@@ -209,6 +209,8 @@ protected function getMappedNativeType($propelType)
* Gets a new VendorInfo object for this platform with specified params.
*
* @param array $params
+ *
+ * @return VendorInfo
*/
protected function getNewVendorInfoObject(array $params)
{
@@ -69,6 +69,7 @@ protected function getTypeMapping()
/**
* Searches for tables in the database. Maybe we want to search also the views.
* @param Database $database The Database model class to add tables to.
+ * @return int
*/
public function parse(Database $database, Task $task = null)
{
@@ -153,6 +153,7 @@ public function parse(Database $database, Task $task = null)
* @param Table $table The Table model class to add columns to.
* @param int $oid The table OID
* @param string $version The database version.
+ * @throws EngineException
*/
protected function addColumns(Table $table, $oid, $version)
{
@@ -260,7 +260,7 @@ public function setXsl(PhingFile $v)
* created if it doesn't exist.
* @param PhingFile $outputDirectory
* @return void
- * @throws Exception
+ * @throws BuildException
*/
public function setOutputDirectory(PhingFile $outputDirectory)
{
@@ -346,7 +346,7 @@ public function createMapper()
* Maps the passed in name to a new filename & returns resolved File object.
* @param string $from
* @return PhingFile Resolved File object.
- * @throws BuilException - if no Mapper element se
+ * @throws BuildException - if no Mapper element se
* - if unable to map new filename.
*/
protected function getMappedFile($from)
@@ -401,6 +401,8 @@ public function getConnection()
/**
* Gets all matching XML schema files and loads them into data models for class.
* @return void
+ * @throws EngineException
+ * @throws BuildException
*/
protected function loadDataModels()
{
@@ -62,7 +62,7 @@ public function getMigrationTable()
* created if it doesn't exist.
* @param PhingFile $outputDirectory
* @return void
- * @throws Exception
+ * @throws BuildException
*/
public function setOutputDirectory(PhingFile $outputDirectory)
{
@@ -125,6 +125,7 @@ private function getDatabase($name)
*
* @return void
* @throws Exception If there is an error parsing the data xml.
+ * @throws BuildException
*/
public function main()
{
@@ -66,6 +66,7 @@ protected function ensureDirExists($path)
* @param OMBuilder $builder
* @param boolean $overwrite Whether to overwrite existing files with te new ones (default is YES).
* @todo -cPropelOMTask Consider refactoring build() method into AbstractPropelDataModelTask (would need to be more generic).
+ * @return int
*/
protected function build(OMBuilder $builder, $overwrite = true)
{
@@ -282,6 +282,8 @@ protected function getFilesToExecute()
* @param array $statements list of SQL statements (strings) to be executed
*
* @return integer the number of successful statements
+ *
+ * @throws BuildException
*/
protected function insertDatabaseSqlFiles($database, $statements)
{
@@ -277,6 +277,7 @@ public function setAddVendorInfo($v)
*
* @param string $v The comma-separated list of which validators to add.
* @return void
+ * @throws BuildException
*/
public function setAddValidators($v)
{
@@ -476,6 +477,8 @@ protected function addValidators(Database $database)
* @param Column $column The column that is being validated.
* @param string $type The type (string) for validator (e.g. 'required').
* @param mixed $value The value for the validator (if applicable)
+ *
+ * @return Rule
*/
protected function getValidatorRule(Column $column, $type, $value = null)
{
@@ -495,6 +498,8 @@ protected function getValidatorRule(Column $column, $type, $value = null)
* @param Column $column
* @param string $type
* @param mixed $value
+ *
+ * @return string
*/
protected function getRuleMessage(Column $column, $type, $value)
{
@@ -190,6 +190,10 @@ public function buildSql()
/**
* @param string $datasource A datasource name.
+ *
+ * @return bool
+ *
+ * @throws PDOException
*/
public function insertSql($datasource = null)
{
@@ -263,6 +267,7 @@ protected function getPdoConnection($datasource)
*
* @param string $file A file properties.
* @return array An array of properties as key/value pairs.
+ * @throws Exception
*/
protected function getProperties($file)
{
@@ -109,6 +109,7 @@ private function setOptions($pkg)
/**
* Main entry point.
* @return void
+ * @throws BuildException
*/
public function main()
{
View
@@ -843,6 +843,8 @@ public static function initBaseDir()
*
* @param string $class dot-path to clas (e.g. path.to.my.ClassName).
* @return string unqualified classname
+ *
+ * @throws PropelException
*/
public static function importClass($path)
{
@@ -137,6 +137,9 @@ public function random($seed = null)
* @param integer $limit
*
* @return void
+ *
+ * @throws PropelException
+ * @throws Exception
*/
public function applyLimit(&$sql, $offset, $limit)
{
Oops, something went wrong.

0 comments on commit 841d477

Please sign in to comment.