From 9e4fcd44e2f847ca9dfe18067e8d3771dff630cb Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Tue, 21 Jan 2020 08:44:44 +0100 Subject: [PATCH] Drop support for PHP 7.0, PHP 7.1, and PHP 7.2 --- .gitignore | 1 + .travis.yml | 3 --- ChangeLog.md | 7 +++++++ composer.json | 10 +++++++--- phpunit.xml | 11 +++++++---- tests/ExporterTest.php | 42 +++++++++++++++++++----------------------- 6 files changed, 41 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index c79ecfa..61e6e40 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /vendor /.php_cs /.php_cs.cache +/.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml index 48db941..06b0047 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,6 @@ language: php php: - - 7.0 - - 7.1 - - 7.2 - 7.3 - 7.4 diff --git a/ChangeLog.md b/ChangeLog.md index fe55522..79b0a8d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -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 diff --git a/composer.json b/composer.json index 44f0984..37a9936 100644 --- a/composer.json +++ b/composer.json @@ -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" } } } diff --git a/phpunit.xml b/phpunit.xml index 68febeb..ed664e1 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,15 +1,18 @@ - - tests - + + + tests + + diff --git a/tests/ExporterTest.php b/tests/ExporterTest.php index 7fac74c..0da2853 100644 --- a/tests/ExporterTest.php +++ b/tests/ExporterTest.php @@ -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); + } }