From 2c6580be863b4c799881146da3db7e010ae898d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 09:44:51 +0000 Subject: [PATCH] build(deps-dev): update phpstan/phpstan-strict-rules requirement Updates the requirements on [phpstan/phpstan-strict-rules](https://github.com/phpstan/phpstan-strict-rules) to permit the latest version. - [Release notes](https://github.com/phpstan/phpstan-strict-rules/releases) - [Commits](https://github.com/phpstan/phpstan-strict-rules/compare/1.5.2...1.6.1) --- updated-dependencies: - dependency-name: phpstan/phpstan-strict-rules dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- src/Entity/Reflection/MetadataParser.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index de174066..0d6ab422 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "phpstan/phpstan-deprecation-rules": "1.2.1", "phpstan/phpstan-nette": "1.3.8", "phpstan/phpstan-mockery": "1.1.3", - "phpstan/phpstan-strict-rules": "1.5.2", + "phpstan/phpstan-strict-rules": "1.6.1", "nextras/multi-query-parser": "~1.0", "nextras/orm-phpstan": "^1.0.1", "tracy/tracy": "~2.3" diff --git a/src/Entity/Reflection/MetadataParser.php b/src/Entity/Reflection/MetadataParser.php index f931814d..1522685d 100644 --- a/src/Entity/Reflection/MetadataParser.php +++ b/src/Entity/Reflection/MetadataParser.php @@ -536,11 +536,12 @@ protected function initPrimaryKey(): void return; } - $primaryKey = array_values(array_filter(array_map(function (PropertyMetadata $metadata): ?string { - return $metadata->isPrimary && !$metadata->isVirtual - ? $metadata->name - : null; - }, $this->metadata->getProperties()))); + $primaryKey = []; + foreach ($this->metadata->getProperties() as $metadata) { + if ($metadata->isPrimary && !$metadata->isVirtual) { + $primaryKey[] = $metadata->name; + } + } if (count($primaryKey) === 0) { throw new InvalidStateException("Entity {$this->reflection->name} does not have defined any primary key.");