prune-mazui/zephir-ide-helper

从 Zephir 文件 (.zep) 生成 PHP 代码补全文件。

1.2 2017-11-15 09:45 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:27:39 UTC


README

Build Status Coverage Status

从 Zephir 文件 (.zep) 生成 PHP 代码补全文件。

代码补全文件在 IDE(例如 PHPStorm)中有效。

示例

Zephir 代码

namespace PruneMazui\ZephirSample;

/**
 * Sample class Greeting
 */
class Greeting
{
    protected message = "hello world" { set, toString };

    /**
     * constructor
     *
     * @param string optional message
     */
    public function __construct(string message = null)
    {
        if message !== null {
            let this->message = message;
        }
    }

    /**
     * Output Message to stdout
     */
    public function say()
    {
        echo this->message;
    }
}

生成 PHP 代码

<?php
namespace PruneMazui\ZephirSample
{
    /**
     * Sample class Greeting
     */
    class Greeting
    {
        protected $message;

        public function setMessage($message)
        {}

        public function __toString()
        {}

        /**
         * constructor
         *
         * @param string optional message
         */
        public function __construct(string $message = null)
        {}

        /**
         * Output Message to stdout
         */
        public function say()
        {}
    }
}

要求

安装

composer require prune-mazui/zephir-ide-helper

使用

vendor/bin/zephir-ide-helper [-option] target

参数

target

指定 Zephir 文件或目录。
如果您指定了一个目录,将递归读取目录并查找 Zephir 文件。

-option

  • -f(--file) ... 指定输出的 PHP 文件名(默认:__zephir_ide_helper.php)。

许可证

MIT