Skip to content

Add non regression test for 9706 #4135

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

Merged
merged 1 commit into from
Jul 21, 2025
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
8 changes: 8 additions & 0 deletions tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,14 @@ public function testTraitMixin(): void
$this->analyse([__DIR__ . '/data/trait-mixin.php'], []);
}

public function testBug9706(): void
{
$this->checkThisOnly = false;
$this->checkUnionTypes = true;
$this->checkDynamicProperties = true;
$this->analyse([__DIR__ . '/data/bug-9706.php'], []);
}

#[RequiresPhp('>= 8.4')]
public function testAsymmetricVisibility(): void
{
Expand Down
15 changes: 15 additions & 0 deletions tests/PHPStan/Rules/Properties/data/bug-9706.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php declare(strict_types = 1);

namespace BUg9706;

class MissingDOMNamedNodeMapProperty
{
public function test(): void
{
$node = new \DOMElement('div');
$attributes = $node->attributes;
// According to the php.net docs, $length should be a public read-only property.
// See https://www.php.net/manual/en/class.domnamednodemap.php
$length = $attributes->length;
}
}
Loading