Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix CS

  • Loading branch information...
commit 81a7125b3cad035e8e0257492034fb55a200be63 1 parent 3db5195
William Durand willdurand authored
10 generator/lib/builder/om/PHP5ObjectBuilder.php
View
@@ -1986,15 +1986,14 @@ protected function addDefaultMutator(&$script, Column $col)
// Perform type-casting to ensure that we can use type-sensitive
// checking in mutators.
if ($col->isPhpPrimitiveType()) {
- if($col->isTextType()) {
+ if ($col->isTextType()) {
$script .= "
if (\$v !== null) {";
} else {
$script .= "
- if (\$v !== null && is_numeric(\$v)) {";
+ if (\$v !== null && is_numeric(\$v)) {";
}
-
-
+
$script .= "
\$v = (" . $col->getPhpType() . ") \$v;
}
@@ -4644,8 +4643,7 @@ protected function doAdd{$relatedObjectClassName}({$relatedObjectName} \${$lower
{
// set the back reference to this object directly as using provided method either results
// in endless loop or in multiple relations
- if (!\${$lowerRelatedObjectClassName}->get{$selfRelationNamePlural}()->contains(\$this)) {
- {$foreignObjectName} = new {$className}();
+ if (!\${$lowerRelatedObjectClassName}->get{$selfRelationNamePlural}()->contains(\$this)) { {$foreignObjectName} = new {$className}();
{$foreignObjectName}->set{$relatedObjectClassName}(\${$lowerRelatedObjectClassName});
\$this->add{$refKObjectClassName}({$foreignObjectName});
5 runtime/lib/om/BaseObject.php
View
@@ -115,12 +115,13 @@ public function isNew()
* Setter for the isNew attribute. This method will be called
* by Propel-generated children and Peers.
*
- * @param boolean $b the state of the object.
+ * @param boolean $b the state of the object.
* @return self
*/
public function setNew($b)
{
$this->_new = (boolean) $b;
+
return $this;
}
@@ -144,6 +145,7 @@ public function isDeleted()
public function setDeleted($b)
{
$this->_deleted = (boolean) $b;
+
return $this;
}
@@ -256,6 +258,7 @@ public function resetModified($col = null)
} else {
$this->modifiedColumns = array();
}
+
return $this;
}
30 test/testsuite/generator/builder/om/GeneratedObjectTest.php
View
@@ -100,44 +100,44 @@ public function testDefaultValues()
$acct->setPassword("testpass");
$this->assertTrue($acct->isModified());
}
-
-
+
+
public function testTypeHintingValues()
{
$test_name = 'test name';
$a = new Author();
$a2 = new Author();
$a2->setFirstName($test_name);
-
-
+
+
$a->setAge(2);
$this->assertEquals(2, $a->getAge());
$this->assertTrue(is_int($a->getAge()));
-
-
+
+
$a->clear();
$a->setAge('2');
$this->assertEquals(2, $a->getAge());
$this->assertTrue(is_int($a->getAge()));
-
-
+
+
$a->clear();
$a->setAge('wrong integer');
$this->assertTrue(!is_int($a->getAge()));
-
-
+
+
$a->clear();
$a->setFirstName($test_name);
$this->assertEquals($test_name, $a->getFirstName());
$this->assertTrue(is_string($a->getFirstName()));
-
-
+
+
$a->clear();
$a->setFirstName($a2);
$this->assertTrue(is_string($a->getFirstName()));
- $this->assertEquals($a->getFirstName(), (string)$a2);
-
-
+ $this->assertEquals($a->getFirstName(), (string) $a2);
+
+
$a->clear();
$a->setFirstName(true);
$this->assertTrue(is_string($a->getFirstName()));
4 test/testsuite/runtime/formatter/PropelSimpleArrayFormatterTest.php
View
@@ -80,7 +80,7 @@ public function testFormatOneWithOneRowAndValueBooleanEqualsFalse()
$book = $formatter->formatOne($stmt);
$this->assertNotNull($book);
- $this->assertSame(false, (bool)$book);
+ $this->assertSame(false, (bool) $book);
}
public function testFormatWithOneRowAndValueBooleanEqualsFalse()
@@ -94,6 +94,6 @@ public function testFormatWithOneRowAndValueBooleanEqualsFalse()
$books = $formatter->format($stmt);
$this->assertInstanceOf('PropelCollection', $books);
$this->assertCount(4, $books);
- $this->assertSame(false, (bool)$books[0]);
+ $this->assertSame(false, (bool) $books[0]);
}
}
6 test/testsuite/runtime/om/BaseObjectTest.php
View
@@ -60,21 +60,21 @@ public function testSetVirtualColumn()
$this->assertEquals('baz', $b->getVirtualColumn('foo'), 'setVirtualColumn() can modify the value of an existing virtual column');
$this->assertEquals($b, $b->setVirtualColumn('foo', 'bar'), 'setVirtualColumn() returns the current object');
}
-
+
public function testSetNewReturnsSelf()
{
$b = new TestableBaseObject();
$this->assertInstanceOf('TestableBaseObject', $b->setNew(false));
$this->assertInstanceOf('TestableBaseObject', $b->setNew(true));
}
-
+
public function testSetDeletedReturnsSelf()
{
$b = new TestableBaseObject();
$this->assertInstanceOf('TestableBaseObject', $b->setDeleted(false));
$this->assertInstanceOf('TestableBaseObject', $b->setDeleted(true));
}
-
+
public function testResetModifiedReturnsSelf()
{
$b = new TestableBaseObject();
Please sign in to comment.
Something went wrong with that request. Please try again.