Skip to content

Fix for bug #9654: Unsafe use of new static when trait enforces constructor via abstract method#2767

Closed
maurice2k wants to merge 1 commit intophpstan:1.10.xfrom
maurice2k:maurice/fix-unsafe-static-in-trait-9654
Closed

Fix for bug #9654: Unsafe use of new static when trait enforces constructor via abstract method#2767
maurice2k wants to merge 1 commit intophpstan:1.10.xfrom
maurice2k:maurice/fix-unsafe-static-in-trait-9654

Conversation

@maurice2k
Copy link
Copy Markdown

@maurice2k maurice2k commented Nov 22, 2023

@maurice2k maurice2k marked this pull request as ready for review November 22, 2023 16:20
@phpstan-bot
Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

if ($traitReflection->hasConstructor()) {
$traitConstructor = $traitReflection->getConstructor();

if ($traitConstructor instanceof PhpMethodReflection) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs to error before PHP 8.0: https://3v4l.org/cOUYD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants