Created
December 8, 2015 21:57
-
-
Save ablyler/02e103c7db2655d87126 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env php | |
<?php declare(strict_types=1); | |
assert(extension_loaded('ast'), | |
"The php-ast extension must be loaded in order for Phan to work. See https://github.com/etsy/phan#getting-it-running for more details."); | |
assert((int)phpversion()[0] >= 7, | |
"Phan requires PHP version 7 or greater. See https://github.com/etsy/phan#getting-it-running for more details."); | |
// Grab these before we define our own classes | |
$internal_class_name_list = get_declared_classes(); | |
$internal_interface_name_list = get_declared_interfaces(); | |
$internal_trait_name_list = get_declared_traits(); | |
$internal_function_name_list = get_defined_functions()['internal']; | |
require_once(__DIR__.'/src/Phan/Bootstrap.php'); | |
use \Phan\CLI; | |
use \Phan\CodeBase; | |
use \Phan\Config; | |
use \Phan\Log; | |
use \Phan\Phan; | |
// Create our CLI interface and load arguments | |
$cli = new CLI(); | |
// Set output mode to codeclimate | |
Log::setOutputMode('codeclimate'); | |
$code_base = new CodeBase( | |
$internal_class_name_list, | |
$internal_interface_name_list, | |
$internal_trait_name_list, | |
$internal_function_name_list | |
); | |
// Obtain the config | |
$codeclimate_config = json_decode(file_get_contents('/config.json'), true); | |
// Change to the codebase dir | |
chdir('/code'); | |
// Analyze the file list provided via the CLI | |
(new Phan)->analyzeFileList( | |
$code_base, | |
$codeclimate_config['include_paths'] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment