mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 05:14:52 +08:00
prepare to release rc3, add dev:php-ver command
This commit is contained in:
parent
6131e1881b
commit
752b88f62d
@ -16,7 +16,7 @@ use Symfony\Component\Console\Command\ListCommand;
|
|||||||
*/
|
*/
|
||||||
class ConsoleApplication extends Application
|
class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
public const VERSION = '2.0-rc2';
|
public const VERSION = '2.0-rc3';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
|
|||||||
33
src/SPC/command/dev/PhpVerCommand.php
Normal file
33
src/SPC/command/dev/PhpVerCommand.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\command\dev;
|
||||||
|
|
||||||
|
use SPC\command\BaseCommand;
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
#[AsCommand('dev:php-ver', 'Dev command')]
|
||||||
|
class PhpVerCommand extends BaseCommand
|
||||||
|
{
|
||||||
|
public function initialize(InputInterface $input, OutputInterface $output)
|
||||||
|
{
|
||||||
|
$this->no_motd = true;
|
||||||
|
parent::initialize($input, $output);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(): int
|
||||||
|
{
|
||||||
|
// Find php from source/php-src
|
||||||
|
$file = SOURCE_PATH . '/php-src/main/php_version.h';
|
||||||
|
$result = preg_match('/#define PHP_VERSION "(\d+\.\d+\.\d+)"/', file_get_contents($file), $match);
|
||||||
|
if ($result === false) {
|
||||||
|
$this->output->writeln('<error>PHP source not found, maybe you need to extract first ?</error>');
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
$this->output->writeln('<info>' . $match[1] . '</info>');
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user