diff --git a/composer.json b/composer.json index 0a246e44b..e12d440c7 100644 --- a/composer.json +++ b/composer.json @@ -107,26 +107,26 @@ "require-dev": { "codeception/codeception": "^4.0", "codeception/module-asserts": "^1.1", - "codeception/module-cli": "^1.0", - "codeception/module-doctrine2": "^1.0", - "codeception/module-phpbrowser": "^1.0", - "codeception/module-rest": "^1.0", - "ergebnis/composer-normalize": "^2.15", - "filp/whoops": "^2", - "jetbrains/phpstorm-attributes": "^1.0", - "mockery/mockery": "^1.0", - "php-parallel-lint/php-console-highlighter": "^0.5.0", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpstan/phpstan": "0.12.96", - "phpstan/phpstan-doctrine": "^0.12", - "phpunit/php-timer": "^5.0", - "phpunit/phpunit": "^9.2", - "pyrech/composer-changelogs": "^1.7", - "roave/security-advisories": "dev-latest", - "slevomat/coding-standard": "^7", - "softcreatr/jsonpath": "^0.7.2", - "squizlabs/php_codesniffer": "^3.5", - "symfony/var-dumper": "^5.1" + "codeception/module-cli": "^1.0", + "codeception/module-doctrine2": "^1.0", + "codeception/module-phpbrowser": "^1.0", + "codeception/module-rest": "^1.0", + "ergebnis/composer-normalize": "^2.15", + "filp/whoops": "^2", + "jetbrains/phpstorm-attributes": "^1.0", + "mockery/mockery": "^1.0", + "php-parallel-lint/php-console-highlighter": "^0.5.0", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpstan/phpstan": "^1", + "phpstan/phpstan-doctrine": "^1", + "phpunit/php-timer": "^5.0", + "phpunit/phpunit": "^9.2", + "pyrech/composer-changelogs": "^1.7", + "roave/security-advisories": "dev-latest", + "slevomat/coding-standard": "^7", + "softcreatr/jsonpath": "^0.7.2", + "squizlabs/php_codesniffer": "^3.5", + "symfony/var-dumper": "^5.1" }, "config": { "discard-changes": true, diff --git a/composer.lock b/composer.lock index e17cae846..07b18f676 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "601cce81f6dc67d28ef0902a712fb852", + "content-hash": "5ff9d6ce6c6161765b7aaf4dce99fc31", "packages": [ { "name": "aws/aws-crt-php", @@ -11689,16 +11689,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.96", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "a98bdc51318f20fcae8c953d266f81a70254917f" + "reference": "0eb6ecdfbcebf2207668087dfb2e215581a75023" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a98bdc51318f20fcae8c953d266f81a70254917f", - "reference": "a98bdc51318f20fcae8c953d266f81a70254917f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0eb6ecdfbcebf2207668087dfb2e215581a75023", + "reference": "0eb6ecdfbcebf2207668087dfb2e215581a75023", "shasum": "" }, "require": { @@ -11714,7 +11714,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.12-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -11729,7 +11729,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.96" + "source": "https://github.com/phpstan/phpstan/tree/1.0.1" }, "funding": [ { @@ -11749,25 +11749,25 @@ "type": "tidelift" } ], - "time": "2021-08-21T11:55:13+00:00" + "time": "2021-11-02T10:25:31+00:00" }, { "name": "phpstan/phpstan-doctrine", - "version": "0.12.44", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-doctrine.git", - "reference": "5fe9a9b15707d9bc5178fa7cf0899e904d112ccd" + "reference": "ea3919219c4915f4a3896227aaa9e5d3d2034bd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/5fe9a9b15707d9bc5178fa7cf0899e904d112ccd", - "reference": "5fe9a9b15707d9bc5178fa7cf0899e904d112ccd", + "url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/ea3919219c4915f4a3896227aaa9e5d3d2034bd7", + "reference": "ea3919219c4915f4a3896227aaa9e5d3d2034bd7", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^0.12.85" + "phpstan/phpstan": "^1.0" }, "conflict": { "doctrine/collections": "<1.0", @@ -11785,16 +11785,17 @@ "doctrine/orm": "^2.9.1", "doctrine/persistence": "^1.1 || ^2.0", "nesbot/carbon": "^2.49", + "nikic/php-parser": "^4.13.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-phpunit": "^0.12.16", - "phpstan/phpstan-strict-rules": "^0.12.5", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": "^9.5", "ramsey/uuid-doctrine": "^1.5.0" }, "type": "phpstan-extension", "extra": { "branch-alias": { - "dev-master": "0.12-dev" + "dev-master": "1.0-dev" }, "phpstan": { "includes": [ @@ -11815,9 +11816,9 @@ "description": "Doctrine extensions for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-doctrine/issues", - "source": "https://github.com/phpstan/phpstan-doctrine/tree/0.12.44" + "source": "https://github.com/phpstan/phpstan-doctrine/tree/1.0.1" }, - "time": "2021-09-01T06:46:16+00:00" + "time": "2021-11-02T13:28:55+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 000000000..2c7821f49 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,62 @@ +parameters: + ignoreErrors: + - + message: "#^Parameter \\#2 \\$record of method App\\\\Controller\\\\Api\\\\AbstractApiCrudController\\\\:\\:fromArray\\(\\) expects \\(TEntity of App\\\\Entity\\\\StationPlaylist\\|App\\\\Entity\\\\StationStreamer\\)\\|null, \\(TEntity of App\\\\Entity\\\\StationPlaylist\\|App\\\\Entity\\\\StationStreamer\\)\\|null given\\.$#" + count: 1 + path: src/Controller/Api/Stations/AbstractScheduledEntityController.php + + - + message: "#^Parameter \\#3 \\$criteria of method Doctrine\\\\DBAL\\\\Connection\\:\\:update\\(\\) expects array\\, array\\ given\\.$#" + count: 1 + path: src/Entity/Migration/Version20180412055024.php + + - + message: "#^Parameter \\#3 \\$criteria of method Doctrine\\\\DBAL\\\\Connection\\:\\:update\\(\\) expects array\\, array\\ given\\.$#" + count: 1 + path: src/Entity/Migration/Version20180429013130.php + + - + message: "#^Parameter \\#3 \\$criteria of method Doctrine\\\\DBAL\\\\Connection\\:\\:update\\(\\) expects array\\, array\\ given\\.$#" + count: 1 + path: src/Entity/Migration/Version20180818223558.php + + - + message: "#^Parameter \\#3 \\$criteria of method Doctrine\\\\DBAL\\\\Connection\\:\\:update\\(\\) expects array\\, array\\ given\\.$#" + count: 1 + path: src/Entity/Migration/Version20190513163051.php + + - + message: "#^Parameter \\#2 \\$criteria of method Doctrine\\\\DBAL\\\\Connection\\:\\:delete\\(\\) expects array\\, array\\ given\\.$#" + count: 1 + path: src/Entity/Migration/Version20201204043539.php + + - + message: "#^Static property App\\\\Environment\\:\\:\\$instance \\(static\\(App\\\\Environment\\)\\) in isset\\(\\) is not nullable\\.$#" + count: 1 + path: src/Environment.php + + - + message: "#^Cannot cast Symfony\\\\Component\\\\Validator\\\\ConstraintViolationListInterface to string\\.$#" + count: 1 + path: src/Exception/ValidationException.php + + - + message: "#^Static property App\\\\Session\\\\Csrf\\:\\:\\$instance \\(static\\(App\\\\Session\\\\Csrf\\)\\) in isset\\(\\) is not nullable\\.$#" + count: 1 + path: src/Session/Csrf.php + + - + message: "#^Static property App\\\\Session\\\\Flash\\:\\:\\$instance \\(static\\(App\\\\Session\\\\Flash\\)\\) in isset\\(\\) is not nullable\\.$#" + count: 1 + path: src/Session/Flash.php + + - + message: "#^Parameter \\#1 \\$className of method Doctrine\\\\ORM\\\\EntityManagerInterface\\:\\:getRepository\\(\\) expects class\\-string\\, class\\-string\\|false given\\.$#" + count: 1 + path: src/Validator/Constraints/UniqueEntityValidator.php + + - + message: "#^Parameter \\#2 \\$callback of method League\\\\Plates\\\\Engine\\:\\:registerFunction\\(\\) expects League\\\\Plates\\\\callback, Closure given\\.$#" + count: 7 + path: src/View.php + diff --git a/phpstan.neon b/phpstan.neon index 212ae0392..4eb9b357c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,7 @@ +includes: + - phpstan-baseline.neon + - vendor/phpstan/phpstan-doctrine/extension.neon + parameters: level: 8 @@ -16,19 +20,5 @@ parameters: - App\Session\NamespaceInterface - App\View - ignoreErrors: - # Caused by Symfony Validator (perhaps wrongly) returning the interface. - - '#Cannot cast Symfony\\Component\\Validator\\ConstraintViolationListInterface to string.#' - - # Some doctrine migrations fail because of these - - '#Parameter \#3 \$criteria of method Doctrine\\DBAL\\Connection::update\(\) expects array, array given.#' - - '#Parameter \#2 \$criteria of method Doctrine\\DBAL\\Connection::delete\(\) expects array, array given.#' - - # Known upstream issue with Plates template engine - - '#Parameter \#2 \$callback of method League\\Plates\\Engine::registerFunction\(\) expects League\\Plates\\callback, Closure given.#' - parallel: maximumNumberOfProcesses: 1 - -includes: - - vendor/phpstan/phpstan-doctrine/extension.neon diff --git a/src/AppFactory.php b/src/AppFactory.php index 7c98d523d..35eb6be95 100644 --- a/src/AppFactory.php +++ b/src/AppFactory.php @@ -167,10 +167,10 @@ class AppFactory return; } - $errno = $error["type"] ?? E_ERROR; - $errfile = $error["file"] ?? 'unknown'; - $errline = $error["line"] ?? 0; - $errstr = $error["message"] ?? 'Shutdown'; + $errno = $error["type"]; + $errfile = $error["file"]; + $errline = $error["line"]; + $errstr = $error["message"]; if ($errno &= E_PARSE | E_ERROR | E_USER_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) { $logger->critical( diff --git a/src/Controller/Api/Admin/StationsController.php b/src/Controller/Api/Admin/StationsController.php index 11c164c25..e0c0a0bf0 100644 --- a/src/Controller/Api/Admin/StationsController.php +++ b/src/Controller/Api/Admin/StationsController.php @@ -199,9 +199,7 @@ class StationsController extends AbstractAdminApiCrudController $errors = $this->validator->validate($record); if (count($errors) > 0) { - $e = new ValidationException((string)$errors); - $e->setDetailedErrors($errors); - throw $e; + throw ValidationException::fromValidationErrors($errors); } return ($create_mode) diff --git a/src/Controller/Api/Stations/AbstractScheduledEntityController.php b/src/Controller/Api/Stations/AbstractScheduledEntityController.php index d2cdee324..06077b2d1 100644 --- a/src/Controller/Api/Stations/AbstractScheduledEntityController.php +++ b/src/Controller/Api/Stations/AbstractScheduledEntityController.php @@ -63,9 +63,7 @@ abstract class AbstractScheduledEntityController extends AbstractStationApiCrudC $errors = $this->validator->validate($record); if (count($errors) > 0) { - $e = new ValidationException((string)$errors); - $e->setDetailedErrors($errors); - throw $e; + throw ValidationException::fromValidationErrors($errors); } $this->em->persist($record); diff --git a/src/Controller/Api/Stations/Files/ListAction.php b/src/Controller/Api/Stations/Files/ListAction.php index 17c6f55e2..f9632fb21 100644 --- a/src/Controller/Api/Stations/Files/ListAction.php +++ b/src/Controller/Api/Stations/Files/ListAction.php @@ -258,7 +258,7 @@ class ListAction $row->is_dir = $file->isDir(); } else { $row->path = $file; - $row->timestamp = $fs->lastModified($file) ?? 0; + $row->timestamp = $fs->lastModified($file); $row->is_dir = false; } diff --git a/src/Controller/Api/Stations/Files/MakeDirectoryAction.php b/src/Controller/Api/Stations/Files/MakeDirectoryAction.php index 4d684d595..4c8b0da2e 100644 --- a/src/Controller/Api/Stations/Files/MakeDirectoryAction.php +++ b/src/Controller/Api/Stations/Files/MakeDirectoryAction.php @@ -8,8 +8,8 @@ use App\Entity; use App\Flysystem\StationFilesystems; use App\Http\Response; use App\Http\ServerRequest; +use League\Flysystem\UnableToCreateDirectory; use Psr\Http\Message\ResponseInterface; -use SebastianBergmann\CodeCoverage\DirectoryCouldNotBeCreatedException; class MakeDirectoryAction { @@ -33,7 +33,7 @@ class MakeDirectoryAction try { $fsMedia->createDirectory($newDir); - } catch (DirectoryCouldNotBeCreatedException $e) { + } catch (UnableToCreateDirectory $e) { return $response->withStatus(400) ->withJson(new Entity\Api\Error(400, $e->getMessage())); } diff --git a/src/Controller/Api/Stations/FilesController.php b/src/Controller/Api/Stations/FilesController.php index ac876881f..b60575bb1 100644 --- a/src/Controller/Api/Stations/FilesController.php +++ b/src/Controller/Api/Stations/FilesController.php @@ -164,9 +164,7 @@ class FilesController extends AbstractStationApiCrudController // Validate the UploadFile API record. $errors = $this->validator->validate($api_record); if (count($errors) > 0) { - $e = new ValidationException((string)$errors); - $e->setDetailedErrors($errors); - throw $e; + throw ValidationException::fromValidationErrors($errors); } // Write file to temp path. @@ -225,9 +223,7 @@ class FilesController extends AbstractStationApiCrudController $errors = $this->validator->validate($record); if (count($errors) > 0) { - $e = new ValidationException((string)$errors); - $e->setDetailedErrors($errors); - throw $e; + throw ValidationException::fromValidationErrors($errors); } if ($record instanceof Entity\StationMedia) { diff --git a/src/Controller/Frontend/PublicPages/PodcastEpisodesController.php b/src/Controller/Frontend/PublicPages/PodcastEpisodesController.php index 4fb52093b..3aecd7a98 100644 --- a/src/Controller/Frontend/PublicPages/PodcastEpisodesController.php +++ b/src/Controller/Frontend/PublicPages/PodcastEpisodesController.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace App\Controller\Frontend\PublicPages; +use App\Entity\PodcastEpisode; use App\Entity\Repository\PodcastEpisodeRepository; use App\Entity\Repository\PodcastRepository; use App\Exception\PodcastNotFoundException; @@ -45,8 +46,11 @@ class PodcastEpisodesController usort( $publishedEpisodes, static function ($prevEpisode, $nextEpisode) { - $prevPublishedAt = $prevEpisode->getPublishedAt ?? $prevEpisode->getCreatedAt(); - $nextPublishedAt = $nextEpisode->getPublishedAt ?? $nextEpisode->getCreatedAt(); + /** @var PodcastEpisode $prevEpisode */ + /** @var PodcastEpisode $nextEpisode */ + + $prevPublishedAt = $prevEpisode->getPublishAt() ?? $prevEpisode->getCreatedAt(); + $nextPublishedAt = $nextEpisode->getPublishAt() ?? $nextEpisode->getCreatedAt(); return ($nextPublishedAt <=> $prevPublishedAt); } diff --git a/src/Customization.php b/src/Customization.php index d5ac8dded..a412508c8 100644 --- a/src/Customization.php +++ b/src/Customization.php @@ -49,7 +49,7 @@ class Customization if (!empty($queryParams['theme']) && in_array($queryParams['theme'], self::THEMES, true)) { $this->publicTheme = $this->theme = $queryParams['theme']; } else { - $this->publicTheme = $this->settings->getPublicTheme() ?? $this->publicTheme; + $this->publicTheme = $this->settings->getPublicTheme(); if (null !== $this->user && !empty($this->user->getTheme())) { $this->theme = (string)$this->user->getTheme(); diff --git a/src/Doctrine/Event/AuditLog.php b/src/Doctrine/Event/AuditLog.php index db0a8b7ff..d3f024690 100644 --- a/src/Doctrine/Event/AuditLog.php +++ b/src/Doctrine/Event/AuditLog.php @@ -220,7 +220,7 @@ class AuditLog implements EventSubscriber Entity\AuditLog::OPER_INSERT, get_class($owner), $ownerIdentifier, - get_class($entity), + (string)get_class($entity), $entityIdentifier, [] ); @@ -231,7 +231,7 @@ class AuditLog implements EventSubscriber Entity\AuditLog::OPER_DELETE, get_class($owner), $ownerIdentifier, - get_class($entity), + (string)get_class($entity), $entityIdentifier, [] ); diff --git a/src/Entity/Api/Time.php b/src/Entity/Api/Time.php index 56b55c626..83ac6aa26 100644 --- a/src/Entity/Api/Time.php +++ b/src/Entity/Api/Time.php @@ -52,6 +52,6 @@ class Time $this->utc_datetime = $now->format('Y-m-d g:i:s'); $this->utc_date = $now->format('F j, Y'); $this->utc_time = $now->format('g:ia'); - $this->utc_json = $now->toJSON() ?? ''; + $this->utc_json = $now->toJSON(); } } diff --git a/src/Entity/Fixture/Settings.php b/src/Entity/Fixture/Settings.php index ddf254e27..500781d51 100644 --- a/src/Entity/Fixture/Settings.php +++ b/src/Entity/Fixture/Settings.php @@ -17,9 +17,9 @@ class Settings extends AbstractFixture } $settings = new Entity\Settings(); - $settings->setBaseUrl((string)(getenv('INIT_BASE_URL') ?? 'docker.local')); - $settings->setInstanceName((string)(getenv('INIT_INSTANCE_NAME') ?? 'local test')); - $settings->setGeoliteLicenseKey((string)(getenv('INIT_GEOLITE_LICENSE_KEY') ?? '')); + $settings->setBaseUrl((string)(getenv('INIT_BASE_URL') ?: 'docker.local')); + $settings->setInstanceName((string)(getenv('INIT_INSTANCE_NAME') ?: 'local test')); + $settings->setGeoliteLicenseKey((string)(getenv('INIT_GEOLITE_LICENSE_KEY') ?: '')); $settings->setSetupCompleteTime(time()); $settings->setPreferBrowserUrl(true); @@ -28,7 +28,7 @@ class Settings extends AbstractFixture $settings->setExternalIp('127.0.0.1'); $settings->setEnableAdvancedFeatures(true); - $isDemoMode = (!empty(getenv('INIT_DEMO_API_KEY') ?? '')); + $isDemoMode = (!empty(getenv('INIT_DEMO_API_KEY') ?: '')); if ($isDemoMode) { $settings->setAnalytics(Entity\Analytics::LEVEL_NO_IP); $settings->setCheckForUpdates(false); diff --git a/src/Entity/Repository/SettingsRepository.php b/src/Entity/Repository/SettingsRepository.php index 237955832..05c51f7ca 100644 --- a/src/Entity/Repository/SettingsRepository.php +++ b/src/Entity/Repository/SettingsRepository.php @@ -72,9 +72,7 @@ class SettingsRepository extends Repository $errors = $this->validator->validate($settingsObj); if (count($errors) > 0) { - $e = new ValidationException((string)$errors); - $e->setDetailedErrors($errors); - throw $e; + throw ValidationException::fromValidationErrors($errors); } $this->em->persist($settings); diff --git a/src/MessageQueue/QueueManager.php b/src/MessageQueue/QueueManager.php index cbad7cc08..47ac2ca31 100644 --- a/src/MessageQueue/QueueManager.php +++ b/src/MessageQueue/QueueManager.php @@ -21,7 +21,13 @@ class QueueManager extends AbstractQueueManager { $pheanstalk = $this->pheanstalk->useTube($queueName); - while ($job = $pheanstalk->reserve()) { + while ($job = $pheanstalk->peekReady()) { + $pheanstalk->delete($job); + } + while ($job = $pheanstalk->peekBuried()) { + $pheanstalk->delete($job); + } + while ($job = $pheanstalk->peekDelayed()) { $pheanstalk->delete($job); } } diff --git a/src/Normalizer/DoctrineEntityNormalizer.php b/src/Normalizer/DoctrineEntityNormalizer.php index b156cbb3f..4c62510fb 100644 --- a/src/Normalizer/DoctrineEntityNormalizer.php +++ b/src/Normalizer/DoctrineEntityNormalizer.php @@ -62,7 +62,7 @@ class DoctrineEntityNormalizer extends AbstractNormalizer implements NormalizerA return $this->handleCircularReference($object, $format, $context); } - $context[self::CLASS_METADATA] = $this->em->getClassMetadata(get_class($object)); + $context[self::CLASS_METADATA] = $this->em->getClassMetadata((string)get_class($object)); $props = $this->getAllowedAttributes($object, $context); @@ -247,7 +247,7 @@ class DoctrineEntityNormalizer extends AbstractNormalizer implements NormalizerA if (count($prop_val) > 0) { foreach ($prop_val as $val_obj) { if ($form_mode) { - $id_field = $this->em->getClassMetadata(get_class($val_obj))->identifier; + $id_field = $this->em->getClassMetadata((string)get_class($val_obj))->identifier; if ($id_field && count($id_field) === 1) { $return_val[] = $this->getProperty($val_obj, $id_field[0]); diff --git a/src/Radio/AutoDJ.php b/src/Radio/AutoDJ.php index f05f6b008..ac6b34768 100644 --- a/src/Radio/AutoDJ.php +++ b/src/Radio/AutoDJ.php @@ -202,7 +202,7 @@ class AutoDJ $startNext = $station->getBackendConfig()->getCrossfadeDuration(); - $now = $now->addSeconds($duration ?? 1); + $now = $now->addSeconds($duration); return ($duration >= $startNext) ? $now->subMilliseconds((int)($startNext * 1000)) : $now; diff --git a/src/Utilities/File.php b/src/Utilities/File.php index 162f22f0e..5b3ccafea 100644 --- a/src/Utilities/File.php +++ b/src/Utilities/File.php @@ -50,13 +50,13 @@ class File } $str = str_replace(' ', '_', $str); - return mb_strtolower($str) ?? ''; + return mb_strtolower($str); } public static function generateTempPath(string $pattern = ''): string { - $prefix = pathinfo($pattern, PATHINFO_FILENAME) ?? 'temp'; - $extension = pathinfo($pattern, PATHINFO_EXTENSION) ?? 'log'; + $prefix = pathinfo($pattern, PATHINFO_FILENAME) ?: 'temp'; + $extension = pathinfo($pattern, PATHINFO_EXTENSION) ?: 'log'; $tempPath = tempnam(sys_get_temp_dir(), $prefix . '_') . '.' . $extension; touch($tempPath); diff --git a/src/Validator/Constraints/UniqueEntityValidator.php b/src/Validator/Constraints/UniqueEntityValidator.php index 99876d099..864dce3d5 100644 --- a/src/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Validator/Constraints/UniqueEntityValidator.php @@ -72,7 +72,7 @@ class UniqueEntityValidator extends ConstraintValidator return; } - $class = $this->em->getClassMetadata(get_class($value)); + $class = $this->em->getClassMetadata((string)get_class($value)); $criteria = []; $hasNullValue = false;