[TOOLS] Continue raising PHPStan level to 6

This commit is contained in:
2022-10-19 22:39:17 +01:00
parent c31f3d4997
commit 2fd46ca886
89 changed files with 646 additions and 278 deletions

View File

@@ -93,8 +93,11 @@ class SchemaDefDriver extends StaticPHPDriver implements CompilerPassInterface
/**
* Fill in the database $metadata for $class_name
*
* @param class-string $class_name
* @param ClassMetadataInfo $metadata ClassMetadataInfo is the real type, but we need to override the method
* @param class-string $class_name
*
* @phpstan-ignore-next-line
*
* @param ClassMetadataInfo $metadata ClassMetadataInfo is the real type, but we need to override the method
*/
public function loadMetadataForClass($class_name, ClassMetadata $metadata): void
{
@@ -143,23 +146,23 @@ class SchemaDefDriver extends StaticPHPDriver implements CompilerPassInterface
];
switch ($opts['multiplicity']) {
case 'one to one':
$metadata->mapOneToOne($map);
break;
case 'many to one':
$metadata->mapManyToOne($map);
break;
case 'one to many':
$map['mappedBy'] = $target_field;
$metadata->mapOneToMany($map);
break;
case 'many to many':
$metadata->mapManyToMany($map);
break;
default:
throw new Exception("Invalid multiplicity specified: '${opts['multiplicity']}' in class: {$class_name}");
case 'one to one':
$metadata->mapOneToOne($map);
break;
case 'many to one':
$metadata->mapManyToOne($map);
break;
case 'one to many':
$map['mappedBy'] = $target_field;
$metadata->mapOneToMany($map);
break;
case 'many to many':
$metadata->mapManyToMany($map);
break;
default:
throw new Exception("Invalid multiplicity specified: '${opts['multiplicity']}' in class: {$class_name}");
}
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreEnd
} else {
// Convert old to new types
// For ints, prepend the size (smallint)
@@ -213,6 +216,8 @@ class SchemaDefDriver extends StaticPHPDriver implements CompilerPassInterface
* Override StaticPHPDriver's method,
* we care about classes that have the method `schemaDef`,
* instead of `loadMetadata`.
*
* @param mixed $class_name
*/
public function isTransient($class_name): bool
{