-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25658f6
commit d55933f
Showing
5 changed files
with
95 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Diagnose; | ||
|
||
use PHPStan\Command\Output; | ||
|
||
/** | ||
* DiagnoseExtension can output any diagnostic information to stderr after analysis. | ||
* | ||
* PHPStan displays this information when running the "analyse" command with "-vvv" CLI option. | ||
* | ||
* To register it in the configuration file use the `phpstan.diagnoseExtension` service tag: | ||
* | ||
* ``` | ||
* services: | ||
* - | ||
* class: App\PHPStan\MyExtension | ||
* tags: | ||
* - phpstan.diagnoseExtension | ||
* ``` | ||
* | ||
* @api | ||
*/ | ||
interface DiagnoseExtension | ||
{ | ||
|
||
public const EXTENSION_TAG = 'phpstan.diagnoseExtension'; | ||
|
||
public function print(Output $errorOutput): void; | ||
|
||
} |
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,28 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Diagnose; | ||
|
||
use PHPStan\Command\Output; | ||
use PHPStan\Internal\ComposerHelper; | ||
use PHPStan\Php\PhpVersion; | ||
use function sprintf; | ||
use const PHP_VERSION_ID; | ||
|
||
class PHPStanDiagnoseExtension implements DiagnoseExtension | ||
{ | ||
|
||
public function print(Output $errorOutput): void | ||
{ | ||
$phpRuntimeVersion = new PhpVersion(PHP_VERSION_ID); | ||
$errorOutput->writeLineFormatted(sprintf( | ||
'<info>PHP runtime version:</info> %s', | ||
$phpRuntimeVersion->getVersionString(), | ||
)); | ||
$errorOutput->writeLineFormatted(sprintf( | ||
'<info>PHPStan version:</info> %s', | ||
ComposerHelper::getPhpStanVersion(), | ||
)); | ||
$errorOutput->writeLineFormatted(''); | ||
} | ||
|
||
} |