Drop support for PHP 7.0, PHP 7.1, and PHP 7.2

This commit is contained in:
Sebastian Bergmann 2020-01-21 08:44:44 +01:00
parent e5ce612194
commit 9e4fcd44e2
6 changed files with 41 additions and 33 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/vendor
/.php_cs
/.php_cs.cache
/.phpunit.result.cache

View File

@ -1,9 +1,6 @@
language: php
php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4

View File

@ -2,6 +2,12 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [4.0.0] - 2020-02-07
### Removed
* This component is no longer supported on PHP 7.0, PHP 7.1, and PHP 7.2
## [3.1.2] - 2019-09-14
### Fixed
@ -12,4 +18,5 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* Remove HHVM-specific code that is no longer needed
[4.0.0]: https://github.com/sebastianbergmann/exporter/compare/3.1.2...master
[3.1.2]: https://github.com/sebastianbergmann/exporter/compare/3.1.1...3.1.2

View File

@ -27,16 +27,20 @@
}
],
"config": {
"platform": {
"php": "7.3.0"
},
"optimize-autoloader": true,
"sort-packages": true
},
"prefer-stable": true,
"minimum-stability": "dev",
"require": {
"php": "^7.0",
"php": "^7.3",
"sebastian/recursion-context": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"phpunit/phpunit": "^9.0",
"ext-mbstring": "*"
},
"autoload": {
@ -46,7 +50,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.1.x-dev"
"dev-master": "4.0-dev"
}
}
}

View File

@ -1,15 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.0/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.0/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true">
<testsuite>
<directory suffix="Test.php">tests</directory>
</testsuite>
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">

View File

@ -22,12 +22,12 @@ class ExporterTest extends TestCase
*/
private $exporter;
protected function setUp()
protected function setUp(): void
{
$this->exporter = new Exporter;
}
public function exportProvider()
public function exportProvider(): array
{
$obj2 = new \stdClass;
$obj2->foo = 'bar';
@ -201,7 +201,7 @@ EOF
/**
* @dataProvider exportProvider
*/
public function testExport($value, $expected)
public function testExport($value, $expected): void
{
$this->assertStringMatchesFormat(
$expected,
@ -209,12 +209,8 @@ EOF
);
}
public function testExport2()
public function testExport2(): void
{
if (\PHP_VERSION === '5.3.3') {
$this->markTestSkipped('Skipped due to "Nesting level too deep - recursive dependency?" fatal error');
}
$obj = new \stdClass;
$obj->foo = 'bar';
@ -293,7 +289,7 @@ EOF;
);
}
public function shortenedExportProvider()
public function shortenedExportProvider(): array
{
$obj = new \stdClass;
$obj->foo = 'bar';
@ -321,7 +317,7 @@ EOF;
/**
* @dataProvider shortenedExportProvider
*/
public function testShortenedExport($value, $expected)
public function testShortenedExport($value, $expected): void
{
$this->assertSame(
$expected,
@ -332,7 +328,7 @@ EOF;
/**
* @requires extension mbstring
*/
public function testShortenedExportForMultibyteCharacters()
public function testShortenedExportForMultibyteCharacters(): void
{
$oldMbLanguage = \mb_language();
\mb_language('Japanese');
@ -355,7 +351,7 @@ EOF;
\mb_language($oldMbLanguage);
}
public function provideNonBinaryMultibyteStrings()
public function provideNonBinaryMultibyteStrings(): array
{
return [
[\implode('', \array_map('chr', \range(0x09, 0x0d))), 9],
@ -367,7 +363,7 @@ EOF;
/**
* @dataProvider provideNonBinaryMultibyteStrings
*/
public function testNonBinaryStringExport($value, $expectedLength)
public function testNonBinaryStringExport($value, $expectedLength): void
{
$this->assertRegExp(
"~'.{{$expectedLength}}'\$~s",
@ -375,12 +371,12 @@ EOF;
);
}
public function testNonObjectCanBeReturnedAsArray()
public function testNonObjectCanBeReturnedAsArray(): void
{
$this->assertEquals([true], $this->exporter->toArray(true));
}
public function testIgnoreKeysInValue()
public function testIgnoreKeysInValue(): void
{
// Find out what the actual use case was with the PHP bug
$array = [];
@ -389,20 +385,15 @@ EOF;
$this->assertEquals([], $this->exporter->toArray((object) $array));
}
private function trimNewline($string)
{
return \preg_replace('/[ ]*\n/', "\n", $string);
}
/**
* @dataProvider shortenedRecursiveExportProvider
*/
public function testShortenedRecursiveExport(array $value, string $expected)
public function testShortenedRecursiveExport(array $value, string $expected): void
{
$this->assertEquals($expected, $this->exporter->shortenedRecursiveExport($value));
}
public function shortenedRecursiveExportProvider()
public function shortenedRecursiveExportProvider(): array
{
return [
'export null' => [[null], 'null'],
@ -419,7 +410,7 @@ EOF;
];
}
public function testShortenedRecursiveOccurredRecursion()
public function testShortenedRecursiveOccurredRecursion(): void
{
$recursiveValue = [1];
$context = new Context();
@ -429,4 +420,9 @@ EOF;
$this->assertEquals('*RECURSION*', $this->exporter->shortenedRecursiveExport($value, $context));
}
private function trimNewline(string $string): string
{
return \preg_replace('/[ ]*\n/', "\n", $string);
}
}