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

Prepare PHP 8.4 support: Prevent property hooks from being used #11628

Merged
merged 4 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
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ parameters:
count: 2
path: src/Mapping/ClassMetadataFactory.php

-
message: "#^Call to an undefined method ReflectionProperty\\:\\:getHooks\\(\\)\\.$#"
count: 1
path: src/Mapping/ClassMetadataInfo.php

-
message: "#^Method Doctrine\\\\ORM\\\\Mapping\\\\NamingStrategy\\:\\:joinColumnName\\(\\) invoked with 2 parameters, 1 required\\.$#"
count: 2
Expand Down
3 changes: 3 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,9 @@
<code><![CDATA[joinColumnName]]></code>
<code><![CDATA[joinColumnName]]></code>
</TooManyArguments>
<UndefinedMethod>
<code><![CDATA[getHooks]]></code>
</UndefinedMethod>
</file>
<file src="src/Mapping/ColumnResult.php">
<MissingConstructor>
Expand Down
4 changes: 4 additions & 0 deletions src/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3890,6 +3890,10 @@
}
}

if (PHP_VERSION_ID >= 80400 && $reflectionProperty !== null && count($reflectionProperty->getHooks()) > 0) {
throw new LogicException('Doctrine ORM does not support property hooks in this version. Check https://github.com/doctrine/orm/issues/11624 for details of versions that support property hooks.');

Check warning on line 3894 in src/Mapping/ClassMetadataInfo.php

View check run for this annotation

Codecov / codecov/patch

src/Mapping/ClassMetadataInfo.php#L3894

Added line #L3894 was not covered by tests
}

return $reflectionProperty;
}
}
Loading