Skip to content
Permalink
Browse files

Revert "Implement better progress"

This reverts commit 042070d.
  • Loading branch information...
muglug committed May 27, 2019
1 parent e41733d commit 4302596654235194e28bb2fa52867d9b52ccd0b1
Showing with 299 additions and 374 deletions.
  1. +4 −4 examples/TemplateScanner.php
  2. +12 −14 src/Psalm/Codebase.php
  3. +18 −16 src/Psalm/Config.php
  4. +3 −3 src/Psalm/Internal/Analyzer/ClassAnalyzer.php
  5. +52 −36 src/Psalm/Internal/Analyzer/ProjectAnalyzer.php
  6. +4 −4 src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php
  7. +1 −1 src/Psalm/Internal/Analyzer/StatementsAnalyzer.php
  8. +22 −10 src/Psalm/Internal/Codebase/Analyzer.php
  9. +3 −7 src/Psalm/Internal/Codebase/ClassLikes.php
  10. +31 −13 src/Psalm/Internal/Codebase/Populator.php
  11. +32 −14 src/Psalm/Internal/Codebase/Scanner.php
  12. +1 −1 src/Psalm/Internal/LanguageServer/LanguageServer.php
  13. +9 −10 src/Psalm/Internal/Provider/StatementsProvider.php
  14. +9 −12 src/Psalm/Internal/Scanner/FileScanner.php
  15. +36 −36 src/Psalm/Plugin/Shepherd.php
  16. +0 −26 src/Psalm/Progress/DebugProgress.php
  17. +0 −23 src/Psalm/Progress/Progress.php
  18. +8 −10 src/command_functions.php
  19. +10 −19 src/psalm-language-server.php
  20. +25 −34 src/psalm.php
  21. +5 −18 src/psalter.php
  22. +1 −8 tests/Config/PluginTest.php
  23. +1 −2 tests/FileUpdates/AnalyzedMethodTest.php
  24. +1 −1 tests/FileUpdates/CachedStorageTest.php
  25. +1 −1 tests/FileUpdates/ErrorAfterUpdateTest.php
  26. +1 −1 tests/FileUpdates/ErrorFixTest.php
  27. +1 −1 tests/FileUpdates/TemporaryUpdateTest.php
  28. +1 −1 tests/LanguageServer/CompletionTest.php
  29. +1 −1 tests/LanguageServer/SymbolLookupTest.php
  30. +0 −17 tests/Progress/EchoProgress.php
  31. +0 −8 tests/Progress/VoidProgress.php
  32. +1 −17 tests/ProjectCheckerTest.php
  33. +2 −2 tests/ReportOutputTest.php
  34. +1 −1 tests/StubTest.php
  35. +1 −1 tests/TestCase.php
  36. +1 −1 tests/TypeParseTest.php
@@ -6,7 +6,6 @@
use Psalm\Checker\CommentChecker;
use Psalm\Codebase;
use Psalm\DocComment;
use Psalm\Progress\Progress;
use Psalm\Storage\FileStorage;
class TemplateScanner extends Psalm\Internal\Scanner\FileScanner
@@ -15,18 +14,19 @@ class TemplateScanner extends Psalm\Internal\Scanner\FileScanner
/**
* @param bool $storage_from_cache
* @param bool $debug_output
*
* @return void
*/
public function scan(
Codebase $codebase,
FileStorage $file_storage,
$storage_from_cache = false,
Progress $progress = null
$debug_output = false
) {
$stmts = $codebase->statements_provider->getStatementsForFile(
$file_storage->file_path,
$progress
$debug_output
);
if (empty($stmts)) {
@@ -62,6 +62,6 @@ public function scan(
$codebase->scanner->queueClassLikeForScanning(self::VIEW_CLASS, $this->file_path);
parent::scan($codebase, $file_storage, $storage_from_cache, $progress);
parent::scan($codebase, $file_storage, $storage_from_cache, $debug_output);
}
}
@@ -12,8 +12,6 @@
use Psalm\Internal\Provider\FileStorageProvider;
use Psalm\Internal\Provider\Providers;
use Psalm\Internal\Provider\StatementsProvider;
use Psalm\Progress\Progress;
use Psalm\Progress\DefaultProgress;
use Psalm\Storage\ClassLikeStorage;
use Psalm\Storage\FileStorage;
use Psalm\Storage\FunctionLikeStorage;
@@ -82,9 +80,9 @@ class Codebase
public $statements_provider;
/**
* @var Progress
* @var bool
*/
private $progress;
private $debug_output = false;
/**
* @var array<string, Type\Union>
@@ -192,22 +190,22 @@ class Codebase
*/
public $php_minor_version = PHP_MINOR_VERSION;
/**
* @param bool $debug_output
*/
public function __construct(
Config $config,
Providers $providers,
Progress $progress = null
$debug_output = false
) {
if ($progress === null) {
$progress = new DefaultProgress();
}
$this->config = $config;
$this->file_storage_provider = $providers->file_storage_provider;
$this->classlike_storage_provider = $providers->classlike_storage_provider;
$this->progress = $progress;
$this->debug_output = $debug_output;
$this->file_provider = $providers->file_provider;
$this->file_reference_provider = $providers->file_reference_provider;
$this->statements_provider = $providers->statements_provider;
$this->debug_output = $debug_output;
self::$stubbed_constants = [];
@@ -220,7 +218,7 @@ public function __construct(
$providers->file_provider,
$this->reflection,
$providers->file_reference_provider,
$progress
$debug_output
);
$this->loadAnalyzer();
@@ -252,7 +250,7 @@ public function __construct(
$providers->file_storage_provider,
$this->classlikes,
$providers->file_reference_provider,
$progress
$debug_output
);
$this->loadAnalyzer();
@@ -267,7 +265,7 @@ private function loadAnalyzer()
$this->config,
$this->file_provider,
$this->file_storage_provider,
$this->progress
$this->debug_output
);
}
@@ -415,7 +413,7 @@ public function getStatementsForFile($file_path)
{
return $this->statements_provider->getStatementsForFile(
$file_path,
$this->progress
$this->debug_output
);
}
@@ -17,8 +17,6 @@
use Psalm\Internal\Scanner\FileScanner;
use Psalm\Plugin\Hook;
use Psalm\PluginRegistrationSocket;
use Psalm\Progress\Progress;
use Psalm\Progress\DefaultProgress;
use SimpleXMLElement;
class Config
@@ -1436,14 +1434,12 @@ public function getMockClasses()
}
/**
* @param bool $debug
*
* @return void
*/
public function visitStubFiles(Codebase $codebase, Progress $progress = null)
public function visitStubFiles(Codebase $codebase, $debug = false)
{
if ($progress === null) {
$progress = new DefaultProgress();
}
$codebase->register_stub_files = true;
// note: don't realpath $generic_stubs_path, or phar version will fail
@@ -1472,11 +1468,15 @@ public function visitStubFiles(Codebase $codebase, Progress $progress = null)
$codebase->scanner->addFileToShallowScan($file_path);
}
$progress->debug('Registering stub files' . "\n");
if ($debug) {
echo 'Registering stub files' . "\n";
}
$codebase->scanFiles();
$progress->debug('Finished registering stub files' . "\n");
if ($debug) {
echo 'Finished registering stub files' . "\n";
}
$codebase->register_stub_files = false;
}
@@ -1546,17 +1546,15 @@ public function collectPredefinedFunctions()
}
/**
* @param bool $debug
*
* @return void
*
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedArrayAccess
*/
public function visitComposerAutoloadFiles(ProjectAnalyzer $project_analyzer, Progress $progress = null)
public function visitComposerAutoloadFiles(ProjectAnalyzer $project_analyzer, $debug = false)
{
if ($progress === null) {
$progress = new DefaultProgress();
}
$this->collectPredefinedConstants();
$this->collectPredefinedFunctions();
@@ -1612,11 +1610,15 @@ public function visitComposerAutoloadFiles(ProjectAnalyzer $project_analyzer, Pr
$codebase->scanner->addFileToDeepScan($file_path);
}
$progress->debug('Registering autoloaded files' . "\n");
if ($debug) {
echo 'Registering autoloaded files' . "\n";
}
$codebase->scanner->scanFiles($codebase->classlikes);
$progress->debug('Finished registering autoloaded files' . "\n");
if ($debug) {
echo 'Finished registering autoloaded files' . "\n";
}
$codebase->register_autoload_files = false;
}
@@ -1370,9 +1370,9 @@ private function analyzeClassMethod(
&& !$class_context->collect_mutations
&& !$is_fake
) {
$project_analyzer->progress->debug(
'Skipping analysis of pre-analyzed method ' . $analyzed_method_id . "\n"
);
if ($project_analyzer->debug_output) {
echo 'Skipping analysis of pre-analyzed method ' . $analyzed_method_id . "\n";
}
$existing_issues = $codebase->analyzer->getExistingIssuesForFile(
$source->getFilePath(),

0 comments on commit 4302596

Please sign in to comment.
You can’t perform that action at this time.