1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 09:19:40 +01:00

Merge pull request #6345 from orklah/multiple_properties

use better solution to check for project dir paths
This commit is contained in:
Bruce Weirdan 2021-08-19 20:53:07 +03:00 committed by GitHub
commit 230bdb43ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,13 +2,13 @@
namespace Psalm\Internal\FileManipulation; namespace Psalm\Internal\FileManipulation;
use PhpParser\Node\Stmt\Property; use PhpParser\Node\Stmt\Property;
use Psalm\Config;
use Psalm\DocComment; use Psalm\DocComment;
use Psalm\FileManipulation; use Psalm\FileManipulation;
use Psalm\Internal\Analyzer\ProjectAnalyzer; use Psalm\Internal\Analyzer\ProjectAnalyzer;
use function array_shift; use function array_shift;
use function count; use function count;
use function in_array;
use function ltrim; use function ltrim;
use function str_replace; use function str_replace;
use function strlen; use function strlen;
@ -95,7 +95,8 @@ class PropertyDocblockManipulator
$file_contents = $codebase->getFileContents($file_path); $file_contents = $codebase->getFileContents($file_path);
if (count($stmt->props) > 1) { if (count($stmt->props) > 1) {
if (in_array($file_path, $project_analyzer->getConfig()->getProjectFiles())) { $config = Config::getInstance();
if ($config->isInProjectDirs($file_path)) {
throw new \UnexpectedValueException('Cannot replace multiple inline properties in ' . $file_path); throw new \UnexpectedValueException('Cannot replace multiple inline properties in ' . $file_path);
} }