diff --git a/UPGRADE.md b/UPGRADE.md index a082697c879..87164e9c262 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,42 @@ # Upgrade to 3.0 +## BC BREAK: New argument to `NamingStrategy::joinColumnName()` + +### Before + +```php +referenceColumnName(); } diff --git a/lib/Doctrine/ORM/Mapping/NamingStrategy.php b/lib/Doctrine/ORM/Mapping/NamingStrategy.php index 02351caee68..26401cb9e3a 100644 --- a/lib/Doctrine/ORM/Mapping/NamingStrategy.php +++ b/lib/Doctrine/ORM/Mapping/NamingStrategy.php @@ -45,8 +45,10 @@ public function referenceColumnName(): string; /** * Returns a join column name for a property. + * + * @param class-string $className */ - public function joinColumnName(string $propertyName/*, string $className */): string; + public function joinColumnName(string $propertyName, string $className): string; /** * Returns a join table name. diff --git a/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php b/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php index 16c92ee6cd6..eafbafd5f69 100644 --- a/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php +++ b/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php @@ -79,12 +79,7 @@ public function referenceColumnName(): string return $this->case === CASE_UPPER ? 'ID' : 'id'; } - /** - * {@inheritdoc} - * - * @param class-string $className - */ - public function joinColumnName(string $propertyName, ?string $className = null): string + public function joinColumnName(string $propertyName, string $className): string { return $this->underscore($propertyName) . '_' . $this->referenceColumnName(); } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e53c16fbb0b..3fc23468501 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -140,11 +140,6 @@ parameters: count: 1 path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php - - - message: "#^Method Doctrine\\\\ORM\\\\Mapping\\\\NamingStrategy\\:\\:joinColumnName\\(\\) invoked with 2 parameters, 1 required\\.$#" - count: 2 - path: lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php - - message: "#^Negated boolean expression is always false\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index da1dbae4a91..ada29d6089d 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -488,10 +488,6 @@ array_values - - joinColumnName - joinColumnName -