Skip to content

Commit

Permalink
Merge pull request #3 from jaikdean/entity-manager-interface
Browse files Browse the repository at this point in the history
Stub EntityManagerInterface and ObjectManager
  • Loading branch information
weirdan authored Jan 3, 2019
2 parents 30a00e6 + f8b8bfe commit 8156747
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class Plugin implements PluginEntryPointInterface
public function __invoke(RegistrationInterface $psalm, ?SimpleXMLElement $config = null)
{
$psalm->addStubFile(__DIR__ . '/' . 'stubs/Collections.php');
$psalm->addStubFile(__DIR__ . '/' . 'stubs/EntityManager.php');
$psalm->addStubFile(__DIR__ . '/' . 'stubs/EntityManagerInterface.php');
$psalm->addStubFile(__DIR__ . '/' . 'stubs/EntityRepository.php');
$psalm->addStubFile(__DIR__ . '/' . 'stubs/ObjectManager.php');
$psalm->addStubFile(__DIR__ . '/' . 'stubs/Paginator.php');
}
}
10 changes: 1 addition & 9 deletions stubs/EntityManager.php → stubs/EntityManagerInterface.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Doctrine\ORM;

class EntityManager implements EntityManagerInterface
class EntityManagerInterface
{
/**
* @template T
Expand All @@ -11,14 +11,6 @@ class EntityManager implements EntityManagerInterface
*/
public function getRepository(string $entityName) {}

/**
* @template T
* @param class-string $className
* @template-typeof T $className
* @return Mapping\ClassMetadata<T>
*/
public function getClassMetadata(string $className) {}

/**
* @template T
* @param class-string $entityName
Expand Down
29 changes: 29 additions & 0 deletions stubs/ObjectManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
namespace Doctrine\ORM;

class ObjectManager
{
/**
* @template T
* @param class-string $className
* @template-typeof T $className
* @return ObjectRepository<T>
*/
public function getRepository(string $className) {}

/**
* @template T
* @param class-string $className
* @template-typeof T $className
* @return Mapping\ClassMetadata<T>
*/
public function getClassMetadata(string $className) {}

/**
* @template T
* @param class-string $className
* @template-typeof T $className
* @return ?T
*/
public function find(string $className, $id) {}
}

0 comments on commit 8156747

Please sign in to comment.