Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 2.20.x into 3.3.x #11645

Merged
merged 13 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
dbal-version:
- "default"
- "3.7"
Expand Down Expand Up @@ -107,6 +108,7 @@ jobs:
php-version:
- "8.2"
- "8.3"
- "8.4"
dbal-version:
- "default"
- "3.7"
Expand Down Expand Up @@ -180,6 +182,7 @@ jobs:
php-version:
- "8.2"
- "8.3"
- "8.4"
dbal-version:
- "default"
- "3.7"
Expand Down Expand Up @@ -246,6 +249,7 @@ jobs:
php-version:
- "8.2"
- "8.3"
- "8.4"
dbal-version:
- "default"
- "3.7"
Expand Down
8 changes: 8 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,14 @@ Use `toIterable()` instead.

# Upgrade to 2.20

## Explictly forbid property hooks

Property hooks are not supported yet by Doctrine ORM. Until support is added,
they are explicitly forbidden because the support would result in a breaking
change in behavior.

Progress on this is tracked at https://github.com/doctrine/orm/issues/11624 .

## PARTIAL DQL syntax is undeprecated for non-object hydration

Use of the PARTIAL keyword is not deprecated anymore in DQL when used with a hydrator
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
},
"sort-packages": true
},
Expand All @@ -39,7 +40,9 @@
"doctrine/coding-standard": "^12.0",
"phpbench/phpbench": "^1.0",
"phpdocumentor/guides-cli": "^1.4",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "1.12.6",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpunit/phpunit": "^10.4.0",
"psr/log": "^1 || ^2 || ^3",
"squizlabs/php_codesniffer": "3.7.2",
Expand Down
9 changes: 4 additions & 5 deletions docs/en/reference/metadata-drivers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ implements the ``MappingDriver`` interface:
/**
* Loads the metadata for the specified class into the provided container.
*
* @psalm-param class-string<T> $className
* @psalm-param ClassMetadata<T> $metadata
* @param class-string<T> $className
* @param ClassMetadata<T> $metadata
*
* @return void
*
Expand All @@ -82,16 +82,15 @@ implements the ``MappingDriver`` interface:
/**
* Gets the names of all mapped classes known to this driver.
*
* @return array<int, string> The names of all mapped classes known to this driver.
* @psalm-return list<class-string>
* @return list<class-string> The names of all mapped classes known to this driver.
*/
public function getAllClassNames();

/**
* Returns whether the class with the specified name should have its metadata loaded.
* This is only the case if it is either mapped as an Entity or a MappedSuperclass.
*
* @psalm-param class-string $className
* @param class-string $className
*
* @return bool
*/
Expand Down
7 changes: 7 additions & 0 deletions phpstan-dbal3.neon
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ parameters:
message: '#Negated boolean expression is always false\.#'
paths:
- src/Mapping/Driver/AttributeDriver.php

-
message: '~^Call to deprecated method getEventManager\(\) of class Doctrine\\DBAL\\Connection\.$~'
path: src/EntityManager.php
-
message: '~deprecated class Doctrine\\DBAL\\Tools\\Console\\Command\\ReservedWordsCommand\:~'
path: src/Tools/Console/ConsoleRunner.php
8 changes: 6 additions & 2 deletions src/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,7 @@ public function isNullable(string $fieldName): bool
*/
public function getColumnName(string $fieldName): string
{
// @phpstan-ignore property.deprecated
return $this->columnNames[$fieldName] ?? $fieldName;
}

Expand Down Expand Up @@ -1188,6 +1189,7 @@ protected function validateAndCompleteFieldMapping(array $mapping): FieldMapping
$mapping->quoted = true;
}

// @phpstan-ignore property.deprecated
$this->columnNames[$mapping->fieldName] = $mapping->columnName;

if (isset($this->fieldNames[$mapping->columnName]) || ($this->discriminatorColumn && $this->discriminatorColumn->name === $mapping->columnName)) {
Expand Down Expand Up @@ -1768,6 +1770,7 @@ public function setAttributeOverride(string $fieldName, array $overrideMapping):

unset($this->fieldMappings[$fieldName]);
unset($this->fieldNames[$mapping->columnName]);
// @phpstan-ignore property.deprecated
unset($this->columnNames[$mapping->fieldName]);

$overrideMapping = $this->validateAndCompleteFieldMapping($overrideMapping);
Expand Down Expand Up @@ -1918,8 +1921,9 @@ public function addInheritedAssociationMapping(AssociationMapping $mapping/*, $o
public function addInheritedFieldMapping(FieldMapping $fieldMapping): void
{
$this->fieldMappings[$fieldMapping->fieldName] = $fieldMapping;
$this->columnNames[$fieldMapping->fieldName] = $fieldMapping->columnName;
$this->fieldNames[$fieldMapping->columnName] = $fieldMapping->fieldName;
// @phpstan-ignore property.deprecated
$this->columnNames[$fieldMapping->fieldName] = $fieldMapping->columnName;
$this->fieldNames[$fieldMapping->columnName] = $fieldMapping->fieldName;

if (isset($fieldMapping->generated)) {
$this->requiresFetchAfterChange = true;
Expand Down
2 changes: 2 additions & 0 deletions src/Mapping/Driver/XmlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad
/** @psalm-suppress DeprecatedConstant */
$orderBy[(string) $orderByField['name']] = isset($orderByField['direction'])
? (string) $orderByField['direction']
// @phpstan-ignore classConstant.deprecated
: (enum_exists(Order::class) ? Order::Ascending->value : Criteria::ASC);
}

Expand Down Expand Up @@ -540,6 +541,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad
/** @psalm-suppress DeprecatedConstant */
$orderBy[(string) $orderByField['name']] = isset($orderByField['direction'])
? (string) $orderByField['direction']
// @phpstan-ignore classConstant.deprecated
: (enum_exists(Order::class) ? Order::Ascending->value : Criteria::ASC);
}

Expand Down
2 changes: 2 additions & 0 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ private function findRootAlias(string $alias, string $parentAlias): string
} else {
// Should never happen with correct joining order. Might be
// thoughtful to throw exception instead.
// @phpstan-ignore method.deprecated
$rootAlias = $this->getRootAlias();
}

Expand Down Expand Up @@ -583,6 +584,7 @@ public function add(string $dqlPartName, string|object|array $dqlPart, bool $app
$newDqlPart = [];

foreach ($dqlPart as $k => $v) {
// @phpstan-ignore method.deprecated
$k = is_numeric($k) ? $this->getRootAlias() : $k;

$newDqlPart[$k] = $v;
Expand Down
3 changes: 1 addition & 2 deletions tests/Tests/TestInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
use function mkdir;

use const E_ALL;
use const E_STRICT;

error_reporting(E_ALL | E_STRICT);
error_reporting(E_ALL);
date_default_timezone_set('UTC');

if (file_exists(__DIR__ . '/../../vendor/autoload.php')) {
Expand Down
Loading