-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
1,160 additions
and
499 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
parameters: | ||
deprecationRulesInstalled: true | ||
|
||
services: | ||
- | ||
class: PHPStan\Rules\Deprecations\DeprecatedClassHelper | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderHelperFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Rules\PHPUnit; | ||
|
||
use PHPStan\Reflection\ReflectionProvider; | ||
use PHPUnit\Framework\TestCase; | ||
use function dirname; | ||
use function explode; | ||
use function file_get_contents; | ||
use function is_file; | ||
use function json_decode; | ||
|
||
class DataProviderHelperFactory | ||
{ | ||
|
||
/** @var ReflectionProvider */ | ||
private $reflectionProvider; | ||
|
||
public function __construct(ReflectionProvider $reflectionProvider) | ||
{ | ||
$this->reflectionProvider = $reflectionProvider; | ||
} | ||
|
||
public function create(): DataProviderHelper | ||
{ | ||
$phpUnit10OrNewer = false; | ||
if ($this->reflectionProvider->hasClass(TestCase::class)) { | ||
$testCase = $this->reflectionProvider->getClass(TestCase::class); | ||
$file = $testCase->getFileName(); | ||
if ($file !== null) { | ||
$phpUnitRoot = dirname($file, 3); | ||
$phpUnitComposer = $phpUnitRoot . '/composer.json'; | ||
if (is_file($phpUnitComposer)) { | ||
$composerJson = @file_get_contents($phpUnitComposer); | ||
if ($composerJson !== false) { | ||
$json = json_decode($composerJson, true); | ||
$version = $json['extra']['branch-alias']['dev-main'] ?? null; | ||
if ($version !== null) { | ||
$majorVersion = (int) explode('.', $version)[0]; | ||
if ($majorVersion >= 10) { | ||
$phpUnit10OrNewer = true; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return new DataProviderHelper($this->reflectionProvider, $phpUnit10OrNewer); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,4 +66,4 @@ jobs: | |
env: | ||
PGPASSWORD: postgres | ||
|
||
- run: composer phpunit | ||
- run: composer phpunit -- --colors=always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.