diff --git a/ChangeLog-8.0.md b/ChangeLog-8.0.md index 1f9ebec4b35..07495abae5e 100644 --- a/ChangeLog-8.0.md +++ b/ChangeLog-8.0.md @@ -8,6 +8,7 @@ All notable changes of the PHPUnit 8.0 release series are documented in this fil * Implemented [#3288](https://github.com/sebastianbergmann/phpunit/issues/3288): The `void_return` fixer of php-cs-fixer is now in effect * Implemented [#3341](https://github.com/sebastianbergmann/phpunit/issues/3341): Deprecate optional parameters of `assertEquals()` and `assertNotEquals()` +* Implemented [#3369](https://github.com/sebastianbergmann/phpunit/issues/3369): Deprecate `assertInternalType()` and `assertNotInternalType()` ### Removed diff --git a/src/Framework/Assert.php b/src/Framework/Assert.php index 3c80c1a54fb..1f460e3497f 100644 --- a/src/Framework/Assert.php +++ b/src/Framework/Assert.php @@ -1581,6 +1581,8 @@ public static function assertAttributeNotInstanceOf(string $expected, string $at */ public static function assertInternalType(string $expected, $actual, string $message = ''): void { + self::createWarning('assertInternalType() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertIsArray(), assertIsBool(), assertIsFloat(), assertIsInt(), assertIsNumeric(), assertIsObject(), assertIsResource(), assertIsString(), assertIsScalar(), assertIsCallable(), or assertIsIterable() instead.'); + static::assertThat( $actual, new IsType($expected), @@ -1749,6 +1751,8 @@ public static function assertIsIterable($actual, string $message = ''): void */ public static function assertNotInternalType(string $expected, $actual, string $message = ''): void { + self::createWarning('assertNotInternalType() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertIsNotArray(), assertIsNotBool(), assertIsNotFloat(), assertIsNotInt(), assertIsNotNumeric(), assertIsNotObject(), assertIsNotResource(), assertIsNotString(), assertIsNotScalar(), assertIsNotCallable(), or assertIsNotIterable() instead.'); + static::assertThat( $actual, new LogicalNot( diff --git a/tests/unit/Framework/AssertTest.php b/tests/unit/Framework/AssertTest.php index f717d64f142..b71bec3ab76 100644 --- a/tests/unit/Framework/AssertTest.php +++ b/tests/unit/Framework/AssertTest.php @@ -2431,24 +2431,6 @@ public function testAssertAttributeNotInstanceOf(): void $this->assertAttributeNotInstanceOf(\Exception::class, 'a', $o); } - public function testAssertInternalType(): void - { - $this->assertInternalType('integer', 1); - - $this->expectException(AssertionFailedError::class); - - $this->assertInternalType('string', 1); - } - - public function testAssertInternalTypeDouble(): void - { - $this->assertInternalType('double', 1.0); - - $this->expectException(AssertionFailedError::class); - - $this->assertInternalType('double', 1); - } - public function testAssertAttributeInternalType(): void { $o = new \stdClass; @@ -2457,15 +2439,6 @@ public function testAssertAttributeInternalType(): void $this->assertAttributeInternalType('integer', 'a', $o); } - public function testAssertNotInternalType(): void - { - $this->assertNotInternalType('string', 1); - - $this->expectException(AssertionFailedError::class); - - $this->assertNotInternalType('integer', 1); - } - public function testAssertAttributeNotInternalType(): void { $o = new \stdClass;