Skip to content

Commit

Permalink
minor #32771 [DoctrineBridge] add parameter type declarations to priv…
Browse files Browse the repository at this point in the history
…ate methods (xabbuh)

This PR was merged into the 4.2 branch.

Discussion
----------

[DoctrineBridge] add parameter type declarations to private methods

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

8157db4 add parameter type declarations to private methods
  • Loading branch information
fabpot committed Jul 27, 2019
2 parents f7e8a96 + 8157db4 commit 5acd99c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
5 changes: 1 addition & 4 deletions src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
Expand Up @@ -129,10 +129,7 @@ public function removeEventListener($events, $listener)
}
}

/**
* @param string $eventName
*/
private function initializeListeners($eventName)
private function initializeListeners(string $eventName)
{
foreach ($this->listeners[$eventName] as $hash => $listener) {
if (\is_string($listener)) {
Expand Down
Expand Up @@ -120,7 +120,7 @@ public function getName()
return 'db';
}

private function sanitizeQueries($connectionName, $queries)
private function sanitizeQueries(string $connectionName, array $queries)
{
foreach ($queries as $i => $query) {
$queries[$i] = $this->sanitizeQuery($connectionName, $query);
Expand All @@ -129,7 +129,7 @@ private function sanitizeQueries($connectionName, $queries)
return $queries;
}

private function sanitizeQuery($connectionName, $query)
private function sanitizeQuery(string $connectionName, $query)
{
$query['explainable'] = true;
if (null === $query['params']) {
Expand Down
Expand Up @@ -109,7 +109,7 @@ private function addTaggedListeners(ContainerBuilder $container)
}
}

private function getEventManagerDef(ContainerBuilder $container, $name)
private function getEventManagerDef(ContainerBuilder $container, string $name)
{
if (!isset($this->eventManagers[$name])) {
$this->eventManagers[$name] = $container->getDefinition(sprintf($this->managerTemplate, $name));
Expand All @@ -128,12 +128,9 @@ private function getEventManagerDef(ContainerBuilder $container, $name)
* @see https://bugs.php.net/bug.php?id=53710
* @see https://bugs.php.net/bug.php?id=60926
*
* @param string $tagName
* @param ContainerBuilder $container
*
* @return array
*/
private function findAndSortTags($tagName, ContainerBuilder $container)
private function findAndSortTags(string $tagName, ContainerBuilder $container)
{
$sortedTags = [];

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php
Expand Up @@ -50,7 +50,7 @@ public function setRepository(EntityManagerInterface $entityManager, $entityName
/**
* @return ObjectRepository
*/
private function createRepository(EntityManagerInterface $entityManager, $entityName)
private function createRepository(EntityManagerInterface $entityManager, string $entityName)
{
/* @var $metadata ClassMetadata */
$metadata = $entityManager->getClassMetadata($entityName);
Expand All @@ -59,7 +59,7 @@ private function createRepository(EntityManagerInterface $entityManager, $entity
return new $repositoryClassName($entityManager, $metadata);
}

private function getRepositoryHash(EntityManagerInterface $entityManager, $entityName)
private function getRepositoryHash(EntityManagerInterface $entityManager, string $entityName)
{
return $entityManager->getClassMetadata($entityName)->getName().spl_object_hash($entityManager);
}
Expand Down

1 comment on commit 5acd99c

@stanislav-reshetnev
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Why return types are not added too?

Please sign in to comment.