Skip to content

Commit

Permalink
Refactor for Symfony 7
Browse files Browse the repository at this point in the history
  • Loading branch information
michal.dzierzbicki committed May 16, 2024
1 parent e4489c6 commit 46b6783
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
;

return (new PhpCsFixer\Config())
->setParallelConfig(\PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRules([
'@Symfony' => true,
'concat_space' => false,
Expand Down
30 changes: 23 additions & 7 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters:
level: 6
paths:
- bin/
- config/
- public/
- src/
- tests/
level: 8
excludePaths:
- Tests/_*/
- Tests/Support/
- src/Model/
ignoreErrors:
-
message: '#Call to an undefined method App\\Tests\\Support\\IntegrationTester::#'
reportUnmatched: false
-
message: '#Call to an undefined method App\\Tests\\Support\\ApiTester::#'
reportUnmatched: false
-
message: '#Call to an undefined method App\\Tests\\Support\\ApiTester::#'
reportUnmatched: false
-
message: '#Call to an undefined method App\\Tests\\Support\\UnitTester::#'
reportUnmatched: false
-
message: '#Call to an undefined method App\\Tests\\Support\\UnitTester::#'
reportUnmatched: false
7 changes: 5 additions & 2 deletions src/Purger/AbstractPurger.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ public function setEntityManager(EntityManagerInterface $em): void
}

/**
* @param class-string<object> $className
* @template T of object
*
* @param class-string<T> $className
*/
protected function truncate(string $className): void
{
/** @var ClassMetadata $cmd */
/** @var ClassMetadata<T> $cmd */
$cmd = $this->em->getClassMetadata($className);

$this->truncateTable($cmd->getTableName());
Expand All @@ -44,6 +46,7 @@ protected function truncateTable(string $table): void
$dbPlatform = $connection->getDatabasePlatform();

$connection->executeQuery('SET FOREIGN_KEY_CHECKS=0');
/** @var literal-string $q */
$q = $dbPlatform->getTruncateTableSql($table);
$connection->executeStatement($q);
$connection->executeQuery('SET FOREIGN_KEY_CHECKS=1');
Expand Down

0 comments on commit 46b6783

Please sign in to comment.