Skip to content

Commit a05c053

Browse files
authored
strict_types=1 (#8)
* strict_types=1 * Small refactoring in tests
1 parent 670c3ee commit a05c053

29 files changed

Lines changed: 706 additions & 606 deletions

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
/.gitignore export-ignore
2222
/.travis.yml export-ignore
2323
/phpunit.xml.dist export-ignore
24+
/Makefile export-ignore
2425

2526
* text eol=lf
2627
*.png binary

.phan/config.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* @link https://github.com/JBZoo/Composer-Diff
1414
*/
1515

16+
declare(strict_types=1);
17+
1618
$default = include __DIR__ . '/../vendor/jbzoo/codestyle/src/phan/default.php';
1719

1820
return array_merge($default, [

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ update: ##@Project Install/Update all 3rd party dependencies
2828
$(call title,"Install/Update all 3rd party dependencies")
2929
@composer update --optimize-autoloader --no-progress
3030
$(call title,"Show difference in composer.lock")
31-
@$(PHP_BIN) composer-diff
31+
@$(PHP_BIN) composer-diff --output=markdown
3232

3333

3434
test-all: ##@Project Run all project tests at once

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# JBZoo / Composer-Diff
22

3-
[![Build Status](https://travis-ci.org/JBZoo/Composer-Diff.svg)](https://travis-ci.org/JBZoo/Composer-Diff) [![Coverage Status](https://coveralls.io/repos/JBZoo/Composer-Diff/badge.svg)](https://coveralls.io/github/JBZoo/Composer-Diff) [![Psalm Coverage](https://shepherd.dev/github/JBZoo/Composer-Diff/coverage.svg)](https://shepherd.dev/github/JBZoo/Composer-Diff)
3+
[![Build Status](https://travis-ci.org/JBZoo/Composer-Diff.svg)](https://travis-ci.org/JBZoo/Composer-Diff) [![Coverage Status](https://coveralls.io/repos/JBZoo/Composer-Diff/badge.svg)](https://coveralls.io/github/JBZoo/Composer-Diff) [![Psalm Coverage](https://shepherd.dev/github/JBZoo/Composer-Diff/coverage.svg)](https://shepherd.dev/github/JBZoo/Composer-Diff) [![PHP Strict Types](https://img.shields.io/badge/strict__types-%3D1-brightgreen)](https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict)
44
[![Stable Version](https://poser.pugx.org/jbzoo/composer-diff/version)](https://packagist.org/packages/jbzoo/composer-diff) [![Latest Unstable Version](https://poser.pugx.org/jbzoo/composer-diff/v/unstable)](https://packagist.org/packages/jbzoo/composer-diff) [![Dependents](https://poser.pugx.org/jbzoo/composer-diff/dependents)](https://packagist.org/packages/jbzoo/composer-diff/dependents?order_by=downloads) [![GitHub Issues](https://img.shields.io/github/issues/jbzoo/composer-diff)](https://github.com/JBZoo/Composer-Diff/issues) [![Total Downloads](https://poser.pugx.org/jbzoo/composer-diff/downloads)](https://packagist.org/packages/jbzoo/composer-diff/stats) [![GitHub License](https://img.shields.io/github/license/jbzoo/composer-diff)](https://github.com/JBZoo/Composer-Diff/blob/master/LICENSE)
55

66

composer-diff

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@
1414
* @link https://github.com/JBZoo/Composer-Diff
1515
*/
1616

17+
declare(strict_types=1);
18+
1719
require_once __DIR__ . '/composer-diff.php';

composer-diff.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* @link https://github.com/JBZoo/Composer-Diff
1414
*/
1515

16+
declare(strict_types=1);
17+
1618
// @codingStandardsIgnoreFile
1719

1820
use JBZoo\ComposerDiff\Commands\DiffAction;

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
"ext-json" : "*",
2424
"ext-filter" : "*",
2525

26-
"jbzoo/data" : "^4.1.3",
26+
"jbzoo/data" : "^4.2.0",
2727
"symfony/console" : ">=4.4",
2828
"symfony/process" : ">=4.4",
2929
"composer/semver" : ">=1.0"
3030
},
3131

3232
"require-dev" : {
33-
"jbzoo/utils" : "^4.2.3",
34-
"jbzoo/phpunit" : "^4.6.2",
33+
"jbzoo/utils" : "^4.3.0",
34+
"jbzoo/phpunit" : "^4.7.0",
3535
"jbzoo/codestyle" : "^2.10.0",
3636
"jbzoo/toolbox-ci" : "^1.3.5",
3737
"symfony/var-dumper" : "^4.4|^5.2.5",

composer.lock

Lines changed: 33 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Commands/AbstractCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* @link https://github.com/JBZoo/Composer-Diff
1414
*/
1515

16+
declare(strict_types=1);
17+
1618
namespace JBZoo\ComposerDiff\Commands;
1719

1820
use Symfony\Component\Console\Command\Command;
@@ -64,9 +66,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
6466
*/
6567
protected function opt(string $optionName): ?string
6668
{
67-
/** @var string|null $result */
69+
/** @var string|bool|null $result */
6870
$result = $this->input->getOption($optionName);
6971

72+
if (is_bool($result)) {
73+
return $result ? '1' : null;
74+
}
75+
7076
return $result ?? null;
7177
}
7278

src/Commands/DiffAction.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* @link https://github.com/JBZoo/Composer-Diff
1414
*/
1515

16+
declare(strict_types=1);
17+
1618
namespace JBZoo\ComposerDiff\Commands;
1719

1820
use JBZoo\ComposerDiff\Comparator;
@@ -25,7 +27,7 @@
2527
* Class DiffAction
2628
* @package JBZoo\ComposerDiff\Commands
2729
*/
28-
class DiffAction extends AbstractCommand
30+
final class DiffAction extends AbstractCommand
2931
{
3032
/**
3133
* @inheritDoc
@@ -54,7 +56,7 @@ protected function configure(): void
5456

5557
/**
5658
* @inheritDoc
57-
* @phan-suppress PhanUnusedProtectedMethodParameter
59+
* @phan-suppress PhanUnusedProtectedFinalMethodParameter
5860
*/
5961
protected function runCommand(InputInterface $input, OutputInterface $output): int
6062
{
@@ -97,11 +99,10 @@ protected function runCommand(InputInterface $input, OutputInterface $output): i
9799
* @param array $fullChangeLog
98100
* @param string $env
99101
* @param array $params
100-
* @return bool
101102
*/
102-
private function renderOutput(string $outputFormat, array $fullChangeLog, string $env, array $params): bool
103+
private function renderOutput(string $outputFormat, array $fullChangeLog, string $env, array $params): void
103104
{
104-
return AbstractRender::factory($outputFormat, $params)
105+
AbstractRender::factory($outputFormat, $params)
105106
->setFullChangeLog($fullChangeLog)
106107
->setEnv($env)
107108
->render($this->output);

0 commit comments

Comments
 (0)