mirror of
https://github.com/danog/psalm.git
synced 2024-11-29 20:28:59 +01:00
parent
9a93525d33
commit
0bd4dbcbc4
@ -8,7 +8,6 @@ stages:
|
||||
- Code coverage analysis
|
||||
|
||||
php:
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
|
@ -10,10 +10,10 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.0",
|
||||
"php": "^7.1",
|
||||
"nikic/php-parser": "^4.0.2 || ^4.1",
|
||||
"openlss/lib-array2xml": "^0.0.10||^0.5.1",
|
||||
"muglug/package-versions-56": "1.2.4",
|
||||
"ocramius/package-versions": "^1.2",
|
||||
"php-cs-fixer/diff": "^1.2",
|
||||
"composer/xdebug-handler": "^1.1",
|
||||
"felixfbecker/language-server-protocol": "^1.2",
|
||||
@ -24,7 +24,7 @@
|
||||
"symfony/console": "^3.3||^4.0",
|
||||
"amphp/amp": "^2.1",
|
||||
"amphp/byte-stream": "^1.5",
|
||||
"phpmyadmin/sql-parser": "^4.0"
|
||||
"phpmyadmin/sql-parser": "^5.0"
|
||||
},
|
||||
"bin": ["psalm", "psalter", "psalm-language-server", "psalm-plugin"],
|
||||
"autoload": {
|
||||
@ -44,10 +44,10 @@
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6.0 || ^7.0",
|
||||
"phpunit/phpunit": "^7.0 || ^8.0",
|
||||
"squizlabs/php_codesniffer": "3.4.0",
|
||||
"bamarni/composer-bin-plugin": "^1.2",
|
||||
"psalm/plugin-phpunit": "^0.5.5"
|
||||
"psalm/plugin-phpunit": "^0.5.8"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-igbinary": "^2.0.5"
|
||||
|
@ -8,7 +8,7 @@
|
||||
beStrictAboutTestsThatDoNotTestAnything="false"
|
||||
beStrictAboutTodoAnnotatedTests="true"
|
||||
verbose="true">
|
||||
<testsuite name="default">
|
||||
<testsuite name="psalm">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
|
||||
|
@ -367,6 +367,9 @@ class FileAnalyzer extends SourceAnalyzer implements StatementsSource
|
||||
*/
|
||||
public static function clearCache()
|
||||
{
|
||||
Type::clearCache();
|
||||
\Psalm\Internal\Codebase\Reflection::clearCache();
|
||||
\Psalm\Internal\Codebase\Functions::clearCache();
|
||||
IssueBuffer::clearCache();
|
||||
FileManipulationBuffer::clearCache();
|
||||
FunctionLikeAnalyzer::clearCache();
|
||||
|
@ -253,4 +253,9 @@ class Functions
|
||||
|
||||
return isset($file_storage->functions[$function_id]) && $file_storage->functions[$function_id]->variadic;
|
||||
}
|
||||
|
||||
public static function clearCache() : void
|
||||
{
|
||||
self::$stubbed_functions = [];
|
||||
}
|
||||
}
|
||||
|
@ -495,4 +495,9 @@ class Reflection
|
||||
|
||||
throw new \UnexpectedValueException('Expecting to have a function for ' . $function_id);
|
||||
}
|
||||
|
||||
public static function clearCache() : void
|
||||
{
|
||||
self::$builtin_functions = [];
|
||||
}
|
||||
}
|
||||
|
@ -48,11 +48,6 @@ class StatementsProvider
|
||||
*/
|
||||
private $diff_map = [];
|
||||
|
||||
/**
|
||||
* @var PhpParser\Parser|null
|
||||
*/
|
||||
protected static $parser;
|
||||
|
||||
public function __construct(
|
||||
FileProvider $file_provider,
|
||||
ParserCacheProvider $parser_cache_provider = null,
|
||||
@ -344,15 +339,13 @@ class StatementsProvider
|
||||
array $existing_statements = null,
|
||||
array $file_changes = null
|
||||
) {
|
||||
if (!self::$parser) {
|
||||
$attributes = [
|
||||
'comments', 'startLine', 'startFilePos', 'endFilePos',
|
||||
];
|
||||
$attributes = [
|
||||
'comments', 'startLine', 'startFilePos', 'endFilePos',
|
||||
];
|
||||
|
||||
$lexer = new PhpParser\Lexer([ 'usedAttributes' => $attributes ]);
|
||||
$lexer = new PhpParser\Lexer([ 'usedAttributes' => $attributes ]);
|
||||
|
||||
self::$parser = (new PhpParser\ParserFactory())->create(PhpParser\ParserFactory::PREFER_PHP7, $lexer);
|
||||
}
|
||||
$parser = (new PhpParser\ParserFactory())->create(PhpParser\ParserFactory::PREFER_PHP7, $lexer);
|
||||
|
||||
$used_cached_statements = false;
|
||||
|
||||
@ -361,7 +354,7 @@ class StatementsProvider
|
||||
if ($existing_statements && $file_changes && $existing_file_contents) {
|
||||
$clashing_traverser = new \Psalm\Internal\Traverser\CustomTraverser;
|
||||
$offset_analyzer = new \Psalm\Internal\Visitor\PartialParserVisitor(
|
||||
self::$parser,
|
||||
$parser,
|
||||
$error_handler,
|
||||
$file_changes,
|
||||
$existing_file_contents,
|
||||
@ -376,7 +369,7 @@ class StatementsProvider
|
||||
} else {
|
||||
try {
|
||||
/** @var array<int, \PhpParser\Node\Stmt> */
|
||||
$stmts = self::$parser->parse($file_contents, $error_handler) ?: [];
|
||||
$stmts = $parser->parse($file_contents, $error_handler) ?: [];
|
||||
} catch (\Throwable $t) {
|
||||
$stmts = [];
|
||||
|
||||
@ -386,7 +379,7 @@ class StatementsProvider
|
||||
} else {
|
||||
try {
|
||||
/** @var array<int, \PhpParser\Node\Stmt> */
|
||||
$stmts = self::$parser->parse($file_contents, $error_handler) ?: [];
|
||||
$stmts = $parser->parse($file_contents, $error_handler) ?: [];
|
||||
} catch (\Throwable $t) {
|
||||
$stmts = [];
|
||||
|
||||
|
@ -131,6 +131,8 @@ class IssueBuffer
|
||||
}
|
||||
|
||||
if ($config->throw_exception) {
|
||||
\Psalm\Internal\Analyzer\FileAnalyzer::clearCache();
|
||||
|
||||
throw new Exception\CodeException(
|
||||
$issue_type
|
||||
. ' - ' . $e->getShortLocation()
|
||||
|
@ -1235,4 +1235,9 @@ abstract class Type
|
||||
|
||||
return $combined_type;
|
||||
}
|
||||
|
||||
public static function clearCache() : void
|
||||
{
|
||||
self::$memoized_tokens = [];
|
||||
}
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ function requireAutoloaders($current_dir, $has_explicit_root, $vendor_dir)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
define('PSALM_VERSION', (string) \Muglug\PackageVersions\Versions::getVersion('vimeo/psalm'));
|
||||
define('PHP_PARSER_VERSION', (string) \Muglug\PackageVersions\Versions::getVersion('nikic/php-parser'));
|
||||
define('PSALM_VERSION', (string) \PackageVersions\Versions::getVersion('vimeo/psalm'));
|
||||
define('PHP_PARSER_VERSION', (string) \PackageVersions\Versions::getVersion('nikic/php-parser'));
|
||||
|
||||
return $first_autoloader;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use Psalm\Internal\PluginManager\Command\ShowCommand;
|
||||
use Psalm\Internal\PluginManager\PluginListFactory;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Muglug\PackageVersions\Versions;
|
||||
use PackageVersions\Versions;
|
||||
|
||||
$current_dir = (string)getcwd() . DIRECTORY_SEPARATOR;
|
||||
$vendor_dir = getVendorDir($current_dir);
|
||||
|
@ -134,13 +134,13 @@ class AnnotationTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidScalarArgument
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testPhpStormGenericsInvalidArgument()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->expectExceptionMessage('InvalidScalarArgument');
|
||||
|
||||
Config::getInstance()->allow_phpstorm_generics = true;
|
||||
|
||||
$this->addFile(
|
||||
@ -159,13 +159,13 @@ class AnnotationTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage PossiblyInvalidMethodCall
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testPhpStormGenericsNoTypehint()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->expectExceptionMessage('PossiblyInvalidMethodCall');
|
||||
|
||||
Config::getInstance()->allow_phpstorm_generics = true;
|
||||
|
||||
$this->addFile(
|
||||
@ -181,13 +181,13 @@ class AnnotationTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidParamDefault
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testInvalidParamDefault()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->expectExceptionMessage('InvalidParamDefault');
|
||||
|
||||
$this->addFile(
|
||||
'somefile.php',
|
||||
'<?php
|
||||
@ -224,13 +224,13 @@ class AnnotationTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidParamDefault
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testInvalidTypehintParamDefaultButAllowedInConfig()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->expectExceptionMessage('InvalidParamDefault');
|
||||
|
||||
Config::getInstance()->add_param_default_to_docblock_type = true;
|
||||
|
||||
$this->addFile(
|
||||
@ -998,7 +998,43 @@ class AnnotationTest extends TestCase
|
||||
public function providerInvalidCodeParse()
|
||||
{
|
||||
return [
|
||||
'invalidReturn' => [
|
||||
'invalidClassMethodReturn' => [
|
||||
'<?php
|
||||
class C {
|
||||
/**
|
||||
* @return $thus
|
||||
*/
|
||||
public function barBar() {
|
||||
return $this;
|
||||
}
|
||||
}',
|
||||
'error_message' => 'MissingDocblockType',
|
||||
],
|
||||
'invalidClassMethodReturnClass' => [
|
||||
'<?php
|
||||
class C {
|
||||
/**
|
||||
* @return 1
|
||||
*/
|
||||
public static function barBar() {
|
||||
return 1;
|
||||
}
|
||||
}',
|
||||
'error_message' => 'InvalidDocblock',
|
||||
],
|
||||
'invalidClassMethodReturnBrackets' => [
|
||||
'<?php
|
||||
class C {
|
||||
/**
|
||||
* @return []
|
||||
*/
|
||||
public static function barBar() {
|
||||
return [];
|
||||
}
|
||||
}',
|
||||
'error_message' => 'InvalidDocblock',
|
||||
],
|
||||
'invalidInterfaceMethodReturn' => [
|
||||
'<?php
|
||||
interface I {
|
||||
/**
|
||||
@ -1008,7 +1044,7 @@ class AnnotationTest extends TestCase
|
||||
}',
|
||||
'error_message' => 'MissingDocblockType',
|
||||
],
|
||||
'invalidReturnClass' => [
|
||||
'invalidInterfaceMethodReturnClass' => [
|
||||
'<?php
|
||||
interface I {
|
||||
/**
|
||||
@ -1018,7 +1054,7 @@ class AnnotationTest extends TestCase
|
||||
}',
|
||||
'error_message' => 'InvalidDocblock',
|
||||
],
|
||||
'invalidReturnBrackets' => [
|
||||
'invalidInterfaceMethodReturnBrackets' => [
|
||||
'<?php
|
||||
interface I {
|
||||
/**
|
||||
|
@ -6,13 +6,13 @@ use Psalm\Context;
|
||||
class BadFormatTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage ParseError - somefile.php:9
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testMissingSemicolon()
|
||||
{
|
||||
$this->expectExceptionMessage('ParseError - somefile.php:9');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->addFile(
|
||||
'somefile.php',
|
||||
'<?php
|
||||
@ -31,13 +31,13 @@ class BadFormatTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage ParseError - somefile.php:3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testClassMethodWithNoStmts()
|
||||
{
|
||||
$this->expectExceptionMessage('ParseError - somefile.php:3');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->addFile(
|
||||
'somefile.php',
|
||||
'<?php
|
||||
@ -50,13 +50,13 @@ class BadFormatTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage ParseError - somefile.php:5
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testTypingReturnType()
|
||||
{
|
||||
$this->expectExceptionMessage('ParseError - somefile.php:5');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->addFile(
|
||||
'somefile.php',
|
||||
'<?php
|
||||
@ -73,13 +73,13 @@ class BadFormatTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage ParseError - somefile.php:6
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testOverriddenUse()
|
||||
{
|
||||
$this->expectExceptionMessage('ParseError - somefile.php:6');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->addFile(
|
||||
'somefile.php',
|
||||
'<?php
|
||||
|
@ -10,13 +10,13 @@ class ClassStringTest extends TestCase
|
||||
use Traits\ValidCodeAnalysisTestTrait;
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidStringClass
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testDontAllowStringStandInForNewClass()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidStringClass');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
Config::getInstance()->allow_string_standin_for_class = false;
|
||||
|
||||
$this->addFile(
|
||||
@ -33,13 +33,13 @@ class ClassStringTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidStringClass
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testDontAllowStringStandInForStaticMethodCall()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidStringClass');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
Config::getInstance()->allow_string_standin_for_class = false;
|
||||
|
||||
$this->addFile(
|
||||
|
@ -18,7 +18,7 @@ class CodebaseTest extends TestCase
|
||||
private $codebase;
|
||||
|
||||
/** @return void */
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->codebase = $this->project_analyzer->getCodebase();
|
||||
|
@ -11,13 +11,13 @@ class ConfigFileTest extends \Psalm\Tests\TestCase
|
||||
private $file_path;
|
||||
|
||||
/** @return void */
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
$this->file_path = tempnam(sys_get_temp_dir(), 'psalm-test-config');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function tearDown()
|
||||
public function tearDown() : void
|
||||
{
|
||||
@unlink($this->file_path);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass() : void
|
||||
{
|
||||
self::$config = new TestConfig();
|
||||
|
||||
@ -34,7 +34,7 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
FileAnalyzer::clearCache();
|
||||
$this->file_provider = new Provider\FakeFileProvider();
|
||||
@ -586,13 +586,13 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\ConfigException
|
||||
* @expectedExceptionMessage This element is not expected
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testImpossibleIssue()
|
||||
{
|
||||
$this->expectExceptionMessage('This element is not expected');
|
||||
$this->expectException(\Psalm\Exception\ConfigException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
Config::loadFromXML(
|
||||
dirname(__DIR__, 2),
|
||||
@ -611,13 +611,13 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage MissingReturnType
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testRequireVoidReturnTypeExists()
|
||||
{
|
||||
$this->expectExceptionMessage('MissingReturnType');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2),
|
||||
@ -849,13 +849,13 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage ForbiddenCode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testForbiddenEchoFunctionViaFunctions()
|
||||
{
|
||||
$this->expectExceptionMessage('ForbiddenCode');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2),
|
||||
@ -880,13 +880,13 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage ForbiddenEcho
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testForbiddenEchoFunctionViaFlag()
|
||||
{
|
||||
$this->expectExceptionMessage('ForbiddenEcho');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2),
|
||||
@ -932,13 +932,13 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage ForbiddenCode
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testForbiddenVarExportFunction()
|
||||
{
|
||||
$this->expectExceptionMessage('ForbiddenCode');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2),
|
||||
@ -964,13 +964,13 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidCatch
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testValidThrowInvalidCatch()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidCatch');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2),
|
||||
@ -1016,13 +1016,13 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidThrow
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testInvalidThrowValidCatch()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidThrow');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2),
|
||||
@ -1276,14 +1276,11 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
$this->analyzeFile($file_path, new Context());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage MissingThrowsDocblock
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testNotIgnoredException()
|
||||
public function testNotIgnoredException() : void
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->expectExceptionMessage('MissingThrowsDocblock');
|
||||
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2),
|
||||
|
@ -5,17 +5,11 @@ use Psalm\Config\Creator;
|
||||
|
||||
class CreatorTest extends \Psalm\Tests\TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass() : void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ class PluginListTest extends \Psalm\Tests\TestCase
|
||||
/** @var ObjectProphecy<ComposerLock> */
|
||||
private $composer_lock;
|
||||
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
$this->config = $this->prophesize(Config::class);
|
||||
/** @psalm-suppress TooManyArguments willReturn is old-school variadic, see vimeo/psalm#605 */
|
||||
|
@ -21,7 +21,7 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass() : void
|
||||
{
|
||||
self::$config = new TestConfig();
|
||||
|
||||
@ -37,7 +37,7 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
FileAnalyzer::clearCache();
|
||||
$this->file_provider = new Provider\FakeFileProvider();
|
||||
@ -60,13 +60,13 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidClass
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testStringAnalyzerPlugin()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidClass');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
|
||||
@ -96,13 +96,13 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidClass
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testStringAnalyzerPluginWithClassConstant()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidClass');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
|
||||
@ -136,13 +136,13 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage UndefinedMethod
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testStringAnalyzerPluginWithClassConstantConcat()
|
||||
{
|
||||
$this->expectExceptionMessage('UndefinedMethod');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
|
||||
@ -176,7 +176,7 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testEchoAnalyzerPluginWithJustHtml()
|
||||
{
|
||||
@ -208,13 +208,13 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage TypeCoercion
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testEchoAnalyzerPluginWithUnescapedConcatenatedString()
|
||||
{
|
||||
$this->expectExceptionMessage('TypeCoercion');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
|
||||
@ -248,13 +248,13 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage TypeCoercion
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testEchoAnalyzerPluginWithUnescapedString()
|
||||
{
|
||||
$this->expectExceptionMessage('TypeCoercion');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
|
||||
@ -287,7 +287,7 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testEchoAnalyzerPluginWithEscapedString()
|
||||
{
|
||||
@ -337,13 +337,13 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage NoFloatAssignment
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testFloatCheckerPlugin()
|
||||
{
|
||||
$this->expectExceptionMessage('NoFloatAssignment');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
|
||||
@ -619,13 +619,13 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidPropertyAssignmentValue
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testPropertyProviderHooksInvalidAssignment()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidPropertyAssignmentValue');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
require_once __DIR__ . '/Plugin/PropertyPlugin.php';
|
||||
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
@ -662,13 +662,13 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidScalarArgument
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testMethodProviderHooksInvalidArg()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidScalarArgument');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
require_once __DIR__ . '/Plugin/MethodPlugin.php';
|
||||
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
@ -705,13 +705,13 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidScalarArgument
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testFunctionProviderHooksInvalidArg()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidScalarArgument');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
require_once __DIR__ . '/Plugin/FunctionPlugin.php';
|
||||
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
@ -798,14 +798,11 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
$this->project_analyzer->getCodebase()->config->initializePlugins($this->project_analyzer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedExceptionMessage does-not-exist/plugins/StringChecker.php
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPluginInvalidAbsoluteFilenameThrowsException()
|
||||
public function testPluginInvalidAbsoluteFilenameThrowsException() : void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('does-not-exist/plugins/StringChecker.php');
|
||||
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
|
||||
|
@ -62,7 +62,7 @@ class DocumentationTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
FileAnalyzer::clearCache();
|
||||
\Psalm\Internal\FileManipulation\FunctionDocblockManipulator::clearCache();
|
||||
|
@ -15,7 +15,7 @@ class ErrorBaselineTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
$this->fileProvider = $this->prophesize(FileProvider::class);
|
||||
}
|
||||
|
@ -11,10 +11,7 @@ abstract class FileManipulationTest extends \Psalm\Tests\TestCase
|
||||
/** @var \Psalm\Internal\Analyzer\ProjectAnalyzer */
|
||||
protected $project_analyzer;
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
FileAnalyzer::clearCache();
|
||||
\Psalm\Internal\FileManipulation\FunctionDocblockManipulator::clearCache();
|
||||
|
@ -13,7 +13,7 @@ class FileReferenceTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
FileAnalyzer::clearCache();
|
||||
\Psalm\Internal\FileManipulation\FunctionDocblockManipulator::clearCache();
|
||||
|
@ -12,7 +12,7 @@ class AnalyzedMethodTest extends \Psalm\Tests\TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -102,6 +102,8 @@ class AnalyzedMethodTest extends \Psalm\Tests\TestCase
|
||||
$unaffected_analyzed_methods,
|
||||
$codebase->analyzer->getAnalyzedMethods()
|
||||
);
|
||||
|
||||
echo ' ';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,7 @@ class CachedStorageTest extends \Psalm\Tests\TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -12,7 +12,7 @@ class ErrorAfterUpdateTest extends \Psalm\Tests\TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -12,7 +12,7 @@ class ErrorFixTest extends \Psalm\Tests\TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -12,7 +12,7 @@ class TemporaryUpdateTest extends \Psalm\Tests\TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -12,7 +12,7 @@ class JsonOutputTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
// `TestCase::setUp()` creates its own ProjectAnalyzer and Config instance, but we don't want to do that in this
|
||||
// case, so don't run a `parent::setUp()` call here.
|
||||
|
@ -14,7 +14,7 @@ class CompletionTest extends \Psalm\Tests\TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -14,7 +14,7 @@ class SymbolLookupTest extends \Psalm\Tests\TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -44,13 +44,13 @@ class MagicMethodAnnotationTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage UndefinedMethod
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAnnotationWithoutCallConfig()
|
||||
{
|
||||
$this->expectExceptionMessage('UndefinedMethod');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
Config::getInstance()->use_phpdoc_method_without_magic_or_parent = false;
|
||||
|
||||
$this->addFile(
|
||||
|
@ -110,13 +110,12 @@ class MethodSignatureTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage ImplementedParamTypeMismatch
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testExtendDocblockParamTypeWithWrongDocblockParam()
|
||||
{
|
||||
$this->expectExceptionMessage('ImplementedParamTypeMismatch');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
if (class_exists('SoapClient') === false) {
|
||||
$this->markTestSkipped('Cannot run test, base class "SoapClient" does not exist!');
|
||||
|
||||
@ -151,14 +150,11 @@ class MethodSignatureTest extends TestCase
|
||||
$this->analyzeFile('somefile.php', new Context());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage MethodSignatureMismatch
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExtendDocblockParamTypeWithWrongParam()
|
||||
public function testExtendDocblockParamTypeWithWrongParam() : void
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->expectExceptionMessage('MethodSignatureMismatch');
|
||||
|
||||
if (class_exists('SoapClient') === false) {
|
||||
$this->markTestSkipped('Cannot run test, base class "SoapClient" does not exist!');
|
||||
|
||||
|
@ -18,7 +18,7 @@ class ProjectCheckerTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass() : void
|
||||
{
|
||||
self::$config = new TestConfig();
|
||||
|
||||
@ -34,7 +34,7 @@ class ProjectCheckerTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
FileAnalyzer::clearCache();
|
||||
$this->file_provider = new Provider\FakeFileProvider();
|
||||
|
@ -10,13 +10,13 @@ class PropertyTypeTest extends TestCase
|
||||
use Traits\ValidCodeAnalysisTestTrait;
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage NullableReturnStatement
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testForgetPropertyAssignments()
|
||||
{
|
||||
$this->expectExceptionMessage('NullableReturnStatement');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
Config::getInstance()->remember_property_assignments_after_call = false;
|
||||
|
||||
$this->addFile(
|
||||
@ -44,7 +44,7 @@ class PropertyTypeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testForgetPropertyAssignmentsInBranchWithThrow()
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ class PsalmPluginTest extends TestCase
|
||||
/** @var Application */
|
||||
private $app;
|
||||
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
$this->plugin_list = $this->prophesize(PluginList::class);
|
||||
$this->plugin_list_factory = $this->prophesize(PluginListFactory::class);
|
||||
@ -59,8 +59,8 @@ class PsalmPluginTest extends TestCase
|
||||
$show_command->execute([]);
|
||||
|
||||
$output = $show_command->getDisplay();
|
||||
$this->assertContains('No plugins enabled', $output);
|
||||
$this->assertContains('No plugins available', $output);
|
||||
$this->assertStringContainsString('No plugins enabled', $output);
|
||||
$this->assertStringContainsString('No plugins available', $output);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,8 +76,8 @@ class PsalmPluginTest extends TestCase
|
||||
$show_command->execute([]);
|
||||
|
||||
$output = $show_command->getDisplay();
|
||||
$this->assertContains('vendor/package', $output);
|
||||
$this->assertContains('a\b\c', $output);
|
||||
$this->assertStringContainsString('vendor/package', $output);
|
||||
$this->assertStringContainsString('a\b\c', $output);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,8 +93,8 @@ class PsalmPluginTest extends TestCase
|
||||
$show_command->execute([]);
|
||||
|
||||
$output = $show_command->getDisplay();
|
||||
$this->assertContains('vendor/package', $output);
|
||||
$this->assertContains('a\b\c', $output);
|
||||
$this->assertStringContainsString('vendor/package', $output);
|
||||
$this->assertStringContainsString('a\b\c', $output);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,8 +128,8 @@ class PsalmPluginTest extends TestCase
|
||||
|
||||
$output = $show_command->getDisplay();
|
||||
|
||||
$this->assertContains('Package', $output);
|
||||
$this->assertContains('Class', $output);
|
||||
$this->assertStringContainsString('Package', $output);
|
||||
$this->assertStringContainsString('Class', $output);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,7 +142,7 @@ class PsalmPluginTest extends TestCase
|
||||
$list_command = new CommandTester($this->app->find('list'));
|
||||
$list_command->execute([]);
|
||||
$output = $list_command->getDisplay();
|
||||
$this->assertContains($command, $output);
|
||||
$this->assertStringContainsString($command, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,8 +183,8 @@ class PsalmPluginTest extends TestCase
|
||||
|
||||
$output = $enable_command->getDisplay();
|
||||
|
||||
$this->assertContains('ERROR', $output);
|
||||
$this->assertContains('Unknown plugin', $output);
|
||||
$this->assertStringContainsString('ERROR', $output);
|
||||
$this->assertStringContainsString('Unknown plugin', $output);
|
||||
$this->assertNotSame(0, $enable_command->getStatusCode());
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ class PsalmPluginTest extends TestCase
|
||||
$enable_command->execute(['pluginName' => 'vendor/package']);
|
||||
|
||||
$output = $enable_command->getDisplay();
|
||||
$this->assertContains('Plugin already enabled', $output);
|
||||
$this->assertStringContainsString('Plugin already enabled', $output);
|
||||
$this->assertNotSame(0, $enable_command->getStatusCode());
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ class PsalmPluginTest extends TestCase
|
||||
$enable_command->execute(['pluginName' => 'vendor/package']);
|
||||
|
||||
$output = $enable_command->getDisplay();
|
||||
$this->assertContains('Plugin enabled', $output);
|
||||
$this->assertStringContainsString('Plugin enabled', $output);
|
||||
$this->assertSame(0, $enable_command->getStatusCode());
|
||||
}
|
||||
|
||||
@ -261,8 +261,8 @@ class PsalmPluginTest extends TestCase
|
||||
|
||||
$output = $disable_command->getDisplay();
|
||||
|
||||
$this->assertContains('ERROR', $output);
|
||||
$this->assertContains('Unknown plugin', $output);
|
||||
$this->assertStringContainsString('ERROR', $output);
|
||||
$this->assertStringContainsString('Unknown plugin', $output);
|
||||
$this->assertNotSame(0, $disable_command->getStatusCode());
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ class PsalmPluginTest extends TestCase
|
||||
$disable_command->execute(['pluginName' => 'vendor/package']);
|
||||
|
||||
$output = $disable_command->getDisplay();
|
||||
$this->assertContains('Plugin already disabled', $output);
|
||||
$this->assertStringContainsString('Plugin already disabled', $output);
|
||||
$this->assertNotSame(0, $disable_command->getStatusCode());
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ class PsalmPluginTest extends TestCase
|
||||
$disable_command->execute(['pluginName' => 'vendor/package']);
|
||||
|
||||
$output = $disable_command->getDisplay();
|
||||
$this->assertContains('Plugin disabled', $output);
|
||||
$this->assertStringContainsString('Plugin disabled', $output);
|
||||
$this->assertSame(0, $disable_command->getStatusCode());
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ class ReportOutputTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
// `TestCase::setUp()` creates its own ProjectAnalyzer and Config instance, but we don't want to do that in this
|
||||
// case, so don't run a `parent::setUp()` call here.
|
||||
@ -60,12 +60,12 @@ class ReportOutputTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \UnexpectedValueException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReportFormatException()
|
||||
{
|
||||
$this->expectException(\UnexpectedValueException::class);
|
||||
$config = new TestConfig();
|
||||
$config->throw_exception = false;
|
||||
|
||||
|
@ -14,7 +14,7 @@ class StubTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass() : void
|
||||
{
|
||||
self::$config = new TestConfig();
|
||||
|
||||
@ -30,7 +30,7 @@ class StubTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
FileAnalyzer::clearCache();
|
||||
$this->file_provider = new Provider\FakeFileProvider();
|
||||
@ -58,13 +58,12 @@ class StubTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\ConfigException
|
||||
* @expectedExceptionMessage Cannot resolve stubfile path
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testNonexistentStubFile()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\ConfigException::class);
|
||||
$this->expectExceptionMessage('Cannot resolve stubfile path');
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
Config::loadFromXML(
|
||||
dirname(__DIR__),
|
||||
@ -347,13 +346,13 @@ class StubTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidScalarArgument
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testStubVariadicFunctionWrongArgType()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidScalarArgument');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__),
|
||||
@ -382,13 +381,13 @@ class StubTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage TooManyArguments
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUserVariadicWithFalseVariadic()
|
||||
{
|
||||
$this->expectExceptionMessage('TooManyArguments');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__),
|
||||
@ -575,13 +574,13 @@ class StubTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage UndefinedFunction - /src/somefile.php:2:22 - Function barBar does not exist
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testNoStubFunction()
|
||||
{
|
||||
$this->expectExceptionMessage('UndefinedFunction - /src/somefile.php:2:22 - Function barBar does not exist');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__),
|
||||
@ -787,13 +786,12 @@ class StubTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage TypeCoercion
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testStubFileWithPartialClassDefinitionWithCoercion()
|
||||
{
|
||||
$this->expectExceptionMessage('TypeCoercion');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__),
|
||||
@ -834,13 +832,13 @@ class StubTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidReturnStatement
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testStubFileWithPartialClassDefinitionGeneralReturnType()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidReturnStatement');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__),
|
||||
|
@ -22,7 +22,7 @@ class TestCase extends BaseTestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass() : void
|
||||
{
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
@ -41,7 +41,7 @@ class TestCase extends BaseTestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -69,6 +69,11 @@ class TestCase extends BaseTestCase
|
||||
$this->project_analyzer->setPhpVersion('7.3');
|
||||
}
|
||||
|
||||
public function tearDown() : void
|
||||
{
|
||||
FileAnalyzer::clearCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file_path
|
||||
* @param string $contents
|
||||
|
@ -7,13 +7,13 @@ use Psalm\Context;
|
||||
class ThrowsAnnotationTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage MissingThrowsDocblock
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUndocumentedThrow()
|
||||
{
|
||||
$this->expectExceptionMessage('MissingThrowsDocblock');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
Config::getInstance()->check_for_throws_docblock = true;
|
||||
|
||||
$this->addFile(
|
||||
@ -149,13 +149,13 @@ class ThrowsAnnotationTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage MissingThrowsDocblock
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUndocumentedThrowInFunctionCall()
|
||||
{
|
||||
$this->expectExceptionMessage('MissingThrowsDocblock');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
Config::getInstance()->check_for_throws_docblock = true;
|
||||
|
||||
$this->addFile(
|
||||
@ -188,7 +188,7 @@ class ThrowsAnnotationTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testDocumentedThrowInFunctionCallWithThrow()
|
||||
{
|
||||
@ -228,7 +228,7 @@ class ThrowsAnnotationTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testDocumentedThrowInFunctionCallWithoutThrow()
|
||||
{
|
||||
@ -308,13 +308,13 @@ class ThrowsAnnotationTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage MissingThrowsDocblock
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUncaughtThrowInFunctionCall()
|
||||
{
|
||||
$this->expectExceptionMessage('MissingThrowsDocblock');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
Config::getInstance()->check_for_throws_docblock = true;
|
||||
|
||||
$this->addFile(
|
||||
@ -351,13 +351,13 @@ class ThrowsAnnotationTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage MissingDocblockType
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testEmptyThrows()
|
||||
{
|
||||
$this->expectExceptionMessage('MissingDocblockType');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
Config::getInstance()->check_for_throws_docblock = true;
|
||||
|
||||
$this->addFile(
|
||||
|
@ -7,13 +7,12 @@ use Psalm\Context;
|
||||
class ThrowsInGlobalScopeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage UncaughtThrowInGlobalScope
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUncaughtDocumentedThrowCall()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->expectExceptionMessage('UncaughtThrowInGlobalScope');
|
||||
Config::getInstance()->check_for_throws_in_global_scope = true;
|
||||
|
||||
$this->addFile(
|
||||
@ -44,7 +43,7 @@ class ThrowsInGlobalScopeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testCaughtDocumentedThrowCall()
|
||||
{
|
||||
@ -81,7 +80,7 @@ class ThrowsInGlobalScopeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUncaughtUndocumentedThrowCall()
|
||||
{
|
||||
@ -111,13 +110,12 @@ class ThrowsInGlobalScopeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage UncaughtThrowInGlobalScope
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUncaughtDocumentedThrowCallInNamespace()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->expectExceptionMessage('UncaughtThrowInGlobalScope');
|
||||
Config::getInstance()->check_for_throws_in_global_scope = true;
|
||||
|
||||
$this->addFile(
|
||||
@ -149,13 +147,13 @@ class ThrowsInGlobalScopeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage UncaughtThrowInGlobalScope
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUncaughtThrow()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->expectExceptionMessage('UncaughtThrowInGlobalScope');
|
||||
|
||||
Config::getInstance()->check_for_throws_in_global_scope = true;
|
||||
|
||||
$this->addFile(
|
||||
@ -170,7 +168,7 @@ class ThrowsInGlobalScopeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testCaughtThrow()
|
||||
{
|
||||
@ -190,7 +188,7 @@ class ThrowsInGlobalScopeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUncaughtThrowWhenSuppressing()
|
||||
{
|
||||
@ -209,7 +207,7 @@ class ThrowsInGlobalScopeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUncaughtThrowInNamespaceWhenSuppressing()
|
||||
{
|
||||
@ -229,7 +227,7 @@ class ThrowsInGlobalScopeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUncaughtDocumentedThrowCallWhenSuppressing()
|
||||
{
|
||||
@ -264,7 +262,7 @@ class ThrowsInGlobalScopeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUncaughtDocumentedThrowCallInNamespaceWhenSuppressing()
|
||||
{
|
||||
@ -300,13 +298,12 @@ class ThrowsInGlobalScopeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage UncaughtThrowInGlobalScope
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testUncaughtDocumentedThrowCallWhenSuppressingFirst()
|
||||
{
|
||||
$this->expectExceptionMessage('UncaughtThrowInGlobalScope');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
Config::getInstance()->check_for_throws_in_global_scope = true;
|
||||
|
||||
$this->addFile(
|
||||
|
@ -8,7 +8,7 @@ class TypeParseTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
$this->file_provider = new \Psalm\Tests\Internal\Provider\FakeFileProvider();
|
||||
|
||||
@ -279,22 +279,22 @@ class TypeParseTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testInvalidType()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('array(A)');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBracketedUnionAndIntersection()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('(A|B)&C');
|
||||
}
|
||||
|
||||
@ -482,172 +482,172 @@ class TypeParseTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCallableWithBadVariadic()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('callable(int, ...string) : void');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCallableWithTrailingColon()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('callable(int):');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCallableWithAnotherBadVariadic()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('callable(int, string..) : void');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCallableWithVariadicAndDefault()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('callable(int, string...=) : void');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBadVariadic()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('string...');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBadFullStop()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('string.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBadSemicolon()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('string;');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBadGenericString()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('string<T>');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBadAmpersand()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('&array');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBadColon()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString(':array');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBadBrackets()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('max(a)');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testMoreBadBrackets()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('max(a):void');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGeneratorWithWBadBrackets()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('Generator{string, A}');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBadEquals()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('=array');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBadBar()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('|array');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBadColonDash()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('array|string:-');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\TypeParseTreeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDoubleBar()
|
||||
{
|
||||
$this->expectException(\Psalm\Exception\TypeParseTreeException::class);
|
||||
Type::parseString('PDO||Closure|numeric');
|
||||
}
|
||||
|
||||
@ -837,12 +837,15 @@ class TypeParseTest extends TestCase
|
||||
*/
|
||||
public function testReflectionTypeParse()
|
||||
{
|
||||
/** @psalm-suppress UnusedParam */
|
||||
function someFunction(string $param, array $param2, int $param3 = null) : string
|
||||
{
|
||||
return 'hello';
|
||||
if (!function_exists('Psalm\Tests\someFunction')) {
|
||||
/** @psalm-suppress UnusedParam */
|
||||
function someFunction(string $param, array $param2, int $param3 = null) : string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$reflectionFunc = new \ReflectionFunction('Psalm\Tests\someFunction');
|
||||
$reflectionParams = $reflectionFunc->getParameters();
|
||||
|
||||
|
@ -24,7 +24,7 @@ class TypeReconciliationTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -14,7 +14,7 @@ class UnusedCodeTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
FileAnalyzer::clearCache();
|
||||
|
||||
|
@ -14,7 +14,7 @@ class UnusedVariableTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
FileAnalyzer::clearCache();
|
||||
|
||||
|
@ -6,10 +6,7 @@ class ValueTest extends TestCase
|
||||
use Traits\InvalidCodeAnalysisTestTrait;
|
||||
use Traits\ValidCodeAnalysisTestTrait;
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp() : void
|
||||
{
|
||||
\Psalm\Internal\Analyzer\FileAnalyzer::clearCache();
|
||||
|
||||
|
@ -8,13 +8,12 @@ class VariadicTest extends TestCase
|
||||
use Traits\ValidCodeAnalysisTestTrait;
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidScalarArgument
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testVariadicArrayBadParam()
|
||||
{
|
||||
$this->expectExceptionMessage('InvalidScalarArgument');
|
||||
$this->expectException(\Psalm\Exception\CodeException::class);
|
||||
$this->addFile(
|
||||
'somefile.php',
|
||||
'<?php
|
||||
|
Loading…
Reference in New Issue
Block a user