Skip to content

Commit f18856c

Browse files
Closes #5160
1 parent c53383c commit f18856c

File tree

7 files changed

+46
-486
lines changed

7 files changed

+46
-486
lines changed

ChangeLog-9.6.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes of the PHPUnit 9.6 release series are documented in this fil
77
### Fixed
88

99
* [#5073](https://github.com/sebastianbergmann/phpunit/issues/5073): `--no-extensions` CLI option only prevents extension PHARs from being loaded
10+
* [#5160](https://github.com/sebastianbergmann/phpunit/issues/5160): PHPUnit 9.6 misses deprecations for assertions and constraints removed in PHPUnit 10
1011

1112
## [9.6.0] - 2023-02-03
1213

src/Framework/Assert.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,9 +1168,13 @@ public static function assertNan($actual, string $message = ''): void
11681168
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
11691169
* @throws Exception
11701170
* @throws ExpectationFailedException
1171+
*
1172+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
11711173
*/
11721174
public static function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void
11731175
{
1176+
self::createWarning('assertClassHasAttribute() is deprecated and will be removed in PHPUnit 10.');
1177+
11741178
if (!self::isValidClassAttributeName($attributeName)) {
11751179
throw InvalidArgumentException::create(1, 'valid attribute name');
11761180
}
@@ -1188,9 +1192,13 @@ public static function assertClassHasAttribute(string $attributeName, string $cl
11881192
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
11891193
* @throws Exception
11901194
* @throws ExpectationFailedException
1195+
*
1196+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
11911197
*/
11921198
public static function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void
11931199
{
1200+
self::createWarning('assertClassNotHasAttribute() is deprecated and will be removed in PHPUnit 10.');
1201+
11941202
if (!self::isValidClassAttributeName($attributeName)) {
11951203
throw InvalidArgumentException::create(1, 'valid attribute name');
11961204
}
@@ -1214,9 +1222,13 @@ public static function assertClassNotHasAttribute(string $attributeName, string
12141222
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
12151223
* @throws Exception
12161224
* @throws ExpectationFailedException
1225+
*
1226+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
12171227
*/
12181228
public static function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
12191229
{
1230+
self::createWarning('assertClassHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');
1231+
12201232
if (!self::isValidClassAttributeName($attributeName)) {
12211233
throw InvalidArgumentException::create(1, 'valid attribute name');
12221234
}
@@ -1238,9 +1250,13 @@ public static function assertClassHasStaticAttribute(string $attributeName, stri
12381250
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
12391251
* @throws Exception
12401252
* @throws ExpectationFailedException
1253+
*
1254+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
12411255
*/
12421256
public static function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
12431257
{
1258+
self::createWarning('assertClassNotHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');
1259+
12441260
if (!self::isValidClassAttributeName($attributeName)) {
12451261
throw InvalidArgumentException::create(1, 'valid attribute name');
12461262
}
@@ -1266,9 +1282,13 @@ public static function assertClassNotHasStaticAttribute(string $attributeName, s
12661282
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
12671283
* @throws Exception
12681284
* @throws ExpectationFailedException
1285+
*
1286+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
12691287
*/
12701288
public static function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void
12711289
{
1290+
self::createWarning('assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10.');
1291+
12721292
if (!self::isValidObjectAttributeName($attributeName)) {
12731293
throw InvalidArgumentException::create(1, 'valid attribute name');
12741294
}
@@ -1292,9 +1312,13 @@ public static function assertObjectHasAttribute(string $attributeName, $object,
12921312
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
12931313
* @throws Exception
12941314
* @throws ExpectationFailedException
1315+
*
1316+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
12951317
*/
12961318
public static function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void
12971319
{
1320+
self::createWarning('assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit 10.');
1321+
12981322
if (!self::isValidObjectAttributeName($attributeName)) {
12991323
throw InvalidArgumentException::create(1, 'valid attribute name');
13001324
}
@@ -2668,18 +2692,33 @@ public static function greaterThanOrEqual($value): LogicalOr
26682692
);
26692693
}
26702694

2695+
/**
2696+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
2697+
*/
26712698
public static function classHasAttribute(string $attributeName): ClassHasAttribute
26722699
{
2700+
self::createWarning('classHasAttribute() is deprecated and will be removed in PHPUnit 10.');
2701+
26732702
return new ClassHasAttribute($attributeName);
26742703
}
26752704

2705+
/**
2706+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
2707+
*/
26762708
public static function classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute
26772709
{
2710+
self::createWarning('classHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');
2711+
26782712
return new ClassHasStaticAttribute($attributeName);
26792713
}
26802714

2715+
/**
2716+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
2717+
*/
26812718
public static function objectHasAttribute($attributeName): ObjectHasAttribute
26822719
{
2720+
self::createWarning('objectHasAttribute() is deprecated and will be removed in PHPUnit 10.');
2721+
26832722
return new ObjectHasAttribute($attributeName);
26842723
}
26852724

src/Framework/Constraint/Object/ClassHasAttribute.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
/**
2020
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
21+
*
22+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
2123
*/
2224
class ClassHasAttribute extends Constraint
2325
{

src/Framework/Constraint/Object/ClassHasStaticAttribute.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
/**
1818
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
19+
*
20+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
1921
*/
2022
final class ClassHasStaticAttribute extends ClassHasAttribute
2123
{

src/Framework/Constraint/Object/ObjectHasAttribute.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
/**
1515
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
16+
*
17+
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
1618
*/
1719
final class ObjectHasAttribute extends ClassHasAttribute
1820
{

0 commit comments

Comments
 (0)