yiisoft / yii2-apidoc

Yii 2 apidoc extension.
https://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
258 stars 121 forks source link

visibility is empty #284

Closed nadar closed 2 years ago

nadar commented 2 years ago

Its seems that with version ^3.0 the visibility of methods and properties always returns an empty array, instead of a string with the value f.e public.

Example file: https://github.com/luyadev/luya/blob/master/core/TagParser.php

we use the cli command to generate a json, here is a partial output of that file from above:

"luya\\TagParser": {
        "parentClass": "yii\\base\\BaseObject",
        "isAbstract": false,
        "isFinal": false,
        "interfaces": [
            "yii\\base\\Configurable"
        ],
        "traits": [],
        "subclasses": [],
        "events": [],
        "constants": {
            "REGEX": {
                "definedBy": "luya\\TagParser",
                "value": "'\/(?<function>[a-z]+)\\[(?<value>.*?)\\]((?<!\\\\\\)\\((?<sub>.*?)(?<!\\\\\\)\\))?\/mi'",
                "phpDocContext": {},
                "name": "REGEX",
                "fullName": "luya\\TagParser::REGEX",
                "sourceFile": null,
                "startLine": 42,
                "endLine": 42,
                "shortDescription": "",
                "description": "",
                "since": null,
                "sinceMap": [],
                "deprecatedSince": null,
                "deprecatedReason": null,
                "tags": [
                    {},
                    {}
                ],
                "todos": []
            }
        },
        "authors": {
            "Basil Suter": "basil@nadar.io"
        },
        "methods": {
            "inject": {
                "isAbstract": false,
                "isFinal": false,
                "isStatic": true,
                "visibility": {},
                "definedBy": "luya\\TagParser",
                "sourceCode": "public static function inject($name, $config)\n{\n    self::getInstance()->addTag($name, $config);\n}\n",
                "params": {
                    "$name": {
                        "name": "$name",
                        "typeHint": "",
                        "isOptional": false,
                        "defaultValue": null,
                        "isPassedByReference": false,
                        "description": "The name of the tag on what the tag should be found. Must be [a-z] chars.",
                        "type": "string",
                        "types": [
                            "string"
                        ],
                        "sourceFile": "vendor\/luyadev\/luya\/core\/TagParser.php"
                    },
                    "$config": {
                        "name": "$config",
                        "typeHint": "",
                        "isOptional": false,
                        "defaultValue": null,
                        "isPassedByReference": false,
                        "description": "The configurable object context can be either a string with a class or a configurable array base on {{yii\\base\\BaseObject}} concept.",
                        "type": "string|array",
                        "types": [
                            "string",
                            "array"
                        ],
                        "sourceFile": "vendor\/luyadev\/luya\/core\/TagParser.php"
                    }
                },
                "exceptions": [],
                "return": null,
                "returnType": null,
                "returnTypes": null,
                "isReturnByReference": false,
                "phpDocContext": {},
                "name": "inject",
                "fullName": "luya\\TagParser::inject",
                "sourceFile": "vendor\/luyadev\/luya\/core\/TagParser.php",
                "startLine": 58,
                "endLine": 61,
                "shortDescription": "Inject a new tag with a given name and a configurable array config.",
                "description": "",
                "since": null,
                "sinceMap": [],
                "deprecatedSince": null,
                "deprecatedReason": null,
                "tags": [],
                "todos": []
            },
            "convert": {
                "isAbstract": false,
                "isFinal": false,
                "isStatic": true,
                "visibility": {},
                "definedBy": "luya\\TagParser",
                "sourceCode": "public static function convert($text)\n{\n    return self::getInstance()->processText($text);\n}\n",
                "params": {
                    "$text": {
                        "name": "$text",
                        "typeHint": "",
                        "isOptional": false,
                        "defaultValue": null,
                        "isPassedByReference": false,
                        "description": "The content where the CMS-Tags should be found and convert into Html-Tags.",
                        "type": "string",
                        "types": [
                            "string"
                        ],
                        "sourceFile": "vendor\/luyadev\/luya\/core\/TagParser.php"
                    }
                },
                "exceptions": [],
                "return": "The converted output of $text.",
                "returnType": "string",
                "returnTypes": [
                    "string"
                ],
                "isReturnByReference": false,
                "phpDocContext": {},
                "name": "convert",
                "fullName": "luya\\TagParser::convert",
                "sourceFile": "vendor\/luyadev\/luya\/core\/TagParser.php",
                "startLine": 69,
                "endLine": 72,
                "shortDescription": "Convert the CMS-Tags into HTML-Tags.",
                "description": "",
                "since": null,
                "sinceMap": [],
                "deprecatedSince": null,
                "deprecatedReason": null,
                "tags": [],
                "todos": []
            }

As you can see here, the visibility is defined but in the json, the value is empty:

https://github.com/luyadev/luya/blob/master/core/TagParser.php#L58

arogachev commented 2 years ago

Thanks for discovering this. :+1:

nadar commented 2 years ago

Thanks for the fix. Looks a bit strange right now :smile: https://luya.io/api/luya-TagParser