Skip to content

Commit

Permalink
Merge branch '2.20.x' into 3.3.x
Browse files Browse the repository at this point in the history
* 2.20.x:
  Stop recommending vendor-prefixed PHPDoc (doctrine#11640)
  Let PHPStan detect deprecated usages (doctrine#11639)
  Add upgrade note about property hooks (doctrine#11636)
  Prepare PHP 8.4 support: Prevent property hooks from being used (doctrine#11628)
  Use E_ALL instead of E_ALL | E_STRICT
  Add CI job for PHP 8.4
  fix generating duplicate method stubs
  • Loading branch information
derrabus committed Oct 9, 2024
2 parents 498de4c + d80a831 commit a6093bc
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 8 deletions.
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
4 changes: 4 additions & 0 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,6 +1921,7 @@ public function addInheritedAssociationMapping(AssociationMapping $mapping/*, $o
public function addInheritedFieldMapping(FieldMapping $fieldMapping): void
{
$this->fieldMappings[$fieldMapping->fieldName] = $fieldMapping;
// @phpstan-ignore property.deprecated
$this->columnNames[$fieldMapping->fieldName] = $fieldMapping->columnName;

Check failure on line 1925 in src/Mapping/ClassMetadata.php

View workflow job for this annotation

GitHub Actions / coding-standards / Coding Standards (8.3)

Equals sign not aligned with surrounding assignments; expected 1 space but found 3 spaces
$this->fieldNames[$fieldMapping->columnName] = $fieldMapping->fieldName;

Check failure on line 1926 in src/Mapping/ClassMetadata.php

View workflow job for this annotation

GitHub Actions / coding-standards / Coding Standards (8.3)

Equals sign not aligned with surrounding assignments; expected 1 space but found 3 spaces

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

0 comments on commit a6093bc

Please sign in to comment.