Skip to content

Commit

Permalink
Merge pull request #1751 from carusogabriel/missing-method-scope
Browse files Browse the repository at this point in the history
[CS] Add missing method scope and fix function comment style
  • Loading branch information
alcaeus committed Mar 14, 2018
2 parents 5e07b23 + 4ff476e commit 86e4a27
Show file tree
Hide file tree
Showing 19 changed files with 47 additions and 45 deletions.
6 changes: 3 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Persisters/PersistenceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,12 @@ public function prepareEmbeddedDocumentValue(array $embeddedMapping, $embeddedDo
return $embeddedDocumentValue;
}

/*
/**
* Returns the embedded document or reference representation to be stored.
*
* @param array $mapping
* @param array $mapping
* @param object $document
* @param boolean $includeNestedCollections
* @param bool $includeNestedCollections
* @return array|object|null
* @throws \InvalidArgumentException if the mapping is neither embedded nor reference
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Types/DateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public static function getDateTime($value)
return $datetime;
}

// @todo fix typing for $microseconds
private static function craftDateTime(int $seconds, $microseconds = 0)
{
// @todo fix typing for $microseconds
$datetime = new \DateTime();
$datetime->setTimestamp($seconds);
if ($microseconds > 0) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Types/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ abstract class Type
self::RAW => Types\RawType::class,
];

/* Prevent instantiation and force use of the factory method. */
/** Prevent instantiation and force use of the factory method. */
final private function __construct()
{
}
Expand Down
2 changes: 0 additions & 2 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNotCapital" />
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop" />
<exclude name="Squiz.Commenting.FunctionComment.WrongStyle" />
<exclude name="Squiz.Classes.ClassFileName.NoMatch" />
<exclude name="Squiz.Scope.MethodScope.Missing" />
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar" />
</rule>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class CollectionPersisterPost
/** @ODM\EmbedMany(targetDocument="CollectionPersisterComment", strategy="set") */
public $comments = [];

function __construct($post)
public function __construct($post)
{
$this->comments = new ArrayCollection();
$this->post = $post;
Expand All @@ -337,7 +337,7 @@ class CollectionPersisterComment
/** @ODM\EmbedMany(targetDocument="CollectionPersisterComment", strategy="set") */
public $comments = [];

function __construct($comment, $by)
public function __construct($comment, $by)
{
$this->comments = new ArrayCollection();
$this->comment = $comment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class DateCollectionType
{
use ClosureToPHP;

// Note: this method is called by PersistenceBuilder
/**
* Method called by PersistenceBuilder
*/
public function convertToDatabaseValue($value)
{
if ($value === null) {
Expand Down Expand Up @@ -90,7 +92,9 @@ public function convertToPHPValue($value)
return $value;
}

// Note: this method is never called
/**
* Method never called
*/
public function closureToMongo()
{
// todo: microseconds o.O
Expand Down
3 changes: 1 addition & 2 deletions tests/Doctrine/ODM/MongoDB/Tests/Functional/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ public function testQueryWhereInReferenceId()
$this->assertSame($expected, $qb->getQuery()->debug('query'));
}

// search for articles that have the "pet" tag in their tags collection
public function testQueryWhereOneValueOfCollection()
{
$qb = $this->dm->createQueryBuilder('Documents\Article');
Expand All @@ -399,7 +398,7 @@ public function testQueryWhereOneValueOfCollection()
$this->assertSame($expected, $qb->getQuery()->debug('query'));
}

// search for articles where tags exactly equal [pet, blue]
/** search for articles where tags exactly equal [pet, blue] */
public function testQueryWhereAllValuesOfCollection()
{
$qb = $this->dm->createQueryBuilder('Documents\Article');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class GH1294User
/** @ODM\Field(type="string") */
public $name = false;

// Return the identifier without triggering Proxy initialization
public function getId()
{
return $this->id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function __construct()
$this->followedBy = new ArrayCollection();
}

// Return the identifier without triggering Proxy initialization
/** Return the identifier without triggering Proxy initialization */
public function getId()
{
return $this->id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function __construct()
$this->likes = new ArrayCollection();
}

// Return the identifier without triggering Proxy initialization
/** Return the identifier without triggering Proxy initialization */
public function getId()
{
return $this->id;
Expand All @@ -140,7 +140,7 @@ public function __construct()
$this->likedBy = new ArrayCollection();
}

// Return the identifier without triggering Proxy initialization
/** Return the identifier without triggering Proxy initialization */
public function getId()
{
return $this->id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,17 @@ class MODM29Doc
/** @ODM\EmbedMany(targetDocument="MODM29Embedded", strategy="set") */
protected $collection;

function __construct($c)
public function __construct($c)
{
$this->set($c);
}

function set($c)
public function set($c)
{
$this->collection = $c;
}
function get()

public function get()
{
return $this->collection;
}
Expand All @@ -79,15 +80,17 @@ class MODM29Embedded
/** @ODM\Field(type="string") */
protected $val;

function __construct($val)
public function __construct($val)
{
$this->set($val);
}
function get()

public function get()
{
return $this->val;
}
function set($val)

public function set($val)
{
$this->val = $val;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class MODM45A
/** @ODM\EmbedOne(targetDocument="MODM45B") */
protected $b;

function getId()
public function getId()
{
return $this->id;
}
function getB()
public function getB()
{
return $this->b;
}
function setB($b)
public function setB($b)
{
$this->b = $b;
}
Expand All @@ -52,11 +52,12 @@ class MODM45B
{
/** @ODM\Field(type="string") */
protected $val;
function setVal($val)

public function setVal($val)
{
$this->val = $val;
}
function getVal()
public function getVal()
{
return $this->val;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class MODM47A
public $b = 'tmp';

/** @ODM\AlsoLoad("c") */
function renameC($c)
public function renameC($c)
{
$this->b = $c;
}
function getId()
public function getId()
{
return $this->id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ class MODM48A
/** @ODM\EmbedOne(targetDocument="MODM48B") */
public $b;

function getId()
public function getId()
{
return $this->id;
}
function getB()

public function getB()
{
return $this->b;
}
function setB($b)

public function setB($b)
{
$this->b = $b;
}
Expand All @@ -59,11 +61,12 @@ class MODM48B
/** @ODM\Field(type="string") */
public $val;

function setVal($val)
public function setVal($val)
{
$this->val = $val;
}
function getVal()

public function getVal()
{
return $this->val;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ class MODM52A
/** @ODM\ReferenceMany(targetDocument="MODM52B", cascade="all") */
protected $b;

function __construct($b)
public function __construct($b)
{
$this->b = new ArrayCollection($b);
}

function getB()
public function getB()
{
return $this->b;
}
Expand All @@ -90,7 +90,7 @@ class MODM52B
/** @ODM\Field(type="string") */
protected $value;

function __construct($v)
public function __construct($v)
{
$this->value = $v;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testDocumentWithEmbeddedDocumentNotUpdatedOnFlush()
$this->assertEquals($called, $this->listener->called);
}

/*
/**
* Ensures that the descriminator field is not unset if it's a
* real property on the document.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

class AnnotationDriverTest extends AbstractMappingDriverTest
{
// @TODO: This can be a generic test for all drivers
public function testFieldInheritance()
{
// @TODO: This can be a generic test for all drivers
$super = $this->dm->getClassMetadata(AnnotationDriverTestSuper::class);
$parent = $this->dm->getClassMetadata(AnnotationDriverTestParent::class);
$child = $this->dm->getClassMetadata(AnnotationDriverTestChild::class);
Expand Down
3 changes: 0 additions & 3 deletions tests/Doctrine/ODM/MongoDB/Tests/UnitOfWorkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ public function testRegisterRemovedOnNewEntityIsIgnored()
$this->assertFalse($this->uow->isScheduledForDelete($user));
}


/* Operational tests */

public function testSavingSingleDocumentWithIdentityFieldForcesInsert()
{
// Setup fake persister and id generator for identity generation
Expand Down
2 changes: 0 additions & 2 deletions tests/Documents/Functional/VirtualHostDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ public function setRecId($value = null)
$this->recId = $value;
}

/* Added automatically 2010-08-03 */

public function getName()
{
return $this->name;
Expand Down

0 comments on commit 86e4a27

Please sign in to comment.