Skip to content

Commit

Permalink
Fixed CS (PHP-CS-Fixer)
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed May 22, 2012
1 parent 44a79a0 commit 5f1a736
Show file tree
Hide file tree
Showing 82 changed files with 250 additions and 319 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ composer.phar
composer.lock
pom.xml
check_cs
php-cs-fixer.phar

tests/Fixtures/namespaced/build/
tests/Fixtures/nestedset/build/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
*
* @return <?php echo $objectClassName ?> The current object (for fluent API support)
*/
public function populateFromArchive($archive<?php if ($usesAutoIncrement): ?>, $populateAutoIncrementPrimaryKeys = false<?php endif; ?>)
{
public function populateFromArchive($archive<?php if ($usesAutoIncrement): ?>, $populateAutoIncrementPrimaryKeys = false<?php endif; ?>) {
<?php if ($usesAutoIncrement): ?>
if ($populateAutoIncrementPrimaryKeys) {
<?php foreach ($columns as $col): ?>
Expand Down
4 changes: 2 additions & 2 deletions src/Propel/Generator/Behavior/Validate/ValidateBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ public function mergeParameters(array $params = null)
$parameters = $this->getParameters();
$out = array();
$i = 1;
foreach($parameters as $key => $parameter) {
foreach ($parameters as $key => $parameter) {
$out["rule$i"] = $parameter;
$i++;
}
foreach($params as $key => $param) {
foreach ($params as $key => $param) {
$out["rule$i"] = $param;
$i++;
}
Expand Down
24 changes: 13 additions & 11 deletions src/Propel/Generator/Builder/Om/ObjectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ protected function addLazyLoaderBody(&$script, Column $column)
// PDO_OCI returns a stream for CLOB objects, while other PDO adapters return a string...
$script .= "
\$this->$clo = stream_get_contents(\$row[0]);";
} elseif ($column->isLobType() && !$platform->hasStreamBlobImpl()) {
} elseif ($column->isLobType() && !$platform->hasStreamBlobImpl()) {
$script .= "
if (\$row[0] !== null) {
\$this->$clo = fopen('php://memory', 'r+');
Expand Down Expand Up @@ -1805,7 +1805,8 @@ protected function addHasOnlyDefaultValues(&$script)
* @param string &$script The script will be modified in this method.
* @see addHasOnlyDefaultValues
**/
protected function addHasOnlyDefaultValuesComment(&$script) {
protected function addHasOnlyDefaultValuesComment(&$script)
{
$script .= "
/**
* Indicates whether the columns in this object are only set to default values.
Expand All @@ -1822,7 +1823,8 @@ protected function addHasOnlyDefaultValuesComment(&$script) {
* @param string &$script The script will be modified in this method.
* @see addHasOnlyDefaultValues
**/
protected function addHasOnlyDefaultValuesOpen(&$script) {
protected function addHasOnlyDefaultValuesOpen(&$script)
{
$script .= "
public function hasOnlyDefaultValues()
{";
Expand Down Expand Up @@ -1943,7 +1945,7 @@ protected function addHydrateBody(&$script)
// PDO_OCI returns a stream for CLOB objects, while other PDO adapters return a string...
$script .= "
\$this->$clo = stream_get_contents(\$row[\$startcol + $n]);";
} elseif ($col->isLobType() && !$platform->hasStreamBlobImpl()) {
} elseif ($col->isLobType() && !$platform->hasStreamBlobImpl()) {
$script .= "
if (\$row[\$startcol + $n] !== null) {
\$this->$clo = fopen('php://memory', 'r+');
Expand Down Expand Up @@ -2372,7 +2374,7 @@ protected function addGetByPositionBody(&$script)
{
$table = $this->getTable();
$script .= "
switch(\$pos) {";
switch (\$pos) {";
$i = 0;
foreach ($table->getColumns() as $col) {
$cfc = $col->getPhpName();
Expand Down Expand Up @@ -2439,7 +2441,7 @@ protected function addSetByPosition(&$script)
*/
public function setByPosition(\$pos, \$value)
{
switch(\$pos) {";
switch (\$pos) {";
$i = 0;
foreach ($table->getColumns() as $col) {
$cfc = $col->getPhpName();
Expand Down Expand Up @@ -3392,8 +3394,8 @@ public function initRelation(\$relationName)
* Adds the method that clears the referrer fkey collection.
* @param string &$script The script will be modified in this method.
*/
protected function addRefFKClear(&$script, ForeignKey $refFK) {

protected function addRefFKClear(&$script, ForeignKey $refFK)
{
$relCol = $this->getRefFKPhpNameAffix($refFK, true);
$collName = $this->getRefFKCollVarName($refFK);

Expand All @@ -3418,8 +3420,8 @@ public function clear$relCol()
* Adds the method that initializes the referrer fkey collection.
* @param string &$script The script will be modified in this method.
*/
protected function addRefFKInit(&$script, ForeignKey $refFK) {

protected function addRefFKInit(&$script, ForeignKey $refFK)
{
$relCol = $this->getRefFKPhpNameAffix($refFK, true);
$collName = $this->getRefFKCollVarName($refFK);

Expand Down Expand Up @@ -4944,7 +4946,7 @@ public function clear()
$script .= "
\$this->".$clo."_isLoaded = false;";
}
if($col->getType() == PropelTypes::OBJECT || $col->getType() == PropelTypes::PHP_ARRAY) {
if ($col->getType() == PropelTypes::OBJECT || $col->getType() == PropelTypes::PHP_ARRAY) {
$cloUnserialized = $clo.'_unserialized';

$script .="
Expand Down
4 changes: 2 additions & 2 deletions src/Propel/Generator/Builder/Om/PeerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ static public function getOMClass(\$row, \$colnum, \$withPrefix = true)
\$omClass = null;
\$classKey = \$row[\$colnum + " . ($col->getPosition() - 1) . "];
switch(\$classKey) {
switch (\$classKey) {
";
foreach ($col->getChildren() as $child) {
$script .= "
Expand Down Expand Up @@ -1383,7 +1383,7 @@ static public function doInsert(\$values, ConnectionInterface \$con = null)
\$con->beginTransaction();
\$pk = ".$this->basePeerClassName."::doInsert(\$criteria, \$con);
\$con->commit();
} catch(PropelException \$e) {
} catch (PropelException \$e) {
\$con->rollBack();
throw \$e;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Propel/Generator/Builder/Util/SchemaReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function startElement($parser, $name, $attributes)
$this->_throwInvalidTagException($parser, $name);
}

} elseif ('table' === $parentTag) {
} elseif ('table' === $parentTag) {
switch ($name) {
case 'column':
$this->currColumn = $this->currTable->addColumn($attributes);
Expand Down Expand Up @@ -243,7 +243,7 @@ public function startElement($parser, $name, $attributes)
$this->_throwInvalidTagException($parser, $name);
}

} elseif ('column' === $parentTag) {
} elseif ('column' === $parentTag) {

switch ($name) {
case 'inheritance':
Expand Down Expand Up @@ -290,7 +290,7 @@ public function startElement($parser, $name, $attributes)

} elseif ('unique' === $parentTag) {

switch($name) {
switch ($name) {
case 'unique-column':
$this->currUnique->addColumn($attributes);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/Propel/Generator/Config/ArrayToPhpConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static function convert($c)
unset($c['log']);
}

return $conf;
return preg_replace('/[ \t]*$/m', '', $conf);
}

protected static function getLoggerCode($conf)
Expand Down
2 changes: 1 addition & 1 deletion src/Propel/Runtime/Connection/ConnectionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public function setAttribute($attribute, $value)
}
$attribute = constant($attribute);
}
switch($attribute) {
switch ($attribute) {
case self::PROPEL_ATTR_CACHE_PREPARES:
$this->isCachePreparedStatements = $value;
break;
Expand Down
4 changes: 2 additions & 2 deletions src/Propel/Runtime/Om/BaseObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ abstract class BaseObject
/**
* Empty constructor (this allows people with their own BaseObject implementation to use its constructor)
*/
public function __construct() {

public function __construct()
{
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Propel/Runtime/Query/Criteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ public function mergeWith(Criteria $criteria, $operator = null)

// merge select modifiers
$selectModifiers = $criteria->getSelectModifiers();
if ($selectModifiers && ! $this->selectModifiers){
if ($selectModifiers && ! $this->selectModifiers) {
$this->selectModifiers = $selectModifiers;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Propel/Runtime/Query/ModelCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ static public function getRelationName($relation)
{
// get the relationName
list($fullName, $relationAlias) = self::getClassAndAlias($relation);
if ($relationAlias) {
if ($relationAlias) {
$relationName = $relationAlias;
} elseif (false === strpos($fullName, '.')) {
$relationName = $fullName;
Expand Down
9 changes: 5 additions & 4 deletions src/Propel/Runtime/Util/BasePeer.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ static public function doDeleteAll($tableName, ConnectionInterface $con, $databa
* is auto-generated. Otherwise will return <code>null</code>.
* @throws \Propel\Runtime\Exception\RuntimeException
*/
static public function doInsert(Criteria $criteria, ConnectionInterface $con) {
static public function doInsert(Criteria $criteria, ConnectionInterface $con)
{
// The primary key
$id = null;
$db = Propel::getServiceContainer()->getAdapter($criteria->getDbName());
Expand Down Expand Up @@ -330,8 +331,8 @@ static public function doInsert(Criteria $criteria, ConnectionInterface $con) {
* is returned (supported) by the Propel db driver.
* @throws \Propel\Runtime\Exception\RuntimeException
*/
static public function doUpdate(Criteria $selectCriteria, Criteria $updateValues, ConnectionInterface $con) {

static public function doUpdate(Criteria $selectCriteria, Criteria $updateValues, ConnectionInterface $con)
{
$db = Propel::getServiceContainer()->getAdapter($selectCriteria->getDbName());
$dbMap = Propel::getServiceContainer()->getDatabaseMap($selectCriteria->getDbName());

Expand Down Expand Up @@ -738,7 +739,7 @@ static public function createSelectSql(Criteria $criteria, &$params)
if ($spacePos !== false) {
$direction = substr($columnName, $spacePos);
$columnName = substr($columnName, 0, $spacePos);
} else {
} else {
$direction = '';
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/bookstore-packaged/book.schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
local="author_id"
foreign="id"/>
</foreign-key>

</table>

</database>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
name="age"
type="INTEGER"
description="The authors age"/>

</table>

</database>
8 changes: 4 additions & 4 deletions tests/Fixtures/bookstore/behavior-validate-schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<parameter name="rule6" value="{column: birthday, validator: Date}" />
</behavior>
</table>

<table name="validate_reader" description="Reader Table">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" description="Author Id" />
<column name="first_name" required="true" type="VARCHAR" size="128" description="First Name" />
Expand All @@ -63,7 +63,7 @@
<parameter name="rule6" value="{column: birthday, validator: Date}" />
</behavior>
</table>

<table name="validate_reader_book" isCrossRef="true">
<column name="reader_id" type="INTEGER" primaryKey="true"/>
<column name="book_id" type="INTEGER" primaryKey="true"/>
Expand All @@ -80,5 +80,5 @@
<parameter name="rule4" value="{column: book_id, validator: Type, options: {type: integer}}" />
</behavior>
</table>
</database>

</database>
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
<parameter name="i18n_columns" value="title" />
</behavior>
</table>

<table name="validate_trigger_fiction">
<behavior name="concrete_inheritance">
<parameter name="extends" value="validate_trigger_book" />
</behavior>
<column name="foo" type="VARCHAR" size="100"/>
</table>

<table name="validate_trigger_comic">
<behavior name="concrete_inheritance">
<parameter name="extends" value="validate_trigger_book" />
Expand All @@ -34,5 +34,5 @@
<parameter name="rule2" value="{column: bar, validator: Type, options: {type: string }}" />
</behavior>
</table>
</database>

</database>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ConcreteInheritanceBehaviorTest extends BookstoreTestBase
public function setUp()
{
parent::setUp();

if (!class_exists('ConcreteContentSetPkQuery')) {
$schema = <<<EOF
<database name="concrete_content_set_pk">
Expand All @@ -67,7 +67,7 @@ public function setUp()
QuickBuilder::buildSchema($schema);
}
}

public function testParentBehavior()
{
$behaviors = ConcreteContentPeer::getTableMap()->getBehaviors();
Expand Down Expand Up @@ -274,7 +274,7 @@ public function testGetParentOrCreateNewWithPK()
$this->assertEquals(5,$content->getId(), 'getParentOrCreate() returns a instance of the parent class with pk set');
$this->assertEquals('ConcreteArticleSetPk', $content->getDescendantClass(), 'getParentOrCreate() correctly sets the descendant_class of the parent object');
}

public function testSetPKOnNewObject()
{
\ConcreteContentSetPkQuery::create()->deleteAll();
Expand All @@ -287,7 +287,7 @@ public function testSetPKOnNewObject()
$articledb = \ConcreteArticleSetPkQuery::create()->findOneById(2);
$this->assertEquals(2, $articledb->getId(), 'getParentOrCreate() keeps manually set pk after save and reload from db');
}

public function testSetPKOnNewObjectWithPkAlreadyInParentTable()
{
\ConcreteContentSetPkQuery::create()->deleteAll();
Expand All @@ -304,7 +304,7 @@ public function testSetPKOnNewObjectWithPkAlreadyInParentTable()
$this->assertTrue(true, 'getParentOrCreate() returns a new parent object on new child objects with pk set');
}
}

public function testSetPkAllowPkInsertIsFalse()
{
ConcreteContentQuery::create()->deleteAll();
Expand All @@ -318,5 +318,5 @@ public function testSetPkAllowPkInsertIsFalse()
$this->assertTrue(true, 'SetPk fails when allowPkInsert is false');
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,8 @@

use Propel\Tests\Bookstore\Behavior\ConcreteArticle;
use Propel\Tests\Bookstore\Behavior\ConcreteArticleQuery;
use Propel\Tests\Bookstore\Behavior\ConcreteArticlePeer;
use Propel\Tests\Bookstore\Behavior\ConcreteAuthorPeer;
use Propel\Tests\Bookstore\Behavior\ConcreteCategory;
use Propel\Tests\Bookstore\Behavior\ConcreteCategoryQuery;
use Propel\Tests\Bookstore\Behavior\ConcreteContent;
use Propel\Tests\Bookstore\Behavior\ConcreteContentQuery;
use Propel\Tests\Bookstore\Behavior\ConcreteContentPeer;
use Propel\Tests\Bookstore\Behavior\ConcreteQuizz;
use Propel\Tests\Bookstore\Behavior\ConcreteQuizzPeer;
use Propel\Tests\Bookstore\Behavior\ConcreteQuizzQuery;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@

use Propel\Tests\Helpers\Bookstore\Behavior\BookstoreNestedSetTestBase;
use Propel\Tests\Helpers\Bookstore\Behavior\PublicTable9;
use Propel\Tests\Helpers\Bookstore\Behavior\PublicTable10;

use Propel\Tests\Bookstore\Behavior\Table9;
use Propel\Tests\Bookstore\Behavior\Table9Peer;
use Propel\Tests\Bookstore\Behavior\Table9Query;
use Propel\Tests\Bookstore\Behavior\Table10;
use Propel\Tests\Bookstore\Behavior\Table10Peer;

use Propel\Runtime\Propel;
use Propel\Runtime\Collection\ObjectCollection;
Expand Down
Loading

0 comments on commit 5f1a736

Please sign in to comment.