Skip to content

Commit

Permalink
Bump doctrine/coding-standard 8.x -> 9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ostrolucky committed May 13, 2021
1 parent d6b3c37 commit 7285423
Show file tree
Hide file tree
Showing 40 changed files with 85 additions and 246 deletions.
4 changes: 1 addition & 3 deletions CacheWarmer/DoctrineMetadataCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public function isOptional(): bool
return false;
}

/**
* @param string $cacheDir
*/
/** @param string $cacheDir */
protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter): bool
{
// cache already warmed up, no needs to do it again
Expand Down
4 changes: 1 addition & 3 deletions Command/DoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ protected function getDoctrineConnection($name)
return $this->getDoctrine()->getConnection($name);
}

/**
* @return ManagerRegistry
*/
/** @return ManagerRegistry */
protected function getDoctrine()
{
return $this->doctrine;
Expand Down
4 changes: 1 addition & 3 deletions Command/ImportMappingDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class ImportMappingDoctrineCommand extends DoctrineCommand
/** @var string[] */
private $bundles;

/**
* @param string[] $bundles
*/
/** @param string[] $bundles */
public function __construct(ManagerRegistry $doctrine, array $bundles)
{
parent::__construct($doctrine);
Expand Down
4 changes: 1 addition & 3 deletions Command/Proxy/CollectionRegionDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ protected function configure()
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
}

/**
* @return int
*/
/** @return int */
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
Expand Down
4 changes: 1 addition & 3 deletions Command/Proxy/EntityRegionCacheDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ protected function configure()
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
}

/**
* @return int
*/
/** @return int */
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
Expand Down
4 changes: 1 addition & 3 deletions Command/Proxy/QueryRegionCacheDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ protected function configure()
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
}

/**
* @return int
*/
/** @return int */
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
Expand Down
11 changes: 3 additions & 8 deletions ConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

use const PHP_EOL;

/**
* @psalm-import-type Params from DriverManager
*/
/** @psalm-import-type Params from DriverManager */
class ConnectionFactory
{
/** @var mixed[][] */
Expand All @@ -30,9 +28,7 @@ class ConnectionFactory
/** @var bool */
private $initialized = false;

/**
* @param mixed[][] $typesConfig
*/
/** @param mixed[][] $typesConfig */
public function __construct(array $typesConfig)
{
$this->typesConfig = $typesConfig;
Expand All @@ -43,10 +39,9 @@ public function __construct(array $typesConfig)
*
* @param mixed[] $params
* @param array<string, string> $mappingTypes
* @psalm-param Params $params
*
* @return Connection
*
* @psalm-param Params $params
*/
public function createConnection(array $params, ?Configuration $config = null, ?EventManager $eventManager = null, array $mappingTypes = [])
{
Expand Down
41 changes: 11 additions & 30 deletions DataCollector/DoctrineDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Doctrine\Bundle\DoctrineBundle\DataCollector;

use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Cache\CacheConfiguration;
use Doctrine\ORM\Cache\Logging\CacheLoggerChain;
use Doctrine\ORM\Cache\Logging\StatisticsCacheLogger;
Expand Down Expand Up @@ -29,7 +30,7 @@
* sql: string,
* params: ?array<array-key, mixed>,
* runnable: bool,
* types: ?array<array-key, \Doctrine\DBAL\Types\Type|int|string|null>,
* types: ?array<array-key, Type|int|string|null>,
* }
* @psalm-type DataType = array{
* caches: array{
Expand Down Expand Up @@ -180,75 +181,58 @@ public function collect(Request $request, Response $response, ?Throwable $except
$this->groupedQueries = null;
}

/**
* @return array<string, array<string, string>>
*/
/** @return array<string, array<string, string>> */
public function getEntities()
{
return $this->data['entities'];
}

/**
* @return array<string, array<string, list<string>>>
*/
/** @return array<string, array<string, list<string>>> */
public function getMappingErrors()
{
return $this->data['errors'];
}

/**
* @return int
*/
/** @return int */
public function getCacheHitsCount()
{
return $this->data['caches']['counts']['hits'];
}

/**
* @return int
*/
/** @return int */
public function getCachePutsCount()
{
return $this->data['caches']['counts']['puts'];
}

/**
* @return int
*/
/** @return int */
public function getCacheMissesCount()
{
return $this->data['caches']['counts']['misses'];
}

/**
* @return bool
*/
/** @return bool */
public function getCacheEnabled()
{
return $this->data['caches']['enabled'];
}

/**
* @return array<string, array<string, int>>
*
* @psalm-return array<"puts"|"hits"|"misses", array<string, int>>
*/
public function getCacheRegions()
{
return $this->data['caches']['regions'];
}

/**
* @return array<string, int>
*/
/** @return array<string, int> */
public function getCacheCounts()
{
return $this->data['caches']['counts'];
}

/**
* @return int
*/
/** @return int */
public function getInvalidEntityCount()
{
if ($this->invalidEntityCount === null) {
Expand All @@ -260,7 +244,6 @@ public function getInvalidEntityCount()

/**
* @return string[][]
*
* @psalm-return array<string, list<QueryType&array{count: int, index: int, executionPercent: float}>>
*/
public function getGroupedQueries()
Expand Down Expand Up @@ -316,9 +299,7 @@ private function executionTimePercentage(int $executionTimeMS, int $totalExecuti
return $executionTimeMS / $totalExecutionTimeMS * 100;
}

/**
* @return int
*/
/** @return int */
public function getGroupedQueryCount()
{
$count = 0;
Expand Down
12 changes: 3 additions & 9 deletions Dbal/BlacklistSchemaAssetFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,19 @@

use function in_array;

/**
* @deprecated Implement your own include/exclude mechanism
*/
/** @deprecated Implement your own include/exclude mechanism */
class BlacklistSchemaAssetFilter
{
/** @var string[] */
private $blacklist;

/**
* @param string[] $blacklist
*/
/** @param string[] $blacklist */
public function __construct(array $blacklist)
{
$this->blacklist = $blacklist;
}

/**
* @param string|AbstractAsset $assetName
*/
/** @param string|AbstractAsset $assetName */
public function __invoke($assetName): bool
{
if ($assetName instanceof AbstractAsset) {
Expand Down
4 changes: 1 addition & 3 deletions Dbal/RegexSchemaAssetFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ public function __construct(string $filterExpression)
$this->filterExpression = $filterExpression;
}

/**
* @param string|AbstractAsset $assetName
*/
/** @param string|AbstractAsset $assetName */
public function __invoke($assetName): bool
{
if ($assetName instanceof AbstractAsset) {
Expand Down
8 changes: 2 additions & 6 deletions Dbal/SchemaAssetsFilterManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ class SchemaAssetsFilterManager
/** @var callable[] */
private $schemaAssetFilters;

/**
* @param callable[] $schemaAssetFilters
*/
/** @param callable[] $schemaAssetFilters */
public function __construct(array $schemaAssetFilters)
{
$this->schemaAssetFilters = $schemaAssetFilters;
}

/**
* @param string|AbstractAsset $assetName
*/
/** @param string|AbstractAsset $assetName */
public function __invoke($assetName): bool
{
foreach ($this->schemaAssetFilters as $schemaAssetFilter) {
Expand Down
4 changes: 1 addition & 3 deletions DependencyInjection/Compiler/EntityListenerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ public function process(ContainerBuilder $container)
}
}

/**
* @param array{entity: class-string, event: string} $attributes
*/
/** @param array{entity: class-string, event: string} $attributes */
private function attachToListener(ContainerBuilder $container, string $name, string $class, array $attributes): void
{
$listenerId = sprintf('doctrine.orm.%s_listeners.attach_entity_listeners', $name);
Expand Down
4 changes: 1 addition & 3 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ class Configuration implements ConfigurationInterface
/** @var bool */
private $debug;

/**
* @param bool $debug Whether to use the debug mode
*/
/** @param bool $debug Whether to use the debug mode */
public function __construct(bool $debug)
{
$this->debug = $debug;
Expand Down
4 changes: 1 addition & 3 deletions DependencyInjection/DoctrineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,7 @@ protected function ormLoad(array $config, ContainerBuilder $container)
$container->registerForAutoconfiguration(AbstractIdGenerator::class)
->addTag(IdGeneratorPass::ID_GENERATOR_TAG);

/**
* @see DoctrineBundle::boot()
*/
/** @see DoctrineBundle::boot() */
$container->getDefinition($defaultEntityManagerDefinitionId)
->addTag('container.preload', [
'class' => Autoloader::class,
Expand Down
24 changes: 6 additions & 18 deletions Mapping/ClassMetadataCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,37 @@ class ClassMetadataCollection
/** @var ClassMetadata[] */
private $metadata;

/**
* @param ClassMetadata[] $metadata
*/
/** @param ClassMetadata[] $metadata */
public function __construct(array $metadata)
{
$this->metadata = $metadata;
}

/**
* @return ClassMetadata[]
*/
/** @return ClassMetadata[] */
public function getMetadata()
{
return $this->metadata;
}

/**
* @param string $path
*/
/** @param string $path */
public function setPath($path)
{
$this->path = $path;
}

/**
* @return string
*/
/** @return string */
public function getPath()
{
return $this->path;
}

/**
* @param string $namespace
*/
/** @param string $namespace */
public function setNamespace($namespace)
{
$this->namespace = $namespace;
}

/**
* @return string
*/
/** @return string */
public function getNamespace()
{
return $this->namespace;
Expand Down
Loading

0 comments on commit 7285423

Please sign in to comment.