Questions tagged [docblocks]

A DocBlock is a specially formatted PHP comment which allows external document generators to generate documentation of APIs and helps some IDEs to interpret variable types, provide improved code completion, type hinting and debugging.

104 questions
0
votes
2 answers

PHP docblock for json_decode-d objects

I'm getting objects from JSON string in my PHP code. I want my IDE (NetBeans) to know the parameters of the objects without creating special class for them. Can I do it? It would look something like: $obj = json_decode($string); /** * @var $obj {…
Yevgeniy Afanasyev
  • 37,872
  • 26
  • 173
  • 191
0
votes
2 answers

How to maintain DocBlock comments for aliased property?

I'm having an interface from a 3rd party library (A). I'm creating an alias bar for a property foo in my project. This works fine, but I also want my alias to inherit the DocBlock comment of the property. interface A { /** * It's a number …
wintercounter
  • 7,500
  • 6
  • 32
  • 46
0
votes
1 answer

Write in a DocBlock programmaticaly Matlab Simulink

I have a Simulink model with a DocBlock inside and i would like to create a script to write inside this DocBlock. I already have this code : A = find_system('MyModel', 'BlockType', 'SubSystem', 'Mask', 'on', 'MaskType', 'DocBlock'); B =…
Lucas
  • 247
  • 3
  • 13
0
votes
0 answers

What is the correct way to indent multiline example codes in DocBlock in TypeScript file?

I have this code: /** * Title of function * * @param data JSON data * @param rules Your rules * @example * ``` * rules = { * id: ['integer', 'required'], * date_of_birth: ['iso_date', 'required'], * passport:…
netdjw
  • 5,419
  • 21
  • 88
  • 162
0
votes
1 answer

Inherit documentation from interface

I use docblocks for documenting function methods, classes... the usual. I found myself using the adapter pattern, as such, all my adapters implement a common interface and return the same things. The common interface has all the functions documented…
Alex
  • 9,215
  • 8
  • 39
  • 82
0
votes
1 answer

adding phpdoc to new files

im looking for a way to add some docblocks to a new .php file, so i can have it add the description, package name, author , etc to a new file. i have been searching for a couple days and I dont see any results on how to add just to 1 .php file,…
chris mccoy
  • 327
  • 1
  • 4
  • 11
0
votes
0 answers

Best practice on using @package and @since in a forked project

My project uses FoundationPress, a WordPress starter theme. I use Github and update my project from the parent repository with an upstream remote when the community improves the code. For the record, I've programmed a long time but almost always…
digiacom
  • 50
  • 1
  • 1
  • 6
0
votes
1 answer

Python equivelent to PHPDoc Blocks?

I am new to Python coming from PHP, I know Python has Docstrings, but how can I do this on class variables? Let's say in PHP I have: class Animal { /** * @var Noise */ public $noise } Now how would I implement this is python?…
superdee
  • 637
  • 10
  • 23
0
votes
1 answer

PHP Docbloc: change inherited method to standard link @inheritDoc - best practice?

I have a ton of lines of PHP. Many methods contain docblocks that are actually inherited from the method they override. Example: MyBaseClass { /** * @param string $first - first name * @param string $last - last name */ …
0
votes
3 answers

Source of @type tag in docblock

I found an old library that uses the @type tag inside dockblocks, more specifically to define classs properties, e.g.: /** * Mapping of database columns to attachment fields. * * @type array */ protected $_columns = array(); /** * Default…
Álvaro González
  • 142,137
  • 41
  • 261
  • 360
0
votes
1 answer

PhpStorm generate an empty doc-comments

PhpStorm generate an empty doc-comments: '/** + space' or 'alt + insert' return this: /** * */ public function getSomething(array $data): string { return implode($data); } Generation of setters or getters also do…
Odin Thunder
  • 3,284
  • 2
  • 28
  • 47
0
votes
1 answer

phpdoc how to document @return for both success and fail

i'm trying to keep my php rest server properly documents, so i was wondering how do we document that the return value can be one of 2 ? /** * send email to a user that contain reset data * it also create reset token, so if there was an old…
Zalaboza
  • 8,899
  • 16
  • 77
  • 142
0
votes
1 answer

Is there a convention in PHP to note where a function is exercised in tests?

We already have the reverse convention where in a phpUnit test docblock it is normal to use the @covers annotation. If you are looking at a piece of code it is often helpful to look at tests that exercise that logic to understand what the code is…
Jannie Theunissen
  • 28,256
  • 21
  • 100
  • 127
0
votes
1 answer

Naming callbacks and Docblock in Javascript

When I am writing code, it is very important to me to make obvious what is happening so that I (or others) don't need to waste time later on trying to re-figure everything out. I am therefore firstly seeking best practices regarding naming…
timhc22
  • 7,213
  • 8
  • 48
  • 66
0
votes
0 answers

What do you call the non-code, “code” that is often used in programming, like annotations in java, or stuff in comment blocks?

I have become particularly fascinated with the current usage of this non-code code (non code as in, its not the language of the rest of the file), and the history of such non-code code. In some cases this could be referred to as meta-programming,…
Greywire
  • 1,493
  • 4
  • 13
  • 14