This repository has been archived by the owner on Jul 18, 2018. It is now read-only.
forked from felixfbecker/php-language-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adopt Microsoft/tolerant-php-parser (felixfbecker#357)
- Loading branch information
1 parent
08cf1a3
commit 7f427a1
Showing
194 changed files
with
6,450 additions
and
1,483 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ vendor/ | |
.phpls/ | ||
composer.lock | ||
stubs | ||
*.ast |
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,27 @@ | ||
[submodule "validation/frameworks/php-language-server"] | ||
path = validation/frameworks/php-language-server | ||
url = https://github.com/felixfbecker/php-language-server | ||
[submodule "validation/frameworks/wordpress"] | ||
path = validation/frameworks/wordpress | ||
url = https://github.com/wordpress/wordpress | ||
[submodule "validation/frameworks/drupal"] | ||
path = validation/frameworks/drupal | ||
url = https://github.com/drupal/drupal | ||
[submodule "validation/frameworks/tolerant-php-parser"] | ||
path = validation/frameworks/tolerant-php-parser | ||
url = https://github.com/microsoft/tolerant-php-parser | ||
[submodule "validation/frameworks/symfony"] | ||
path = validation/frameworks/symfony | ||
url = https://github.com/symfony/symfony | ||
[submodule "validation/frameworks/math-php"] | ||
path = validation/frameworks/math-php | ||
url = https://github.com/markrogoyski/math-php | ||
[submodule "validation/frameworks/codeigniter"] | ||
path = validation/frameworks/codeigniter | ||
url = https://github.com/bcit-ci/codeigniter | ||
[submodule "validation/frameworks/cakephp"] | ||
path = validation/frameworks/cakephp | ||
url = https://github.com/cakephp/cakephp | ||
[submodule "validation/frameworks/phpunit"] | ||
path = validation/frameworks/phpunit | ||
url = https://github.com/sebastianbergmann/phpunit |
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,65 @@ | ||
<?php | ||
|
||
namespace LanguageServer\Tests; | ||
require __DIR__ . '/vendor/autoload.php'; | ||
|
||
use Exception; | ||
use LanguageServer\Index\Index; | ||
use LanguageServer\PhpDocument; | ||
use LanguageServer\DefinitionResolver; | ||
use Microsoft\PhpParser; | ||
use phpDocumentor\Reflection\DocBlockFactory; | ||
use RecursiveDirectoryIterator; | ||
use RecursiveIteratorIterator; | ||
|
||
$totalSize = 0; | ||
|
||
$frameworks = ["drupal", "wordpress", "php-language-server", "tolerant-php-parser", "math-php", "symfony", "CodeIgniter", "cakephp"]; | ||
|
||
foreach($frameworks as $framework) { | ||
$iterator = new RecursiveDirectoryIterator(__DIR__ . "/validation/frameworks/$framework"); | ||
$testProviderArray = array(); | ||
|
||
foreach (new RecursiveIteratorIterator($iterator) as $file) { | ||
if (strpos((string)$file, ".php") !== false) { | ||
$totalSize += $file->getSize(); | ||
$testProviderArray[] = $file->getPathname(); | ||
} | ||
} | ||
|
||
if (count($testProviderArray) === 0) { | ||
throw new Exception("ERROR: Validation testsuite frameworks not found - run `git submodule update --init --recursive` to download."); | ||
} | ||
|
||
$start = microtime(true); | ||
|
||
foreach ($testProviderArray as $idx => $testCaseFile) { | ||
if (filesize($testCaseFile) > 10000) { | ||
continue; | ||
} | ||
if ($idx % 1000 === 0) { | ||
echo "$idx\n"; | ||
} | ||
|
||
$fileContents = file_get_contents($testCaseFile); | ||
|
||
$docBlockFactory = DocBlockFactory::createInstance(); | ||
$index = new Index; | ||
$maxRecursion = []; | ||
$definitions = []; | ||
|
||
$definitionResolver = new DefinitionResolver($index); | ||
$parser = new PhpParser\Parser(); | ||
|
||
try { | ||
$document = new PhpDocument($testCaseFile, $fileContents, $index, $parser, $docBlockFactory, $definitionResolver); | ||
} catch (\Throwable $e) { | ||
continue; | ||
} | ||
} | ||
|
||
echo "------------------------------\n"; | ||
|
||
echo "Time [$framework]: " . (microtime(true) - $start) . PHP_EOL; | ||
} | ||
|
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
Oops, something went wrong.