Skip to content

Commit

Permalink
Merge pull request #27 from localheinz/fix/php71
Browse files Browse the repository at this point in the history
Fix: Require PHP 7.1
  • Loading branch information
localheinz authored Jan 27, 2018
2 parents b51671d + 844f97c commit 12c6623
Show file tree
Hide file tree
Showing 19 changed files with 47 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the LICENSE file that was distributed with this source code.
@see https://github.com/localheinz/json-normalizer
EOF;

$config = Config\Factory::fromRuleSet(new Config\RuleSet\Php70($header), [
$config = Config\Factory::fromRuleSet(new Config\RuleSet\Php71($header), [
'mb_str_functions' => false,
]);

Expand Down
22 changes: 2 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
include:
- stage: Style

php: 7.0
php: 7.1

before_install:
- source .travis/xdebug.sh
Expand All @@ -40,7 +40,7 @@ jobs:

stage: Test

php: 7.0
php: 7.1

env: WITH_LOWEST=true

Expand All @@ -63,24 +63,6 @@ jobs:
after_success:
- if [[ "$WITH_COVERAGE" == "true" ]]; then bash <(curl -s https://codecov.io/bash); fi

- <<: *TEST

php: 7.0

env: WITH_LOCKED=true

- <<: *TEST

php: 7.0

env: WITH_HIGHEST=true

- <<: *TEST

php: 7.1

env: WITH_LOWEST=true

- <<: *TEST

php: 7.1
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"php": "^7.0",
"php": "^7.1",
"justinrainbow/json-schema": "^4.0.0 || ^5.0.0",
"localheinz/json-printer": "^1.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions test/Bench/SchemaNormalizerBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class SchemaNormalizerBench
* @Revs(5)
* @Iterations(1)
*/
public function benchNormalizeProjectComposerFile()
public function benchNormalizeProjectComposerFile(): void
{
$this->normalize(
__DIR__ . '/../../composer.json',
Expand All @@ -37,15 +37,15 @@ public function benchNormalizeProjectComposerFile()
* @Revs(5)
* @Iterations(1)
*/
public function benchNormalizeLargeComposerFile()
public function benchNormalizeLargeComposerFile(): void
{
$this->normalize(
__DIR__ . '/../Fixture/LargeComposerFile/composer.json',
$this->localComposerSchema()
);
}

private function normalize(string $file, string $schemaUri)
private function normalize(string $file, string $schemaUri): void
{
$original = \file_get_contents($file);

Expand Down
4 changes: 2 additions & 2 deletions test/Unit/AbstractNormalizerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ abstract class AbstractNormalizerTestCase extends Framework\TestCase
{
use Helper;

final public function testImplementsNormalizerInterface()
final public function testImplementsNormalizerInterface(): void
{
$this->assertClassImplementsInterface(NormalizerInterface::class, $this->className());
}

final public function testNormalizeRejectsInvalidJson()
final public function testNormalizeRejectsInvalidJson(): void
{
$json = $this->faker()->realText();

Expand Down
4 changes: 2 additions & 2 deletions test/Unit/AutoFormatNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class AutoFormatNormalizerTest extends AbstractNormalizerTestCase
* @param bool $hasFinalNewLine
* @param string $suffix
*/
public function testNormalizeEncodesWithJsonEncodeOptionsIndentsAndPossiblySuffixesWithFinalNewLine(bool $hasFinalNewLine, string $suffix)
public function testNormalizeEncodesWithJsonEncodeOptionsIndentsAndPossiblySuffixesWithFinalNewLine(bool $hasFinalNewLine, string $suffix): void
{
$faker = $this->faker();

Expand Down Expand Up @@ -123,7 +123,7 @@ public function providerFinalNewLine(): \Generator
],
];

foreach ($values as $key => list($hasFinalNewLine, $suffix)) {
foreach ($values as $key => [$hasFinalNewLine, $suffix]) {
yield $key => [
$hasFinalNewLine,
$suffix,
Expand Down
2 changes: 1 addition & 1 deletion test/Unit/CallableNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class CallableNormalizerTest extends AbstractNormalizerTestCase
*
* @param callable $callable
*/
public function testNormalizePassesJsonThroughCallable(callable $callable)
public function testNormalizePassesJsonThroughCallable(callable $callable): void
{
$json = <<<'JSON'
{
Expand Down
2 changes: 1 addition & 1 deletion test/Unit/ChainNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

final class ChainNormalizerTest extends AbstractNormalizerTestCase
{
public function testNormalizePassesJsonThroughNormalizers()
public function testNormalizePassesJsonThroughNormalizers(): void
{
$count = $this->faker()->numberBetween(3, 5);

Expand Down
2 changes: 1 addition & 1 deletion test/Unit/FinalNewLineNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class FinalNewLineNormalizerTest extends AbstractNormalizerTestCase
*
* @param string $whitespace
*/
public function testNormalizeEnsuresSingleFinalNewLine(string $whitespace)
public function testNormalizeEnsuresSingleFinalNewLine(string $whitespace): void
{
$json = <<<'JSON'
{
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/FixedFormatNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class FixedFormatNormalizerTest extends AbstractNormalizerTestCase
* @param bool $hasFinalNewLine
* @param string $suffix
*/
public function testNormalizeEncodesWithJsonEncodeOptionsIndentsAndPossiblySuffixesWithFinalNewLine(bool $hasFinalNewLine, string $suffix)
public function testNormalizeEncodesWithJsonEncodeOptionsIndentsAndPossiblySuffixesWithFinalNewLine(bool $hasFinalNewLine, string $suffix): void
{
$faker = $this->faker();

Expand Down Expand Up @@ -116,7 +116,7 @@ public function providerFinalNewLine(): \Generator
],
];

foreach ($values as $key => list($hasFinalNewLine, $suffix)) {
foreach ($values as $key => [$hasFinalNewLine, $suffix]) {
yield $key => [
$hasFinalNewLine,
$suffix,
Expand Down
16 changes: 8 additions & 8 deletions test/Unit/Format/FormatSnifferTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ final class FormatSnifferTest extends Framework\TestCase
{
use Helper;

public function testImplementsSnifferInterface()
public function testImplementsSnifferInterface(): void
{
$this->assertClassImplementsInterface(FormatSnifferInterface::class, FormatSniffer::class);
}

public function testSniffRejectsInvalidJson()
public function testSniffRejectsInvalidJson(): void
{
$json = $this->faker()->realText();

Expand All @@ -49,7 +49,7 @@ public function testSniffRejectsInvalidJson()
* @param int $jsonEncodeOptions
* @param string $json
*/
public function testSniffReturnsFormatWithJsonEncodeOptions(int $jsonEncodeOptions, string $json)
public function testSniffReturnsFormatWithJsonEncodeOptions(int $jsonEncodeOptions, string $json): void
{
$sniffer = new FormatSniffer();

Expand Down Expand Up @@ -98,7 +98,7 @@ public function providerJsonAndJsonEncodeOptions(): array
*
* @param string $json
*/
public function testSniffReturnsFormatWithDefaultIndentIfUnableToSniff(string $json)
public function testSniffReturnsFormatWithDefaultIndentIfUnableToSniff(string $json): void
{
$sniffer = new FormatSniffer();

Expand Down Expand Up @@ -129,7 +129,7 @@ public function providerJsonWithoutWhitespace(): \Generator
*
* @param string $indent
*/
public function testSniffReturnsFormatWithIndentSniffedFromArray(string $indent)
public function testSniffReturnsFormatWithIndentSniffedFromArray(string $indent): void
{
$json = <<<JSON
[
Expand All @@ -154,7 +154,7 @@ public function testSniffReturnsFormatWithIndentSniffedFromArray(string $indent)
*
* @param string $indent
*/
public function testSniffReturnsFormatWithIndentIndentSniffedFromObject(string $indent)
public function testSniffReturnsFormatWithIndentIndentSniffedFromObject(string $indent): void
{
$json = <<<JSON
{
Expand Down Expand Up @@ -199,7 +199,7 @@ public function providerIndent(): \Generator
*
* @param string $actualWhitespace
*/
public function testSniffReturnsFormatWithoutFinalNewLineIfThereIsNoFinalNewLine(string $actualWhitespace)
public function testSniffReturnsFormatWithoutFinalNewLineIfThereIsNoFinalNewLine(string $actualWhitespace): void
{
$json = <<<'JSON'
{
Expand Down Expand Up @@ -243,7 +243,7 @@ public function providerWhitespaceWithoutNewLine(): \Generator
*
* @param string $actualWhitespace
*/
public function testSniffReturnsFormatWithFinalNewLineIfThereIsAtLeastOneFinalNewLine(string $actualWhitespace)
public function testSniffReturnsFormatWithFinalNewLineIfThereIsAtLeastOneFinalNewLine(string $actualWhitespace): void
{
$json = <<<'JSON'
{
Expand Down
8 changes: 4 additions & 4 deletions test/Unit/Format/FormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ final class FormatTest extends Framework\TestCase
{
use Helper;

public function testImplementsFormatInterface()
public function testImplementsFormatInterface(): void
{
$this->assertClassImplementsInterface(FormatInterface::class, Format::class);
}

public function testConstructorRejectsInvalidEncodeOptions()
public function testConstructorRejectsInvalidEncodeOptions(): void
{
$jsonEncodeOptions = -1;
$indent = ' ';
Expand All @@ -51,7 +51,7 @@ public function testConstructorRejectsInvalidEncodeOptions()
*
* @param string $indent
*/
public function testConstructorRejectsInvalidIndent(string $indent)
public function testConstructorRejectsInvalidIndent(string $indent): void
{
$jsonEncodeOptions = 0;
$hasFinalNewLine = true;
Expand Down Expand Up @@ -89,7 +89,7 @@ public function providerInvalidIndent(): \Generator
* @param string $indent
* @param bool $hasFinalNewLine
*/
public function testConstructorSetsValues(string $indent, bool $hasFinalNewLine)
public function testConstructorSetsValues(string $indent, bool $hasFinalNewLine): void
{
$jsonEncodeOptions = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES;

Expand Down
4 changes: 2 additions & 2 deletions test/Unit/IndentNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class IndentNormalizerTest extends AbstractNormalizerTestCase
*
* @param string $indent
*/
public function testConstructorRejectsInvalidIndent(string $indent)
public function testConstructorRejectsInvalidIndent(string $indent): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage(\sprintf(
Expand Down Expand Up @@ -52,7 +52,7 @@ public function providerInvalidIndent(): \Generator
}
}

public function testNormalizeUsesPrinterToNormalizeJsonWithIndent()
public function testNormalizeUsesPrinterToNormalizeJsonWithIndent(): void
{
$indent = ' ';

Expand Down
4 changes: 2 additions & 2 deletions test/Unit/JsonEncodeNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

final class JsonEncodeNormalizerTest extends AbstractNormalizerTestCase
{
public function testConstructorRejectsInvalidJsonEncodeOptions()
public function testConstructorRejectsInvalidJsonEncodeOptions(): void
{
$jsonEncodeOptions = -1;

Expand All @@ -35,7 +35,7 @@ public function testConstructorRejectsInvalidJsonEncodeOptions()
*
* @param int $jsonEncodeOptions
*/
public function testNormalizeDecodesAndEncodesJsonWithJsonEncodeOptions(int $jsonEncodeOptions)
public function testNormalizeDecodesAndEncodesJsonWithJsonEncodeOptions(int $jsonEncodeOptions): void
{
$json = <<<'JSON'
{
Expand Down
2 changes: 1 addition & 1 deletion test/Unit/NoFinalNewLineNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class NoFinalNewLineNormalizerTest extends AbstractNormalizerTestCase
*
* @param string $whitespace
*/
public function testNormalizeRemovesAllWhitespaceFromEndOfJson(string $whitespace)
public function testNormalizeRemovesAllWhitespaceFromEndOfJson(string $whitespace): void
{
$json = <<<'JSON'
{
Expand Down
6 changes: 3 additions & 3 deletions test/Unit/ProjectCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ final class ProjectCodeTest extends Framework\TestCase
{
use Helper;

public function testProductionClassesAreAbstractOrFinal()
public function testProductionClassesAreAbstractOrFinal(): void
{
$this->assertClassesAreAbstractOrFinal(__DIR__ . '/../../src');
}

public function testProductionClassesHaveTests()
public function testProductionClassesHaveTests(): void
{
$this->assertClassesHaveTests(
__DIR__ . '/../../src',
Expand All @@ -34,7 +34,7 @@ public function testProductionClassesHaveTests()
);
}

public function testTestClassesAreAbstractOrFinal()
public function testTestClassesAreAbstractOrFinal(): void
{
$this->assertClassesAreAbstractOrFinal(__DIR__ . '/..');
}
Expand Down
Loading

0 comments on commit 12c6623

Please sign in to comment.