Skip to content

Commit 0e71305

Browse files
committed
Merge branch 'master' into 4.x
2 parents 91c8726 + 15ce011 commit 0e71305

11 files changed

+59
-5
lines changed

src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.1.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ function moreParamSecond(LogicException $bar, Exception $foo) {
140140
// phpcs:set Generic.CodeAnalysis.UnusedFunctionParameter ignoreTypeHints[]
141141

142142
class ConstructorPropertyPromotionNoContentInMethod {
143-
public function __construct(protected int $id) {}
143+
public function __construct(protected int $id, private(set) $foo) {}
144144
}
145145

146146
class ConstructorPropertyPromotionWithContentInMethod {
147-
public function __construct(protected int $id, $toggle = true) {
147+
public function __construct(protected int $id, private(set) $foo, $toggle = true) {
148148
if ($toggle === true) {
149149
doSomething();
150150
}

src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.1.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class TypedProperties
7575
}
7676

7777
class ConstructorPropertyPromotionWithTypes {
78-
public function __construct(protected Float|Int $x, public ?STRING &$y = 'test', private mixed $z) {}
78+
public function __construct(protected Float|Int $x, public(set) ?STRING &$y = 'test', private mixed $z) {}
7979
}
8080

8181
class ConstructorPropertyPromotionAndNormalParams {

src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.1.inc.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class TypedProperties
7575
}
7676

7777
class ConstructorPropertyPromotionWithTypes {
78-
public function __construct(protected float|int $x, public ?string &$y = 'test', private mixed $z) {}
78+
public function __construct(protected float|int $x, public(set) ?string &$y = 'test', private mixed $z) {}
7979
}
8080

8181
class ConstructorPropertyPromotionAndNormalParams {

src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,11 @@ class SkipOverPHP84FinalProperties {
109109
$a = \null;
110110
$a = \falSe;
111111
$a = \True;
112+
113+
// PHP 8.4 asymmetric visibility
114+
class WithAsym {
115+
private(set) null|true $asym1 = TRUE;
116+
public private(set) ?bool $asym2 = false;
117+
protected(set) false|string|null $asym3 = null;
118+
public protected(set) Type|null|bool $asym4 = true;
119+
}

src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc.fixed

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,11 @@ class SkipOverPHP84FinalProperties {
109109
$a = \NULL;
110110
$a = \FALSE;
111111
$a = \TRUE;
112+
113+
// PHP 8.4 asymmetric visibility
114+
class WithAsym {
115+
private(set) null|true $asym1 = TRUE;
116+
public private(set) ?bool $asym2 = FALSE;
117+
protected(set) false|string|null $asym3 = NULL;
118+
public protected(set) Type|null|bool $asym4 = TRUE;
119+
}

src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public function getErrorList()
5555
109 => 1,
5656
110 => 1,
5757
111 => 1,
58+
116 => 1,
59+
117 => 1,
60+
118 => 1,
5861
];
5962

6063
}//end getErrorList()

src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.1.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class OnlyConstructorPropertyPromotion {
109109

110110
class ConstructorPropertyPromotionMixedWithNormalParams {
111111
public function __construct(
112-
public string $name = '',
112+
public(set) string $name = '',
113113
?int $optionalParam = 0,
114114
mixed $requiredParam,
115115
) {}

src/Standards/Squiz/Tests/NamingConventions/ValidVariableNameUnitTest.1.inc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,17 @@ interface PHP84HookedProperty {
160160
public $thisisfine { get; }
161161
public $_underscore { get; }
162162
}
163+
164+
class AsymVisibility {
165+
// The read scope is public, but not specified. Enforce the naming conventions anyway.
166+
private(set) $asymPublicImplied = 'hello';
167+
private(set) $_asymPublicImplied = 'hello';
168+
169+
// The read scope is private, so these properties should be handled as private properties.
170+
private private(set) $asymPrivate = 'hello';
171+
private(set) private $_asymPrivate = 'hello';
172+
173+
// The read scope is public/protected, so these properties should be handled as public properties.
174+
public private(set) $asymPublicPrivate = 'hello';
175+
private(set) protected $_asymPrivateProtected = 'hello';
176+
}

src/Standards/Squiz/Tests/NamingConventions/ValidVariableNameUnitTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public function getErrorList($testFile='')
7373
152 => 1,
7474
155 => 1,
7575
161 => 1,
76+
167 => 1,
77+
170 => 1,
78+
175 => 1,
7679
];
7780

7881
default:

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,17 @@ interface PHP84HookedProperty {
134134
public $thisisfine { get; }
135135
public $_underscore { get; }
136136
}
137+
138+
class AsymVisibility {
139+
// The read scope is public, but not specified. Enforce the naming conventions anyway.
140+
private(set) $asymPublicImplied = 'hello';
141+
private(set) $_asymPublicImplied = 'hello';
142+
143+
// The read scope is private, so these properties should be handled as private properties.
144+
private private(set) $asymPrivate = 'hello';
145+
private(set) private $_asymPrivate = 'hello';
146+
147+
// The read scope is public/protected, so these properties should be handled as public properties.
148+
protected private(set) $asymProtectedPrivate = 'hello';
149+
private(set) public $_asymPrivatePublic = 'hello';
150+
}

0 commit comments

Comments
 (0)