Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 596a761

Browse files
committedJun 9, 2025··
Zend/ValidVariableName: add tests for properties with asymmetric visibility
Sniff already behaves as intended. This commit just adds some extra tests to safeguard this for the future.
1 parent deeaf40 commit 596a761

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
 

‎src/Standards/Zend/Tests/NamingConventions/ValidVariableNameUnitTest.inc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,17 @@ enum SomeEnum
129129
$bar_foo = 3;
130130
}
131131
}
132+
133+
class AsymVisibility {
134+
// The read scope is public, but not specified. Enforce the naming conventions anyway.
135+
private(set) $asymPublicImplied = 'hello';
136+
private(set) $_asymPublicImplied = 'hello';
137+
138+
// The read scope is private, so these properties should be handled as private properties.
139+
private private(set) $asymPrivate = 'hello';
140+
private(set) private $_asymPrivate = 'hello';
141+
142+
// The read scope is public/protected, so these properties should be handled as public properties.
143+
protected private(set) $asymProtectedPrivate = 'hello';
144+
private(set) public $_asymPrivatePublic = 'hello';
145+
}

‎src/Standards/Zend/Tests/NamingConventions/ValidVariableNameUnitTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public function getErrorList()
6161
121 => 1,
6262
126 => 1,
6363
129 => 1,
64+
136 => 1,
65+
139 => 1,
66+
143 => 1,
67+
144 => 1,
6468
];
6569

6670
}//end getErrorList()

0 commit comments

Comments
 (0)
Please sign in to comment.