Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve phpdoc types #389

Merged
merged 1 commit into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ final class MongoDBReferenceListener implements EventSubscriber
/** @var ReferenceRepository */
private $referenceRepository;

/**
* Initialize listener
*/
public function __construct(ReferenceRepository $referenceRepository)
{
$this->referenceRepository = $referenceRepository;
Expand All @@ -35,6 +32,8 @@ public function getSubscribedEvents()

/**
* Populates identities for stored references
*
* @return void
*/
public function postPersist(LifecycleEventArgs $args)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ final class ORMReferenceListener implements EventSubscriber
/** @var ReferenceRepository */
private $referenceRepository;

/**
* Initialize listener
*/
public function __construct(ReferenceRepository $referenceRepository)
{
$this->referenceRepository = $referenceRepository;
Expand All @@ -36,6 +33,8 @@ public function getSubscribedEvents()

/**
* Populates identities for stored references
*
* @return void
*/
public function postPersist(LifecycleEventArgs $args)
{
Expand Down
16 changes: 14 additions & 2 deletions lib/Doctrine/Common/DataFixtures/Executor/AbstractExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public function setReferenceRepository(ReferenceRepository $referenceRepository)

/**
* Sets the Purger instance to use for this executor instance.
*
* @return void
*/
public function setPurger(PurgerInterface $purger)
{
Expand All @@ -80,6 +82,8 @@ public function getPurger()
* Set the logger callable to execute with the log() method.
*
* @param callable $logger
*
* @return void
*/
public function setLogger($logger)
{
Expand All @@ -90,6 +94,8 @@ public function setLogger($logger)
* Logs a message using the logger.
*
* @param string $message
*
* @return void
*/
public function log($message)
{
Expand All @@ -99,6 +105,8 @@ public function log($message)

/**
* Load a fixture with the given persistence manager.
*
* @return void
*/
public function load(ObjectManager $manager, FixtureInterface $fixture)
{
Expand All @@ -123,6 +131,8 @@ public function load(ObjectManager $manager, FixtureInterface $fixture)
/**
* Purges the database before loading.
*
* @return void
*
* @throws Exception if the purger is not defined.
*/
public function purge()
Expand All @@ -144,8 +154,10 @@ public function purge()
/**
* Executes the given array of data fixtures.
*
* @param array $fixtures Array of fixtures to execute.
* @param bool $append Whether to append the data fixtures or purge the database before loading.
* @param FixtureInterface[] $fixtures Array of fixtures to execute.
* @param bool $append Whether to append the data fixtures or purge the database before loading.
*
* @return void
*/
abstract public function execute(array $fixtures, $append = false);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/Common/DataFixtures/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function addFixture(FixtureInterface $fixture)
/**
* Returns the array of data fixtures to execute.
*
* @return array $fixtures
* @psalm-return array<class-string<OrderedFixtureInterface>|int, OrderedFixtureInterface>
*/
public function getFixtures()
{
Expand Down
4 changes: 4 additions & 0 deletions lib/Doctrine/Common/DataFixtures/ProxyReferenceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public function serialize()
* Unserialize reference repository
*
* @param string $serializedData Serialized data
*
* @return void
*/
public function unserialize($serializedData)
{
Expand Down Expand Up @@ -115,6 +117,8 @@ public function load($baseCacheName)
* Save data fixture reference repository
*
* @param string $baseCacheName Base cache name
*
* @return void
*/
public function save($baseCacheName)
{
Expand Down
4 changes: 4 additions & 0 deletions lib/Doctrine/Common/DataFixtures/Purger/MongoDBPurger.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class MongoDBPurger implements PurgerInterface
* Construct new purger instance.
*
* @param DocumentManager $dm DocumentManager instance used for persistence.
*
* @return void
*/
public function __construct(?DocumentManager $dm = null)
{
Expand All @@ -26,6 +28,8 @@ public function __construct(?DocumentManager $dm = null)

/**
* Set the DocumentManager instance this purger instance should use.
*
* @return void
*/
public function setDocumentManager(DocumentManager $dm)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/Common/DataFixtures/Purger/ORMPurger.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ private function getCommitOrder(EntityManagerInterface $em, array $classes)
}

/**
* @param array $classes
* @param ClassMetadata[] $classes
*
* @return array
* @return string[]
*/
private function getAssociationTables(array $classes, AbstractPlatform $platform)
{
Expand Down
12 changes: 8 additions & 4 deletions lib/Doctrine/Common/DataFixtures/ReferenceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ReferenceRepository
* List of named references to the fixture objects
* gathered during loads of fixtures
*
* @var array
* @psalm-var array<string, object>
*/
private $references = [];

Expand All @@ -35,7 +35,7 @@ class ReferenceRepository
* in case if reference gets unmanaged, it will
* use a proxy referenced by this identity
*
* @var array
* @psalm-var array<string, mixed>
*/
private $identities = [];

Expand Down Expand Up @@ -89,6 +89,8 @@ protected function getIdentifier($reference, $uow)
*
* @param string $name
* @param object $reference
*
* @return void
*/
public function setReference($name, $reference)
{
Expand All @@ -108,6 +110,8 @@ public function setReference($name, $reference)
*
* @param string $name
* @param mixed $identity
*
* @return void
*/
public function setReferenceIdentity($name, $identity)
{
Expand Down Expand Up @@ -213,7 +217,7 @@ public function hasIdentity($name)
/**
* Get all stored identities
*
* @return array
* @psalm-return array<string, object>
*/
public function getIdentities()
{
Expand All @@ -223,7 +227,7 @@ public function getIdentities()
/**
* Get all stored references
*
* @return array
* @psalm-return array<string, object>
*/
public function getReferences()
{
Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/Common/DataFixtures/Sorter/TopologicalSorter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class TopologicalSorter
/**
* Volatile variable holding calculated nodes during sorting process.
*
* @var array
* @var ClassMetadata[]
*/
private $sortedNodeList = [];

Expand All @@ -46,8 +46,6 @@ class TopologicalSorter
private $allowCyclicDependencies;

/**
* Construct TopologicalSorter object
*
* @param bool $allowCyclicDependencies
*/
public function __construct($allowCyclicDependencies = true)
Expand Down Expand Up @@ -100,7 +98,7 @@ public function addDependency($fromHash, $toHash)
*
* Note: Highly performance-sensitive method.
*
* @return array
* @return ClassMetadata[]
*
* @throws RuntimeException
* @throws CircularReferenceException
Expand Down Expand Up @@ -128,6 +126,8 @@ public function sort()
*
* Note: Highly performance-sensitive method.
*
* @return void
*
* @throws RuntimeException
* @throws CircularReferenceException
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function loadTestData()
* Execute test purge
*
* @param string|null $expression
* @param array $list
* @param string[] $list
*/
public function executeTestPurge($expression, array $list, ?callable $filter = null): void
{
Expand Down