From 23c05811d7ee8a5dc09e7da9e6f5bad9e6bcc6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Gomez?= Date: Mon, 15 Sep 2014 13:37:23 +0100 Subject: [PATCH] CS fixes --- DataFixtures/Loader/AbstractDataLoader.php | 2 +- DataFixtures/Loader/YamlDataLoader.php | 2 +- .../ParamConverter/PropelParamConverter.php | 4 +- .../Loader/YamlDataLoaderTest.php | 1 - Tests/Fixtures/Model/Base/Book.php | 40 +++++++++---------- Tests/Fixtures/Model/Base/BookQuery.php | 36 ++++++++--------- Tests/Fixtures/Model/Map/BookTableMap.php | 28 ++++++------- 7 files changed, 55 insertions(+), 58 deletions(-) diff --git a/DataFixtures/Loader/AbstractDataLoader.php b/DataFixtures/Loader/AbstractDataLoader.php index bd24e4d..0c240f1 100644 --- a/DataFixtures/Loader/AbstractDataLoader.php +++ b/DataFixtures/Loader/AbstractDataLoader.php @@ -253,7 +253,7 @@ abstract class AbstractDataLoader extends AbstractDataHandler implements DataLoa $reflectionClass = new \ReflectionClass($parentClass); if (!$reflectionClass->isAbstract()) { - $parentObj = new $parentClass; + $parentObj = new $parentClass(); $parentObj->fromArray($obj->toArray()); $this->saveParentReference($parentClass, $key, $parentObj); } diff --git a/DataFixtures/Loader/YamlDataLoader.php b/DataFixtures/Loader/YamlDataLoader.php index 53f08d1..c06aaef 100644 --- a/DataFixtures/Loader/YamlDataLoader.php +++ b/DataFixtures/Loader/YamlDataLoader.php @@ -61,7 +61,7 @@ class YamlDataLoader extends AbstractDataLoader } ob_start(); - $retval = include($file); + $retval = include $file; $content = ob_get_clean(); // if an array is returned by the config file assume it's in plain php form else in YAML diff --git a/Request/ParamConverter/PropelParamConverter.php b/Request/ParamConverter/PropelParamConverter.php index 76891c8..07595cc 100644 --- a/Request/ParamConverter/PropelParamConverter.php +++ b/Request/ParamConverter/PropelParamConverter.php @@ -64,7 +64,7 @@ class PropelParamConverter implements ParamConverterInterface } /** - * @param Request $request + * @param Request $request * @param ParamConverter $configuration * * @return bool @@ -122,7 +122,7 @@ class PropelParamConverter implements ParamConverterInterface unset($this->filters[$configuration->getName()]); } - $this->withs = isset($options['with'])? is_array($options['with'])? $options['with'] : array($options['with']) : array(); + $this->withs = isset($options['with']) ? is_array($options['with']) ? $options['with'] : array($options['with']) : array(); // find by Pk if (false === $object = $this->findPk($classQuery, $request)) { diff --git a/Tests/DataFixtures/Loader/YamlDataLoaderTest.php b/Tests/DataFixtures/Loader/YamlDataLoaderTest.php index 4c21a03..2196d93 100644 --- a/Tests/DataFixtures/Loader/YamlDataLoaderTest.php +++ b/Tests/DataFixtures/Loader/YamlDataLoaderTest.php @@ -153,7 +153,6 @@ YAML; $this->assertRegexp('#[\w ]+#', $book->getDescription()); } - public function testYamlLoadManyToMany() { $schema = <<importFrom('JSON', '{"Id":9012,"Name":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, + * @param mixed $parser A AbstractParser instance, * or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param string $data The source data to import from + * @param string $data The source data to import from * * @return Book The current object, for fluid interface */ @@ -541,7 +541,6 @@ abstract class Book implements ActiveRecordInterface { try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : BookTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -858,12 +857,12 @@ abstract class Book implements ActiveRecordInterface /** * 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: - * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. - * Defaults to TableMap::TYPE_PHPNAME. - * @return mixed Value of field. + * @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_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return mixed Value of field. */ public function getByName($name, $type = TableMap::TYPE_PHPNAME) { @@ -907,9 +906,9 @@ abstract class Book implements ActiveRecordInterface * 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_STUDLYPHPNAME, - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. - * Defaults to TableMap::TYPE_PHPNAME. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. @@ -946,12 +945,12 @@ abstract class Book implements ActiveRecordInterface /** * 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: - * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. - * Defaults to TableMap::TYPE_PHPNAME. + * @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_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. * @return void */ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) @@ -1093,7 +1092,7 @@ abstract class Book implements ActiveRecordInterface $copyObj->setAuthorId($this->getAuthorId()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + $copyObj->setId(null); // this is a auto-increment column, so set to default value } } @@ -1129,7 +1128,7 @@ abstract class Book implements ActiveRecordInterface public function setAuthor(ChildAuthor $v = null) { if ($v === null) { - $this->setAuthorId(NULL); + $this->setAuthorId(null); } else { $this->setAuthorId($v->getId()); } @@ -1145,7 +1144,6 @@ abstract class Book implements ActiveRecordInterface return $this; } - /** * Get the associated ChildAuthor object * diff --git a/Tests/Fixtures/Model/Base/BookQuery.php b/Tests/Fixtures/Model/Base/BookQuery.php index 33290da..a5cbcad 100644 --- a/Tests/Fixtures/Model/Base/BookQuery.php +++ b/Tests/Fixtures/Model/Base/BookQuery.php @@ -232,10 +232,10 @@ abstract class BookQuery extends ModelCriteria * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id 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 mixed $id 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 * * @return ChildBookQuery The current query, for fluid interface @@ -272,8 +272,8 @@ abstract class BookQuery extends ModelCriteria * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' * * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) + * @param string $title The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildBookQuery The current query, for fluid interface @@ -301,8 +301,8 @@ abstract class BookQuery extends ModelCriteria * $query->filterByIsbn('%fooValue%'); // WHERE ISBN LIKE '%fooValue%' * * - * @param string $isbn The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) + * @param string $isbn The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildBookQuery The current query, for fluid interface @@ -333,10 +333,10 @@ abstract class BookQuery extends ModelCriteria * * @see filterByAuthor() * - * @param mixed $authorId 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 mixed $authorId 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 * * @return ChildBookQuery The current query, for fluid interface @@ -447,13 +447,13 @@ abstract class BookQuery extends ModelCriteria /** * Performs a DELETE on the database, given a ChildBook or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ChildBook object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use + * @param mixed $values Criteria or ChildBook 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 - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ public function delete(ConnectionInterface $con = null) { diff --git a/Tests/Fixtures/Model/Map/BookTableMap.php b/Tests/Fixtures/Model/Map/BookTableMap.php index 0f4498d..e232e9d 100644 --- a/Tests/Fixtures/Model/Map/BookTableMap.php +++ b/Tests/Fixtures/Model/Map/BookTableMap.php @@ -167,7 +167,7 @@ class BookTableMap extends TableMap * @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_STUDLYPHPNAME - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM */ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { @@ -187,7 +187,7 @@ class BookTableMap extends TableMap * @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_STUDLYPHPNAME - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ @@ -226,8 +226,8 @@ class BookTableMap extends TableMap * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (Book object, last column rank) + * rethrown wrapped into a PropelException. + * @return array (Book object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { @@ -254,7 +254,7 @@ class BookTableMap extends TableMap * @param DataFetcherInterface $dataFetcher * @return array * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. + * rethrown wrapped into a PropelException. */ public static function populateObjects(DataFetcherInterface $dataFetcher) { @@ -290,7 +290,7 @@ class BookTableMap extends TableMap * @param Criteria $criteria object containing the columns to add. * @param string $alias optional table alias * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. + * rethrown wrapped into a PropelException. */ public static function addSelectColumns(Criteria $criteria, $alias = null) { @@ -314,7 +314,7 @@ class BookTableMap extends TableMap * This method is not needed for general use but a specific application could have a need. * @return TableMap * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. + * rethrown wrapped into a PropelException. */ public static function getTableMap() { @@ -335,13 +335,13 @@ class BookTableMap extends TableMap /** * Performs a DELETE on the database, given a Book or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Book object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use + * @param mixed $values Criteria or Book 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 - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ public static function doDelete($values, ConnectionInterface $con = null) { @@ -389,7 +389,7 @@ class BookTableMap extends TableMap * @param ConnectionInterface $con the ConnectionInterface connection to use * @return mixed The new primary key. * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. + * rethrown wrapped into a PropelException. */ public static function doInsert($criteria, ConnectionInterface $con = null) {