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
1
vote
1 answer

Php Docblocks @version $Id$ not working with NetBeans SVN Plugin

For a project I'm working on we use SVN. So I installed the SVN Plugin for Netbeans, which works good so far. Now in the classes and other php files we're using docblocks with @version tag. I'm wondering how I make the plugin to autofill / replace…
DerFlow
  • 51
  • 6
1
vote
1 answer

PHP Docblock Type Hinting for Current Object in Magento Template?

How might I hint at what $this is in the context of a Magento template, with a DocBlock? As an example, head.phtml within the template/page/html/ directory is an object of Mage_Page_Block_Html_Head. The method I tried was:
Zachary Schuessler
  • 3,644
  • 2
  • 28
  • 43
1
vote
1 answer

PHP dynamic Page-level DocBlocks

I was wondering if there is a way to interact with the Page-level DocBlocks. My question is more specifically about wordpress plugin development, but this question has arised also in a non-wordpress environments. The reason is mainly the…
Obmerk Kronen
  • 15,619
  • 16
  • 66
  • 105
0
votes
1 answer

Can't get DocBlox to work with Netbeans

I'm trying to get Netbeans for Mac to integrate with DocBlox for documentation generation. I followed the instructions on the docblox site for integrating with netbeans, but when I actually try to generate documentation I get no output, and the…
GordonM
  • 31,179
  • 15
  • 87
  • 129
0
votes
1 answer

Is it possible to use DocBlocks with dreamweaver cs5?

I like documenting php with netbeans, but it doesn't seem to work with dreamweaver cs5.
Briefbreaddd
  • 369
  • 2
  • 3
  • 12
0
votes
1 answer

is this the correct way to doc block a callable's output in php 8.2?

I would like to properly document a PHP 8.2 inline callable's output for an array of strings. here's an example: /** @var callable $params : Array */ $params = fn() : array => array_map( $format(...), [ $fieldId, …
Shawn Naquin
  • 73
  • 10
0
votes
1 answer

Is there a docblock tag to create a subsection in the structure toolbar?

I like to use the structure toolbar in PhpStorm to jump between functions and keep a general overview over the structure of a class. However, the toolbar only shows functions for navigational points. Some classes have methods that can be understood…
0
votes
0 answers

Is adding '@throws \Exception' in PHP docblock of any use, since it is too generic?

Consider a class like below: class Test{ /** * @throws \Exception * @return void */ public function validateWithCondition($value): void { if (! someCondition($value)) { throw new \Exception("The input…
BlackPanther
  • 1,732
  • 1
  • 14
  • 19
0
votes
2 answers

How to resolve Pslam MixedReturnTypeCoersion

ERROR: MixedReturnTypeCoercion - src/Entity/User.php:98:16 - The type 'non-empty-array' is more general than the declared return type 'array' for App\Entity\User::getRoles (see https://psalm.dev/197) …
virtualLast
  • 573
  • 1
  • 5
  • 19
0
votes
1 answer

PhpStorm, docblock with object shape

I want to define object shape for autocompletion in PhpStorm. for example: $myobject = json_decode("{id:1, price:123.99}"); for arrays exists docblock: /** * @var array{id: int, price: float} */ $myArray = json_decode($jsonString, true); and…
Marek Lisiecki
  • 498
  • 6
  • 10
0
votes
1 answer

Does PHP dockblock has some kind of @mixin for interfaces?

My Visual Studio Code shows "undefined method". I want to know is it possible to "fix" it with some VSC settings or maybe there is a PHP solution. I have this class A { public function someMethodA() { // ... } } class B extends…
Ihar Aliakseyenka
  • 9,587
  • 4
  • 28
  • 38
0
votes
1 answer

Annotations: How to specify timestamps in docblocks in php

I have a mehtod that returns timestamps. I want to do something like this: class MyAwesomeService { /** * @return array */ public function myAwesomeMethod(): array { return [ 1636380000,…
Julian
  • 4,396
  • 5
  • 39
  • 51
0
votes
0 answers

Document a trait's "constant"

A PHP trait cannot declare a constant, but is it possible to declare using a DocComment (or otherwise) a constant which the trait might "use" if the class using the trait defines it? For example, imagine a class Book is a model bound to the books…
HelloPablo
  • 615
  • 1
  • 7
  • 22
0
votes
0 answers

phpDocumentor doesn't find TODO markers in my code?

When I generate API docs with phpDocumentor, the page Reports -> Markers always says No markers have been found in this project, despite I have several TODO markers in my PHP code. I have phpDocumentor v3.0.0. I run it with: php phpDocumentor.phar…
Leszek Pachura
  • 403
  • 4
  • 18
0
votes
0 answers

PhpStorm changing a specific reformat code option

$new_class = new NewClass; /** @var NewClass $new_class */ When I use PhpStorm's code format the above code becomes: $new_class = new NewClass; /** @var NewClass $new_class */ Is there anyway to make it keep these @var comments on the same line…
user12097954