Skip to content

RenameTestCase to BaseTestCase to prevent import conflicts with PHPUnit's TestCase. #634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/build/scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function (string $filePath, string $prefix, string $content): string {
return $content;
},
function (string $filePath, string $prefix, string $content): string {
if ($filePath !== 'src/Testing/TestCase.php') {
if ($filePath !== 'src/Testing/PHPStanTestCase.php') {
return $content;
}
return str_replace(sprintf('\\%s\\PHPUnit\\Framework\\TestCase', $prefix), '\\PHPUnit\\Framework\\TestCase', $content);
Expand Down Expand Up @@ -160,7 +160,7 @@ function (string $filePath, string $prefix, string $content): string {
function (string $filePath, string $prefix, string $content): string {
if (!in_array($filePath, [
'src/Testing/TestCaseSourceLocatorFactory.php',
'src/Testing/TestCase.php',
'src/Testing/PHPStanTestCase.php',
], true)) {
return $content;
}
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</rule>
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure.UnusedInheritedVariable">
<exclude-pattern>src/Command/CommandHelper.php</exclude-pattern>
<exclude-pattern>src/Testing/TestCase.php</exclude-pattern>
<exclude-pattern>src/Testing/PHPStanTestCase.php</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly.ReferencedGeneralException">
<exclude-pattern>tests</exclude-pattern>
Expand Down
2 changes: 1 addition & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ parameters:
-
message: "#^Anonymous function has an unused use \\$container\\.$#"
count: 1
path: src/Testing/TestCase.php
path: src/Testing/PHPStanTestCase.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/ErrorFormatterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\StreamOutput;

abstract class ErrorFormatterTestCase extends \PHPStan\Testing\TestCase
abstract class ErrorFormatterTestCase extends \PHPStan\Testing\PHPStanTestCase
{

protected const DIRECTORY_PATH = '/data/folder/with space/and unicode 😃/project';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
use PHPStan\Type\TypeAliasResolver;

/** @api */
abstract class TestCase extends \PHPUnit\Framework\TestCase
abstract class PHPStanTestCase extends \PHPUnit\Framework\TestCase
{

/** @var bool */
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/RuleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @api
* @template TRule of \PHPStan\Rules\Rule
*/
abstract class RuleTestCase extends \PHPStan\Testing\TestCase
abstract class RuleTestCase extends \PHPStan\Testing\PHPStanTestCase
{

private ?\PHPStan\Analyser\Analyser $analyser = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/TypeInferenceTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
use PHPStan\Type\VerbosityLevel;

/** @api */
abstract class TypeInferenceTestCase extends \PHPStan\Testing\TestCase
abstract class TypeInferenceTestCase extends \PHPStan\Testing\PHPStanTestCase
{

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/AnalyserIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use const PHP_VERSION_ID;
use function array_reverse;

class AnalyserIntegrationTest extends \PHPStan\Testing\TestCase
class AnalyserIntegrationTest extends \PHPStan\Testing\PHPStanTestCase
{

public function testUndefinedVariableFromAssignErrorHasLine(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/AnalyserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use PHPStan\Rules\Registry;
use PHPStan\Type\FileTypeMapper;

class AnalyserTest extends \PHPStan\Testing\TestCase
class AnalyserTest extends \PHPStan\Testing\PHPStanTestCase
{

public function testReturnErrorIfIgnoredMessagesDoesNotOccur(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/AnalyserTraitsIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use PHPStan\File\FileHelper;

class AnalyserTraitsIntegrationTest extends \PHPStan\Testing\TestCase
class AnalyserTraitsIntegrationTest extends \PHPStan\Testing\PHPStanTestCase
{

/** @var \PHPStan\File\FileHelper */
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/ErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace PHPStan\Analyser;

class ErrorTest extends \PHPStan\Testing\TestCase
class ErrorTest extends \PHPStan\Testing\PHPStanTestCase
{

public function testError(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Analyser/ScopeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Name\FullyQualified;
use PHPStan\Testing\TestCase;
use PHPStan\Testing\PHPStanTestCase;
use PHPStan\Type\Constant\ConstantArrayType;
use PHPStan\Type\Constant\ConstantBooleanType;
use PHPStan\Type\Constant\ConstantIntegerType;
Expand All @@ -14,7 +14,7 @@
use PHPStan\Type\UnionType;
use PHPStan\Type\VerbosityLevel;

class ScopeTest extends TestCase
class ScopeTest extends PHPStanTestCase
{

public function dataGeneralize(): array
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/StatementResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PHPStan\Type\MixedType;
use PHPStan\Type\StringType;

class StatementResultTest extends \PHPStan\Testing\TestCase
class StatementResultTest extends \PHPStan\Testing\PHPStanTestCase
{

public function dataIsAlwaysTerminating(): array
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/TypeSpecifierContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace PHPStan\Analyser;

class TypeSpecifierContextTest extends \PHPStan\Testing\TestCase
class TypeSpecifierContextTest extends \PHPStan\Testing\PHPStanTestCase
{

public function dataContext(): array
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/TypeSpecifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
use PHPStan\Type\UnionType;
use PHPStan\Type\VerbosityLevel;

class TypeSpecifierTest extends \PHPStan\Testing\TestCase
class TypeSpecifierTest extends \PHPStan\Testing\PHPStanTestCase
{

private const FALSEY_TYPE_DESCRIPTION = '0|0.0|\'\'|\'0\'|array()|false|null';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

use PHPStan\File\FileHelper;
use PHPStan\File\FileReader;
use PHPStan\Testing\TestCase;
use PHPStan\Testing\PHPStanTestCase;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use function file_exists;

/**
* @group exec
*/
class TraitsCachingIssueIntegrationTest extends TestCase
class TraitsCachingIssueIntegrationTest extends PHPStanTestCase
{

/** @var string|null */
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Broker/BrokerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use PHPStan\Reflection\SignatureMap\NativeFunctionReflectionProvider;
use PHPStan\Type\FileTypeMapper;

class BrokerTest extends \PHPStan\Testing\TestCase
class BrokerTest extends \PHPStan\Testing\PHPStanTestCase
{

/** @var \PHPStan\Broker\Broker */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\Console\Style\SymfonyStyle;

class AnalyseApplicationIntegrationTest extends \PHPStan\Testing\TestCase
class AnalyseApplicationIntegrationTest extends \PHPStan\Testing\PHPStanTestCase
{

public function testExecuteOnAFile(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Command/AnalyseCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* @group exec
*/
class AnalyseCommandTest extends \PHPStan\Testing\TestCase
class AnalyseCommandTest extends \PHPStan\Testing\PHPStanTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Command/AnalysisResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace PHPStan\Command;

use PHPStan\Analyser\Error;
use PHPStan\Testing\TestCase;
use PHPStan\Testing\PHPStanTestCase;

final class AnalysisResultTest extends TestCase
final class AnalysisResultTest extends PHPStanTestCase
{

public function testErrorsAreSortedByFileNameAndLine(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Command/IgnoredRegexValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace PHPStan\Command;

use PHPStan\PhpDoc\TypeStringResolver;
use PHPStan\Testing\TestCase;
use PHPStan\Testing\PHPStanTestCase;

class IgnoredRegexValidatorTest extends TestCase
class IgnoredRegexValidatorTest extends PHPStanTestCase
{

public function dataValidate(): array
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/File/FileExcluderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace PHPStan\File;

class FileExcluderTest extends \PHPStan\Testing\TestCase
class FileExcluderTest extends \PHPStan\Testing\PHPStanTestCase
{

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/File/FileHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace PHPStan\File;

class FileHelperTest extends \PHPStan\Testing\TestCase
class FileHelperTest extends \PHPStan\Testing\PHPStanTestCase
{

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Generics/TemplateTypeFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use PHPStan\Type\UnionType;
use PHPStan\Type\VerbosityLevel;

class TemplateTypeFactoryTest extends \PHPStan\Testing\TestCase
class TemplateTypeFactoryTest extends \PHPStan\Testing\PHPStanTestCase
{

/** @return array<array{?Type, Type}> */
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Parser/CachedParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use PhpParser\Node\Stmt\Namespace_;
use PHPStan\File\FileReader;
use PHPStan\Testing\TestCase;
use PHPStan\Testing\PHPStanTestCase;

class CachedParserTest extends TestCase
class CachedParserTest extends PHPStanTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PHPStan\Reflection\Php\PhpMethodReflection;
use PHPStan\Type\VerbosityLevel;

class AnnotationsMethodsClassReflectionExtensionTest extends \PHPStan\Testing\TestCase
class AnnotationsMethodsClassReflectionExtensionTest extends \PHPStan\Testing\PHPStanTestCase
{

public function dataMethods(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PHPStan\Broker\Broker;
use PHPStan\Type\VerbosityLevel;

class AnnotationsPropertiesClassReflectionExtensionTest extends \PHPStan\Testing\TestCase
class AnnotationsPropertiesClassReflectionExtensionTest extends \PHPStan\Testing\PHPStanTestCase
{

public function dataProperties(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PHPStan\Analyser\Scope;
use PHPStan\Broker\Broker;

class DeprecatedAnnotationsTest extends \PHPStan\Testing\TestCase
class DeprecatedAnnotationsTest extends \PHPStan\Testing\PHPStanTestCase
{

public function dataDeprecatedAnnotations(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PHPStan\Analyser\Scope;
use PHPStan\Broker\Broker;

class FinalAnnotationsTest extends \PHPStan\Testing\TestCase
class FinalAnnotationsTest extends \PHPStan\Testing\PHPStanTestCase
{

public function dataFinalAnnotations(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PHPStan\Analyser\Scope;
use PHPStan\Broker\Broker;

class InternalAnnotationsTest extends \PHPStan\Testing\TestCase
class InternalAnnotationsTest extends \PHPStan\Testing\PHPStanTestCase
{

public function dataInternalAnnotations(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use PHPStan\Broker\Broker;
use PHPStan\Type\VerbosityLevel;

class ThrowsAnnotationsTest extends \PHPStan\Testing\TestCase
class ThrowsAnnotationsTest extends \PHPStan\Testing\PHPStanTestCase
{

public function dataThrowsAnnotations(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PHPStan\BetterReflection\Reflector\ClassReflector;
use PHPStan\BetterReflection\Reflector\ConstantReflector;
use PHPStan\BetterReflection\Reflector\FunctionReflector;
use PHPStan\Testing\TestCase;
use PHPStan\Testing\PHPStanTestCase;
use TestSingleFileSourceLocator\AFoo;
use TestSingleFileSourceLocator\InCondition;

Expand All @@ -15,7 +15,7 @@ function testFunctionForLocator(): void // phpcs:disable

}

class AutoloadSourceLocatorTest extends TestCase
class AutoloadSourceLocatorTest extends PHPStanTestCase
{

public function testAutoloadEverythingInFile(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
use PHPStan\BetterReflection\Reflector\ClassReflector;
use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound;
use PHPStan\BetterReflection\Reflector\FunctionReflector;
use PHPStan\Testing\TestCase;
use PHPStan\Testing\PHPStanTestCase;
use TestDirectorySourceLocator\AFoo;

class OptimizedDirectorySourceLocatorTest extends TestCase
class OptimizedDirectorySourceLocatorTest extends PHPStanTestCase
{

public function dataClass(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
use PHPStan\BetterReflection\Reflector\ConstantReflector;
use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound;
use PHPStan\BetterReflection\Reflector\FunctionReflector;
use PHPStan\Testing\TestCase;
use PHPStan\Testing\PHPStanTestCase;
use TestSingleFileSourceLocator\AFoo;

class OptimizedSingleFileSourceLocatorTest extends TestCase
class OptimizedSingleFileSourceLocatorTest extends PHPStanTestCase
{

public function dataClass(): array
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Reflection/ClassReflectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use PHPStan\Type\FileTypeMapper;
use WrongClassConstantFile\SecuredRouter;

class ClassReflectionTest extends \PHPStan\Testing\TestCase
class ClassReflectionTest extends \PHPStan\Testing\PHPStanTestCase
{

public function dataHasTraitUse(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use PHPStan\Type\UnionType;
use PHPStan\Type\VerbosityLevel;

class GenericParametersAcceptorResolverTest extends \PHPStan\Testing\TestCase
class GenericParametersAcceptorResolverTest extends \PHPStan\Testing\PHPStanTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Reflection/MixedTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

use NativeMixedType\Foo;
use PhpParser\Node\Name;
use PHPStan\Testing\TestCase;
use PHPStan\Testing\PHPStanTestCase;
use PHPStan\Type\MixedType;

class MixedTypeTest extends TestCase
class MixedTypeTest extends PHPStanTestCase
{

public function testMixedType(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use PHPStan\Type\UnionType;
use PHPStan\Type\VerbosityLevel;

class ParametersAcceptorSelectorTest extends \PHPStan\Testing\TestCase
class ParametersAcceptorSelectorTest extends \PHPStan\Testing\PHPStanTestCase
{

public function dataSelectFromTypes(): \Generator
Expand Down
Loading