Skip to content

2.1.15

Latest
Compare
Choose a tag to compare
@tianyiw2013 tianyiw2013 released this 13 Aug 03:38

[2.1.15] - 2021-7-28

Fixed

  • Supported workspace trust.

[2.1.11] - 2021-7-21

Fixed

  • Does not work in WSL2. #13

[2.1.10] - 2021-7-9

Added

php-docblocker2.extra add scope

// settings.json
"php-docblocker2.extra": [
    {
        "content": "@since ${###:1.0.0}",
        "after": "message",
        "gapAfter": true,
        "scope": ["function", "class", "property"]
    },
    {
        "content": "hello world",
        "scope": "variable",
    },
    {
        "content": "good morning",
        "scope": "empty",
    },
    {
        "content": "how are you",
        "scope": "func,class",
    },
    {
        "content": "I am fine",
        "scope": "var,prop",
    },
],
<?php
/**
 * MyClass
 *
 * @since 1.0.0
 *
 * how are you
 */
class MyClass
{
    /**
     * name
     *
     * @since 1.0.0
     *
     * @var mixed
     * I am fine
     */
    protected $name;
    
    /**
     * myFunc
     *
     * @since 1.0.0
     *
     * @return void
     * how are you
     */
    function myFunc()
    {
    }
}

/**
 * myclass
 *
 * @var MyClass $myclass
 * hello world
 * I am fine
 */
$myclass = new MyClass;

[2.1.9] - 2021-7-9

Added

You can insert any content by setting php-docblocker2.extra. The effect is as follows: (通过设置项php-docblocker2.extra实现任意插入内容,效果如下所示:)

// settings.json
"php-docblocker2.extra": [
    {
        "content": "@since ${###:1.0.0}",
        "after": "message",
        "gapAfter": true,
    },
    {
        "before": "return",
        "gapAfter": true,
    },
    {
        "content": "@see http://php.cn",
        "gapBefore": true,
        "gapAfter": true,
    },
    "hello world",
],
<?php
// test.php
/**
 * likethis
 *
 * @since 1.0.0
 *
 * @param string $username 
 * @param string $password 
 * @param string|null $confirm_password 
 *
 * @return bool
 *
 * @see http://php.cn
 *
 * hello world
 */
function likethis(string $username, string $password, string $confirm_password = null): bool
{
}

[2.1.8] - 2021-7-9

Added

  • Add a setting defaultParameterDescription(增加设置项:默认参数描述) #9

    • false (default value) A blank placeholder, you can tab to the placeholder to complete the description. (默认为false,使用空白占位符,你可以通过Tab键定位到占位符手工输入参数描述)
    • true Use the parameter name as the description. (设为true后,将使用参数名作为参数描述)
    <?php
    /**
     * likethis
     *
     * @param string $username username
     * @return bool
     */
    function likethis(string $username): bool
    {
    }

Fixed

  • Failed to detect return type when return type contains spaces (返回类型含有空格导致返回值类型识别错误) #10
<?php
/**
 * likethis
 *
 * @return bool|int
 */
function likethis(): bool | int   
{
}

[2.1.7] - 2021-05-25

Added

Support for foreach(...as $value) with variable docblock

<?php
/** @var mixed $value  */
foreach ([] as $value) {}

/** @var mixed $value  */
foreach ([] as $key => $value) {}

Support for while($value=...) with variable docblock

<?php
/** @var mixed $value  */
while ($value = array_pop($arrs)) {}

[2.1.6] - 2021-05-24

Changed

  • Modify the default value of the option to make it more suitable for modern PHP.
    • autoIgnorePropertyType : true
    • unknownType : mixed
    • defaultMessage : name
    • useShortNames : true
    • variableInline : true
    • variableWithKey : true

Added

  • localization
    • The default language is English
    • 默认语言为英语,增加简体中文(仅新特性)

[2.1.4] - 2021-05-24

Patch By tianyiw. My English ability is very poor. Please forgive me if I have grammar mistakes.

Added

  • ★ Support for PHP8 union types ★ neild3r#150
  • ★ Support for PHP8 constructor property promotion ★ neild3r#156
  • ★ Support for variable docblock ★
  • Add param with default null neild3r#140
    • int $num=null to @param int|null $num
    • mixed $num=null to mixed $num
  • Add option autoIgnorePropertyType: no @var is generated for the property of specified types`
  • Add option unknownType: You can choose [type] or mixed
  • Add option defaultMessage: You can choose blank name(function/class/var name) or undocumented(Undocumented function) neild3r#139
  • Add option variableTemplate: Specify the default template for variables
  • Add option variableInline: If enabled, generated doc in a line. e.g. /** @var mixed */ neild3r#42
  • Add option variableWithKey: If enabled, generated document will contain a variable name. e.g. @var mixed $name neild3r#106
  • Add tag @mixin \MyClass neild3r#120
  • Add generate a PHP Attribute #[Attribute]
  • Improve the automatic detection of variable types. Such as !1 <<<EOF new class closure (string) etc.
  • Compatibility with param syntax error, including php7.3 trailing comma neild3r#153

Fixed

  • After modifying the author config, you need to restart vscode to take effect. Now the change will take effect immediately.