NovikovViktor/RequestLimitBundle

View on GitHub

Showing 102 of 102 total issues

Call to method load from undeclared class \Symfony\Component\DependencyInjection\Loader\XmlFileLoader
Open

        $loader->load('services.xml');

Call to undeclared method \NW\RequestLimitBundle\DependencyInjection\NWRequestLimitExtension::processConfiguration
Open

        $config = $this->processConfiguration($configuration, $configs);

Call to method fetchAll from undeclared class \Memcached
Open

        return $this->_memcached->fetchAll();
Severity: Critical
Found in Storage/Provider/MemcachedProvider.php by phan

Property \NW\RequestLimitBundle\Storage\Provider\MySQLProvider->_em has undeclared type \Doctrine\ORM\EntityManager
Open

    private $_em;
Severity: Minor
Found in Storage/Provider/MySQLProvider.php by phan

Call to method getConnection from undeclared class \Doctrine\ORM\EntityManager
Open

        $connection = $this->_em->getConnection();
Severity: Critical
Found in Storage/Provider/MySQLProvider.php by phan

@throws type of remove has undeclared type \Doctrine\DBAL\Exception (Did you mean class \Exception)
Open

    public function remove($key)
Severity: Minor
Found in Storage/Provider/MySQLProvider.php by phan

@throws type of getItemsCount has undeclared type \Doctrine\DBAL\Driver\Exception (Did you mean class \Exception)
Open

    public function getItemsCount()
Severity: Minor
Found in Storage/Provider/MySQLProvider.php by phan

Call to method getConnection from undeclared class \Doctrine\ORM\EntityManager
Open

        $connection = $this->_em->getConnection();
Severity: Critical
Found in Storage/Provider/MySQLProvider.php by phan

Parameter $request has undeclared type \Symfony\Component\HttpFoundation\Request
Open

    public function collect(Request $request, Response $response, \Exception $exception = null)

Parameter $container has undeclared type \Symfony\Component\DependencyInjection\ContainerBuilder
Open

    public function process(ContainerBuilder $container)

Call to method getParameter from undeclared class \Symfony\Component\DependencyInjection\ContainerBuilder
Open

        $providerConfiguration   = $container->getParameter('nw_request_limit.provider_configuration');

Call to method getDefinition from undeclared class \Symfony\Component\DependencyInjection\ContainerBuilder
Open

        $providerDefinition = $container->getDefinition($providerTypeServiceName);

Call to undeclared method \NW\RequestLimitBundle\Tests\Unit\Utils\RestrictorTest::setExpectedException
Open

        $this->setExpectedException(RequestLimitReachedException::class);
Severity: Critical
Found in Tests/Unit/Utils/RestrictorTest.php by phan

Possibly zero references to use statement for classlike/namespace Connection (\Doctrine\DBAL\Connection)
Open

use Doctrine\DBAL\Connection;
Severity: Minor
Found in Command/MySQLProviderSetupCommand.php by phan

Class implements undeclared interface \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface
Open

class StoragePass implements CompilerPassInterface

Call to undeclared method \AppKernel::getEnvironment
Open

        if (in_array($this->getEnvironment(), ['test'])) {
Severity: Critical
Found in Tests/AppKernel.php by phan

Define a constant instead of duplicating this literal "item_key" 3 times.
Open

        $statement->bindValue('item_key', $key);
Severity: Critical
Found in Storage/Provider/MySQLProvider.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Return type of getConfigTreeBuilder() is undeclared type \Symfony\Component\Config\Definition\Builder\TreeBuilder
Open

    public function getConfigTreeBuilder()
Severity: Minor
Found in DependencyInjection/Configuration.php by phan

Parameter $container has undeclared type \Symfony\Component\DependencyInjection\ContainerBuilder
Open

    public function load(array $configs, ContainerBuilder $container)

Reference to undeclared class \Symfony\Component\HttpKernel\Bundle\Bundle
Open

        parent::build($container);
Severity: Critical
Found in NWRequestLimitBundle.php by phan
Severity
Category
Status
Source
Language