mirror of
https://github.com/danog/psalm-plugin-symfony.git
synced 2024-12-02 17:37:52 +01:00
55 lines
1.5 KiB
Gherkin
55 lines
1.5 KiB
Gherkin
Feature: RepositoryStringShortcut
|
|
In order to follow best practices for Symfony
|
|
As a Psalm user
|
|
I need Psalm to check preferred repository syntax
|
|
|
|
Background:
|
|
Given I have the following config
|
|
"""
|
|
<?xml version="1.0"?>
|
|
<psalm totallyTyped="true">
|
|
<projectFiles>
|
|
<directory name="."/>
|
|
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>
|
|
</projectFiles>
|
|
|
|
<issueHandlers>
|
|
<UndefinedClass errorLevel="info" />
|
|
</issueHandlers>
|
|
|
|
<plugins>
|
|
<pluginClass class="Seferov\SymfonyPsalmPlugin\Plugin"/>
|
|
</plugins>
|
|
</psalm>
|
|
"""
|
|
|
|
Scenario: Asserting using 'AppBundle:Entity' syntax raises issue
|
|
Given I have the following code
|
|
"""
|
|
<?php
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
class SomeService
|
|
{
|
|
public function __construct(EntityManagerInterface $entityManager)
|
|
{
|
|
$entityManager->getRepository('AppBundle:Entity');
|
|
}
|
|
}
|
|
|
|
namespace Doctrine\ORM;
|
|
interface EntityManagerInterface
|
|
{
|
|
/**
|
|
* @param string $className
|
|
*
|
|
* @return void
|
|
*/
|
|
public function getRepository($className);
|
|
}
|
|
"""
|
|
When I run Psalm
|
|
Then I see these errors
|
|
| Type | Message |
|
|
| RepositoryStringShortcut | Use Entity::class syntax instead |
|
|
And I see no other errors
|