Skip to content

Commit 9d54bd2

Browse files
authored
Php 7.4 (#4)
* Test against 7.4 * Updated PHPStan 0.12
1 parent c155ca6 commit 9d54bd2

12 files changed

+53
-31
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ sudo: false
55
matrix:
66
fast_finish: true
77
include:
8-
- php: 7.2
9-
env: CS_CHECK=1 STATIC_ANALYSIS=1
108
- php: 7.3
9+
env: CS_CHECK=1 STATIC_ANALYSIS=1
10+
- php: 7.4
1111
env: CODE_COVERAGE=1
1212

1313
cache:

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
"friendsofphp/php-cs-fixer": "^2.16"
1515
},
1616
"require-dev": {
17-
"phpstan/phpstan": "^0.11",
18-
"phpstan/phpstan-phpunit": "^0.11",
17+
"phpstan/phpstan": "^0.12",
18+
"phpstan/phpstan-phpunit": "^0.12",
1919
"phpunit/phpunit": "^7.5",
2020
"roave/security-advisories": "dev-master",
2121
"slam/php-debug-r": "^1.6",
22-
"slam/phpstan-extensions": "^3.6",
23-
"thecodingmachine/phpstan-strict-rules": "^0.11"
22+
"slam/phpstan-extensions": "^4.0",
23+
"thecodingmachine/phpstan-strict-rules": "^0.12"
2424
},
2525
"autoload": {
2626
"psr-4": {

lib/Config.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ final class Config extends PhpCsFixerConfig
1414
public const APP_V2 = 'APP_V2';
1515
public const LIB = 'LIB';
1616

17+
/**
18+
* @param array<string, mixed> $overriddenRules
19+
*/
1720
public function __construct(string $type = self::APP_V2, array $overriddenRules = [])
1821
{
1922
parent::__construct(\sprintf('%s:%s', __NAMESPACE__, $type));

lib/PhpFileOnlyProxyFixer.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
final class PhpFileOnlyProxyFixer implements ConfigurationDefinitionFixerInterface, DefinedFixerInterface, WhitespacesAwareFixerInterface
1818
{
19+
/**
20+
* @var FixerInterface
21+
*/
1922
private $fixer;
2023

2124
public function __construct(FixerInterface $fixer)
@@ -43,6 +46,7 @@ public function getOptions()
4346

4447
public function resolve(array $configuration)
4548
{
49+
return [];
4650
}
4751
};
4852
}

phpstan.neon

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
includes:
2-
- vendor/phpstan/phpstan/conf/config.levelmax.neon
2+
- phar://phpstan.phar/conf/config.levelmax.neon
33
- vendor/phpstan/phpstan-phpunit/extension.neon
44
- vendor/slam/phpstan-extensions/conf/slam-rules.neon
55
- vendor/slam/phpstan-extensions/conf/thecodingmachine-rules.neon
@@ -10,3 +10,5 @@ parameters:
1010
- tests/
1111
ignoreErrors:
1212
- '#Parameter .+ given#'
13+
- '#Method .+ has no return typehint specified#'
14+
- '#Method .+ has parameter .+ with no value type specified in iterable type array#'

tests/ConfigTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@
1818
*/
1919
final class ConfigTest extends TestCase
2020
{
21-
public function testConfig()
21+
public function testConfig(): void
2222
{
2323
$config = new Config();
2424

2525
self::assertInstanceOf(ConfigInterface::class, $config);
2626
self::assertNotEmpty($config->getCustomFixers());
2727
}
2828

29-
public function testAllDefaultRulesAreSpecified()
29+
public function testAllDefaultRulesAreSpecified(): void
3030
{
3131
$config = new Config();
32+
/** @var array<string, mixed> $configRules */
3233
$configRules = $config->getRules();
3334
$ruleSet = new RuleSet($configRules);
3435
$rules = $ruleSet->getRules();
@@ -78,7 +79,7 @@ public function testAllDefaultRulesAreSpecified()
7879
self::assertEquals($orderedCurrentRules, $currentRules, 'Order the rules alphabetically please');
7980
}
8081

81-
public function testFutureMode()
82+
public function testFutureMode(): void
8283
{
8384
\putenv('PHP_CS_FIXER_FUTURE_MODE');
8485

@@ -89,7 +90,7 @@ public function testFutureMode()
8990
self::assertNotEmpty(\getenv('PHP_CS_FIXER_FUTURE_MODE'));
9091
}
9192

92-
public function testTypes()
93+
public function testTypes(): void
9394
{
9495
$rules = (new Config(Config::APP_V1))->getRules();
9596
self::assertFalse($rules['declare_strict_types']);
@@ -106,7 +107,7 @@ public function testTypes()
106107
self::assertSame((new Config())->getRules(), (new Config(Config::APP_V2))->getRules());
107108
}
108109

109-
public function testOverwrite()
110+
public function testOverwrite(): void
110111
{
111112
$rules = (new Config(Config::APP_V2))->getRules();
112113
self::assertTrue($rules['declare_strict_types']);

tests/FinalAbstractPublicFixerTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
final class FinalAbstractPublicFixerTest extends AbstractFixerTestCase
1313
{
14-
public function testIsRisky()
14+
public function testIsRisky(): void
1515
{
1616
self::assertInstanceOf(FixerDefinition::class, $this->fixer->getDefinition());
1717
self::assertTrue($this->fixer->isRisky());
@@ -20,12 +20,15 @@ public function testIsRisky()
2020
/**
2121
* @dataProvider provideCases
2222
*/
23-
public function testFix($expected, $input = null)
23+
public function testFix(string $expected, ?string $input = null): void
2424
{
2525
$this->doTest($expected, $input);
2626
}
2727

28-
public function provideCases()
28+
/**
29+
* @return string[][]
30+
*/
31+
public function provideCases(): array
2932
{
3033
$original = '
3134
public $a1;

tests/FinalInternalClassFixerTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
final class FinalInternalClassFixerTest extends AbstractFixerTestCase
1313
{
14-
public function testIsRisky()
14+
public function testIsRisky(): void
1515
{
1616
self::assertInstanceOf(FixerDefinition::class, $this->fixer->getDefinition());
1717
self::assertTrue($this->fixer->isRisky());
@@ -20,12 +20,15 @@ public function testIsRisky()
2020
/**
2121
* @dataProvider provideCases
2222
*/
23-
public function testFix($expected, $input = null)
23+
public function testFix(string $expected, ?string $input = null): void
2424
{
2525
$this->doTest($expected, $input);
2626
}
2727

28-
public function provideCases()
28+
/**
29+
* @return string[][]
30+
*/
31+
public function provideCases(): array
2932
{
3033
return [
3134
[

tests/FunctionReferenceSpaceFixerTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,23 @@
1111
*/
1212
final class FunctionReferenceSpaceFixerTest extends AbstractFixerTestCase
1313
{
14-
public function testIsRisky()
14+
public function testIsRisky(): void
1515
{
1616
self::assertInstanceOf(FixerDefinition::class, $this->fixer->getDefinition());
1717
}
1818

1919
/**
2020
* @dataProvider provideCases
2121
*/
22-
public function testFix($expected, $input = null)
22+
public function testFix(string $expected, ?string $input = null): void
2323
{
2424
$this->doTest($expected, $input);
2525
}
2626

27-
public function provideCases()
27+
/**
28+
* @return string[][]
29+
*/
30+
public function provideCases(): array
2831
{
2932
$same = function (string $content): string {
3033
$use = $content;

tests/InlineCommentSpacerFixerTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,23 @@
1111
*/
1212
final class InlineCommentSpacerFixerTest extends AbstractFixerTestCase
1313
{
14-
public function testDefinition()
14+
public function testDefinition(): void
1515
{
1616
self::assertInstanceOf(FixerDefinition::class, $this->fixer->getDefinition());
1717
}
1818

1919
/**
2020
* @dataProvider provideCases
2121
*/
22-
public function testFix($expected, $input = null)
22+
public function testFix(string $expected, ?string $input = null): void
2323
{
2424
$this->doTest($expected, $input);
2525
}
2626

27-
public function provideCases()
27+
/**
28+
* @return string[][]
29+
*/
30+
public function provideCases(): array
2831
{
2932
return [
3033
[

0 commit comments

Comments
 (0)