Skip to content

Conversation

@dereuromark
Copy link
Contributor

Summary

When a constructor has all parameters fully typed (including promoted properties), a docblock is redundant since the types are self-documenting.

Problem

This code triggers ConstructDesctructMissingDocBlock:

class HtmlRenderer
{
    public function __construct(protected bool $xhtml = false)
    {
    }
}

Even though the signature is completely self-documenting:

  • Parameter: $xhtml
  • Type: bool
  • Default: false
  • Visibility: protected (promoted property)

Solution

Skip the docblock requirement when all constructor parameters have type hints.

Test cases

Should NOT require docblock (all typed):

public function __construct(protected bool $xhtml = false) {}
public function __construct(string $name, int $age) {}

Should still require docblock (untyped params):

public function __construct($name) {}
public function __construct(string $name, $age) {}

🤖 Generated with Claude Code

When a constructor has all parameters fully typed (including promoted
properties like `public function __construct(protected bool $xhtml = false)`),
a docblock is redundant since the types are self-documenting.

This change skips the ConstructDesctructMissingDocBlock error when all
constructor parameters have type hints.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dereuromark dereuromark marked this pull request as ready for review November 27, 2025 12:19
@dereuromark dereuromark merged commit 0766263 into master Nov 27, 2025
4 checks passed
@dereuromark dereuromark deleted the fix-constructor-docblock-promoted-properties branch November 27, 2025 12:19
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.

2 participants