Skip to content

Commit 26f3f0f

Browse files
committed
Fix phpstan feedback
1 parent 76d45b0 commit 26f3f0f

13 files changed

+44
-47
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@
104104
"composer/semver": "^1 || ^3",
105105
"symfony/phpunit-bridge": "^4.2 || ^5",
106106
"phpstan/phpstan": "^0.12.55",
107-
"symfony/process": "^2.3"
107+
"symfony/process": "^2.3",
108+
"phpstan/phpstan-phpunit": "^0.12.16"
108109
},
109110
"scripts": {
110111
"test": "SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 vendor/bin/simple-phpunit",

phpstan.neon.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ parameters:
33
paths:
44
- src
55
- tests
6+
7+
includes:
8+
- vendor/phpstan/phpstan-phpunit/extension.neon

src/Composer/Installers/BaseInstaller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public function getInstallPath(PackageInterface $package, $frameworkType = '')
7474
/**
7575
* For an installer to override to modify the vars per installer.
7676
*
77-
* @param array{name: string, vendor: string, type: string} $vars
78-
* @return array{name: string, vendor: string, type: string}
77+
* @param array<string, string> $vars This will normally receive array{name: string, vendor: string, type: string}
78+
* @return array<string, string>
7979
*/
8080
public function inflectPackageVars($vars)
8181
{

tests/Composer/Installers/Test/BitrixInstallerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ final function setUp()
3131
}
3232

3333
/**
34-
* @param string $vars
35-
* @param string $expectedVars
34+
* @param string[] $vars
35+
* @param string[] $expectedVars
3636
*
3737
* @covers ::inflectPackageVars
3838
*

tests/Composer/Installers/Test/CakePHPInstallerTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@
1212

1313
class CakePHPInstallerTest extends TestCase
1414
{
15+
/**
16+
* @var Composer
17+
*/
1518
private $composer;
16-
private $io;
19+
/**
20+
* @var Package
21+
*/
22+
private $package;
1723

1824
/**
1925
* setUp
@@ -23,7 +29,6 @@ class CakePHPInstallerTest extends TestCase
2329
public function setUp()
2430
{
2531
$this->package = new Package('CamelCased', '1.0', '1.0');
26-
$this->io = $this->getMockBuilder('Composer\IO\PackageInterface')->getMock();
2732
$this->composer = new Composer();
2833
$this->composer->setConfig(new Config(false));
2934
}

tests/Composer/Installers/Test/CiviCrmInstallerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class CiviCrmInstallerTest extends BaseTestCase
1010
{
1111
/**
12-
* @var VgmcpInstaller
12+
* @var CiviCrmInstaller
1313
*/
1414
private $installer;
1515

tests/Composer/Installers/Test/GravInstallerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testInflectPackageVars()
4444
}
4545

4646
/**
47-
* @param $package \Composer\Package\PackageInterface
47+
* @param \Composer\Package\PackageInterface $package
4848
*/
4949
public function getPackageVars($package)
5050
{

tests/Composer/Installers/Test/InstallerTest.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -660,26 +660,4 @@ public function dataForTestDisabledInstallers()
660660
array(array("drupal", "true"), "cakephp-plugin", true),
661661
);
662662
}
663-
664-
/**
665-
* @param string $exception
666-
* @param string|null $message
667-
* @param int|null $code
668-
* @return void
669-
*/
670-
public function setExpectedException($exception, $message = null, $code = null)
671-
{
672-
if (!class_exists('PHPUnit\Framework\Error\Notice')) {
673-
$exception = str_replace('PHPUnit\\Framework\\Error\\', 'PHPUnit_Framework_Error_', $exception);
674-
}
675-
if (method_exists($this, 'expectException')) {
676-
$this->expectException($exception);
677-
if (null !== $message) {
678-
$this->expectExceptionMessage($message);
679-
}
680-
} else {
681-
/** @phpstan-ignore-next-line */
682-
parent::setExpectedException($exception, $message, $code);
683-
}
684-
}
685663
}

tests/Composer/Installers/Test/PimcoreInstallerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class PimcoreInstallerTest extends TestCase
99
{
1010
private $composer;
1111
private $io;
12+
private $package;
1213

1314
/**
1415
* setUp
@@ -18,7 +19,6 @@ class PimcoreInstallerTest extends TestCase
1819
public function setUp()
1920
{
2021
$this->package = new Package('CamelCased', '1.0', '1.0');
21-
$this->io = $this->getMockBuilder('Composer\IO\PackageInterface')->getMock();
2222
$this->composer = new Composer();
2323
}
2424

tests/Composer/Installers/Test/PiwikInstallerTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ class PiwikInstallerTest extends TestCase
1818
*/
1919
private $composer;
2020

21-
/**
22-
* @var PackageInterface
23-
*/
24-
private $io;
25-
2621
/**
2722
* @var Package
2823
*/
@@ -36,7 +31,6 @@ class PiwikInstallerTest extends TestCase
3631
public function setUp()
3732
{
3833
$this->package = new Package('VisitSummary', '1.0', '1.0');
39-
$this->io = $this->getMockBuilder('Composer\IO\PackageInterface')->getMock();
4034
$this->composer = new Composer();
4135
}
4236

0 commit comments

Comments
 (0)