Skip to content

Commit

Permalink
Update dependencies (starting with PHPStan update): (#29)
Browse files Browse the repository at this point in the history
The (potential) breaking changes are highlighted in bold:

- phpstan/phpstan: `1.4.2` -> `~1.9.2`
- phpstan/phpstan-doctrine: `1.1.0` -> `~1.3.23`
- phpstan/phpstan-phpunit: `1.0.0` -> `~1.2.2`
- phpstan/phpstan-symfony: `1.1.2` -> `~1.2.16`
- **symplify/easy-coding-standard**: `9.4.22` -> `~11.1.17`
- symfony/polyfill-php80: `^1.23` -> `^1.27`
- **povils/phpmnd**: `^2.4` -> `~3.0.1`

Dev dependencies were just made more specific to what is actually installed, without changing the version
  • Loading branch information
devofdisaster authored Dec 7, 2022
1 parent 227b11a commit cd18502
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ci:
composer validate
vendor/bin/ecs show --debug --config ecs.php
vendor/bin/ecs check --debug src
vendor/bin/ecs list --ansi --debug
vendor/bin/phpunit
23 changes: 14 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
"license": "MIT",
"require": {
"php": ">=7.4",
"phpstan/phpstan": "1.4.2",
"phpstan/phpstan-doctrine": "1.1.0",
"phpstan/phpstan-phpunit": "1.0.0",
"phpstan/phpstan-symfony": "1.1.2",
"phpstan/phpstan": "~1.9.2",
"phpstan/phpstan-doctrine": "~1.3.23",
"phpstan/phpstan-phpunit": "~1.2.2",
"phpstan/phpstan-symfony": "~1.2.16",
"phpstan/extension-installer": "^1.1",
"symplify/easy-coding-standard": "9.4.22",
"symfony/polyfill-php80": "^1.23",
"povils/phpmnd": "^2.4"
"symplify/easy-coding-standard": "~11.1.17",
"symfony/polyfill-php80": "^1.27",
"povils/phpmnd": "~3.0.1"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"symfony/dotenv": "^5.3",
"phpunit/phpunit": "^9.5"
"symfony/dotenv": "~5.4.5",
"phpunit/phpunit": "~9.5.26"
},
"autoload": {
"psr-4": {
Expand All @@ -27,5 +27,10 @@
"psr-4": {
"Landingi\\": "tests/"
}
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
}
}
10 changes: 4 additions & 6 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<?php
declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Landingi\ClassNameSuffixFixer;
use Landingi\InterfaceNameSuffixFixer;

return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
return static function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([
\dirname(__DIR__) . '/../../src',
\dirname(__DIR__) . '/../../tests'
]);
$services = $containerConfigurator->services();
$services = $ecsConfig->services();

//ControlStructure
$services->set(\PhpCsFixer\Fixer\ControlStructure\NoUnneededControlParenthesesFixer::class);
Expand Down
2 changes: 1 addition & 1 deletion src/ClassNameSuffixFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class PaymentService
return new FixerDefinition(
'Removes Service and Entity class suffix',
[
new CodeSample($codeSample)
new CodeSample($codeSample),
]
);
}
Expand Down
5 changes: 2 additions & 3 deletions src/InterfaceNameSuffixFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ public function fix(SplFileInfo $file, Tokens $tokens): void
if ($token->isGivenKind(T_INTERFACE)) {
$interfaceName = $tokens[$index + 2]->getContent();

if (str_ends_with($interfaceName, 'Interface') && $interfaceName !== 'CreatorInterface') {
if (str_ends_with($interfaceName, 'Interface') && 'CreatorInterface' !== $interfaceName) {
$newToken = str_replace('Interface', '', $interfaceName);
$tokens[$index + 2] = new Token([$index + 2, $newToken]);
}
}
}
}


public function getDefinition(): FixerDefinitionInterface
{
$codeSample = <<<PHP
Expand All @@ -53,7 +52,7 @@ class PaymentInterface
return new FixerDefinition(
'Removes interface suffix from interfaces',
[
new CodeSample($codeSample)
new CodeSample($codeSample),
]
);
}
Expand Down
10 changes: 5 additions & 5 deletions tests/ClassNameSuffixFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@ public function testDoesNotFixAnything(string $input, string $expected): void
}

/**
* yields [Code to Fix, Expected Result]
* yields [Code to Fix, Expected Result].
*/
public function data(): Generator
{
yield [
file_get_contents('tests/class_name_suffix_fixer/test_1_input.php'),
file_get_contents('tests/class_name_suffix_fixer/test_1_output.php')
file_get_contents('tests/class_name_suffix_fixer/test_1_output.php'),
];
yield [
file_get_contents('tests/class_name_suffix_fixer/test_2_input.php'),
file_get_contents('tests/class_name_suffix_fixer/test_2_output.php')
file_get_contents('tests/class_name_suffix_fixer/test_2_output.php'),
];
yield [
file_get_contents('tests/class_name_suffix_fixer/test_3_input.php'),
file_get_contents('tests/class_name_suffix_fixer/test_3_output.php')
file_get_contents('tests/class_name_suffix_fixer/test_3_output.php'),
];
yield [
file_get_contents('tests/class_name_suffix_fixer/test_4_input.php'),
file_get_contents('tests/class_name_suffix_fixer/test_4_output.php')
file_get_contents('tests/class_name_suffix_fixer/test_4_output.php'),
];
}
}
2 changes: 1 addition & 1 deletion tests/InterfaceNameSuffixFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testDoesNotFixAnything(string $input, string $expected): void
}

/**
* yields [Code to Fix, Expected Result]
* yields [Code to Fix, Expected Result].
*/
public function data(): Generator
{
Expand Down

0 comments on commit cd18502

Please sign in to comment.