Skip to content

Commit

Permalink
Closes #5160
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Feb 3, 2023
1 parent c53383c commit f18856c
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 486 deletions.
1 change: 1 addition & 0 deletions ChangeLog-9.6.md
Expand Up @@ -7,6 +7,7 @@ All notable changes of the PHPUnit 9.6 release series are documented in this fil
### Fixed

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

## [9.6.0] - 2023-02-03

Expand Down
39 changes: 39 additions & 0 deletions src/Framework/Assert.php
Expand Up @@ -1168,9 +1168,13 @@ public static function assertNan($actual, string $message = ''): void
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
* @throws Exception
* @throws ExpectationFailedException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
public static function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void
{
self::createWarning('assertClassHasAttribute() is deprecated and will be removed in PHPUnit 10.');

if (!self::isValidClassAttributeName($attributeName)) {
throw InvalidArgumentException::create(1, 'valid attribute name');
}
Expand All @@ -1188,9 +1192,13 @@ public static function assertClassHasAttribute(string $attributeName, string $cl
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
* @throws Exception
* @throws ExpectationFailedException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
public static function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void
{
self::createWarning('assertClassNotHasAttribute() is deprecated and will be removed in PHPUnit 10.');

if (!self::isValidClassAttributeName($attributeName)) {
throw InvalidArgumentException::create(1, 'valid attribute name');
}
Expand All @@ -1214,9 +1222,13 @@ public static function assertClassNotHasAttribute(string $attributeName, string
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
* @throws Exception
* @throws ExpectationFailedException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
public static function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
{
self::createWarning('assertClassHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');

if (!self::isValidClassAttributeName($attributeName)) {
throw InvalidArgumentException::create(1, 'valid attribute name');
}
Expand All @@ -1238,9 +1250,13 @@ public static function assertClassHasStaticAttribute(string $attributeName, stri
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
* @throws Exception
* @throws ExpectationFailedException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
public static function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
{
self::createWarning('assertClassNotHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');

if (!self::isValidClassAttributeName($attributeName)) {
throw InvalidArgumentException::create(1, 'valid attribute name');
}
Expand All @@ -1266,9 +1282,13 @@ public static function assertClassNotHasStaticAttribute(string $attributeName, s
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
* @throws Exception
* @throws ExpectationFailedException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
public static function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void
{
self::createWarning('assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10.');

if (!self::isValidObjectAttributeName($attributeName)) {
throw InvalidArgumentException::create(1, 'valid attribute name');
}
Expand All @@ -1292,9 +1312,13 @@ public static function assertObjectHasAttribute(string $attributeName, $object,
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
* @throws Exception
* @throws ExpectationFailedException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
public static function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void
{
self::createWarning('assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit 10.');

if (!self::isValidObjectAttributeName($attributeName)) {
throw InvalidArgumentException::create(1, 'valid attribute name');
}
Expand Down Expand Up @@ -2668,18 +2692,33 @@ public static function greaterThanOrEqual($value): LogicalOr
);
}

/**
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
public static function classHasAttribute(string $attributeName): ClassHasAttribute
{
self::createWarning('classHasAttribute() is deprecated and will be removed in PHPUnit 10.');

return new ClassHasAttribute($attributeName);
}

/**
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
public static function classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute
{
self::createWarning('classHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');

return new ClassHasStaticAttribute($attributeName);
}

/**
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
public static function objectHasAttribute($attributeName): ObjectHasAttribute
{
self::createWarning('objectHasAttribute() is deprecated and will be removed in PHPUnit 10.');

return new ObjectHasAttribute($attributeName);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Framework/Constraint/Object/ClassHasAttribute.php
Expand Up @@ -18,6 +18,8 @@

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
class ClassHasAttribute extends Constraint
{
Expand Down
2 changes: 2 additions & 0 deletions src/Framework/Constraint/Object/ClassHasStaticAttribute.php
Expand Up @@ -16,6 +16,8 @@

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
final class ClassHasStaticAttribute extends ClassHasAttribute
{
Expand Down
2 changes: 2 additions & 0 deletions src/Framework/Constraint/Object/ObjectHasAttribute.php
Expand Up @@ -13,6 +13,8 @@

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
*/
final class ObjectHasAttribute extends ClassHasAttribute
{
Expand Down

0 comments on commit f18856c

Please sign in to comment.