Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

I am running phpDocumentor on Windows using phpDocumentor.phar. I run the following command: php phpDocumentor.phar run -d [class directory] -t [output directory] The program scans my files correctly ...
Allen Yu's user avatar
0 votes
0 answers
45 views

I have a bunch of common reusable classes stored in a "repo" folder hierarchy. Each class has its own file, each file has a namespace coherent with its place in the folder hierarchy. I ...
fpierrat's user avatar
  • 818
2 votes
2 answers
145 views

I'm looking at the code of Laravel Fortify. In the service provider, you can register Action classes to perform specific jobs like this: Fortify::createUsersUsing(CreateNewUser::class); Fortify::...
Alex's user avatar
  • 3,099
0 votes
0 answers
17 views

I have a compose.yml and Dockerfile in the same directory. compose.yml contains: services: documentation: build: context: . args: GID: 1000 GROUP: my-name ...
saven41's user avatar
  • 47
1 vote
1 answer
103 views

I need to run tests on a certain class, but adding a method that was not originally present. Previously this need could be satisfied using MockBuilder::addMethods(), but this method has been ...
Mirko Pagliai's user avatar
0 votes
1 answer
73 views

Assume that in a template.phtml, there is a property someInstance of the class SomeClass defined on $this. So in the file, one has access to: $this->someInstance yet the developer has no immediate ...
k0pernikus's user avatar
  • 67.7k
1 vote
1 answer
142 views

There is a Illuminate\Database\Schema\ColumnDefinition class in the laravel/framework package. How can I extend its PHPDoc @method annotations externally? This is a special class by Fluent, for ...
rozsazoltan's user avatar
  • 18.7k
0 votes
0 answers
78 views

This is old PHP 5 code and is probably coded wrong (it doesn't use typical autoloading), but I'm flummoxed as to how to get the editor to know which class an object in a call is using, like this: $...
Codelicus's user avatar
0 votes
0 answers
69 views

I have the following code: $id = $ui->getWidget('import_id')->value; I know the class type of $ui. The getWidget() method can return one or more types of widget classes based on the parameter ...
Colin's user avatar
  • 2,249
0 votes
1 answer
42 views

I am trying to create a link from one page in the documentation to another in a .rst file: Link to another page :doc:`Another Page` However when I run PHPDocumentor php phpDocumentor.phar -c .\phpdoc....
vogomatix's user avatar
  • 5,135
3 votes
0 answers
92 views

I've added roughly the following PHPDoc to document a class, using markdown style backticks to add an example of the classes usage /** * This is some documentation for a class * * usage: * * ``...
Patrick Benjamin's user avatar
0 votes
0 answers
75 views

My project has a number of Controllers with $data arrays that are then passed to \Illuminate\Contracts\Routing\ResponseFactory::view::getResponse. Other developers on my team will often add new keys ...
Tyler V.'s user avatar
  • 2,581
0 votes
0 answers
122 views

I'm working with PHP and I've encountered a challenge with IDE support for typed arrays. Here's a snippet of my code: <?php class User extends BaseData { public function __construct( ...
underwear's user avatar
1 vote
1 answer
257 views

I've got following code: <?php /** * @template T */ abstract class A { /** * @return T */ public function read() { // return statement } } class C {} /** * @...
M-Zoldak's user avatar
  • 158
0 votes
0 answers
43 views

I have a table that stores encrypted json values for some sensitive data. The issue is that the json properties may alter slightly based on the type of record. To overcome this, I created data ...
Jaquarh's user avatar
  • 6,749
0 votes
0 answers
670 views

I´m trying to solve errors in my proyect with larastan. One error that this library, returned it´s: Access to an undefined property App\Cargador\Prevalidaciones\PrevalidarCodificacionUTF8::$tarea ...
scorpions77's user avatar
2 votes
1 answer
142 views

I have this code /** @var array{total: integer, records: array} $response */ $response = $this->getResponse(); foreach($response['total'] as $value) { $this->saveRecord($value); } Shouldn'...
ononononon's user avatar
  • 1,103
1 vote
0 answers
56 views

now I have this: class UserProvider { protected string $className = User::class; /** * @param User $entity */ public function getData($entity): array { $data['name'] ...
fico7489's user avatar
  • 8,670
0 votes
0 answers
266 views

I'm having an issue in type-checking some methods of a trait. I'm using a sort of facade-pattern and my aim would be to inject some methods of a facade in other classes through a trait that has ...
Andrea's user avatar
  • 1
1 vote
0 answers
1k views

Is there a way to use class constants to define array shapes in phpstan? The purpose is to enable the definition to be used by PHP code, otherwise we have to repeat the definition (once for phpstan ...
caponica's user avatar
  • 3,988
1 vote
1 answer
1k views

I have an eloquent model in Laravel that I would like to mark an user_id attribute as deprecated using the @deprectated tag in PHPDoc. I can add the @property tag to my model to document user_id but ...
Jamie Woods's user avatar
1 vote
2 answers
425 views

For $item there's a polymorphic loggable relationship. In the database this is stored in items as loggable_type and loggable_id (for PHP 8+ in and Laravel). for($items as $item) { // ... if ($...
Patrick Nomad's user avatar
0 votes
1 answer
68 views

Consider: abstract class BaseModel { protected static string $dataObjectClass; public function toDataObject(): ?IDataObject { return static::$dataObjectClass::from($this); } } ...
Rikaelus's user avatar
  • 627
1 vote
2 answers
108 views

Is it possible to specify, either in plain PHP 8+ or PHPDoc that a function return value must be used, like the Rust equivalent? Imagine a function: public function doSomething(): ImportantObject { ...
Simao Gomes Viana's user avatar
0 votes
0 answers
123 views

I have this collection and would like to annotate the correct PHPDoc for this collection. Would it be Collection<string>? Illuminate\Support\Collection^ {#525 #items: array:3 [ 0 => &...
MartinTTS's user avatar
  • 459
4 votes
1 answer
6k views

I'm using PHPStan for static analysis in my PHP 8.4.2 project, and I'm encountering an issue with a class method that returns multiple types or null. Here's my method with type hints and PHPDoc ...
Scudo's user avatar
  • 51
0 votes
0 answers
129 views

Simplified code: Model: /** * @return array{name:string,age:int,group:int} */ public function fetchStudent($id){ //fetch $id student from db and return array (...) } My controller: $students = ...
Joey's user avatar
  • 419
2 votes
0 answers
1k views

I cannot figure how to annotate an array returned from API Response. Response have a structure: array{'totalCount': numeric-string, $vehicleType: array} Instead of variable $vehicleType there can be ...
ionov-e's user avatar
  • 21
2 votes
1 answer
1k views

This github file contains this auto-generated phpdoc comment /** * ... * <autodoc generated by `composer phpdoc`> * * @property int $year * @property int ...
aym's user avatar
  • 175
3 votes
2 answers
4k views

I have an example function in PHP (8.2) that returns an array. Inside this array there is also an object, more precisely stdClass. I use PHPStan as a static analyzer tool. How can I specify this (...
WebDevPassion's user avatar
0 votes
1 answer
510 views

Is it possible to link to another method/class/property/etc of my project, inline inside the @param tag? Like this: /** * My method's description. * * @param string $myArg Pass here result of {@...
Top-Master's user avatar
  • 9,039
0 votes
1 answer
98 views

I'm refactoring a huge amount of code which has all function documented in simple comments like this: //This is foo funtion function foo($foo) { } And my goal is to make it looks like this: /** ...
Geckon01's user avatar
0 votes
0 answers
52 views

We have some magic behaviour that adds additional features to class. Right now we have lots of similar code: /** * @see \App\Behaviour::someMethod * @method mixed someMethod(string ...$params) * * ...
Justinas's user avatar
  • 43.9k
0 votes
1 answer
539 views

An example is better than any explaining: Let's say I have the following code function arrayToIdMap(array $models) : array { $result = []; foreach ($models as $model) { /** @var ...
cr001's user avatar
  • 703
0 votes
0 answers
29 views

I am trying to document php project using doxygen and have a problem. In the project that I am working on, developers often use the @property tag. PHPDoc supports it and calls it the "Magic" ...
Fill Freeman's user avatar
0 votes
0 answers
267 views

I'am using PhpStorm and have started using @template annotations. However, I have trouble understanding exactly how they work in relation to @throws tags. Here are some examples (of fantasy) to ...
Mirko Pagliai's user avatar
2 votes
1 answer
1k views

When using phpdoc doc blocks, is it possible to describe the keys for an array? /** * @var array */ private $smtpSettings = array( 'SMTPDebug' => (bool)true, 'SMTPSecure' =>...
Marl's user avatar
  • 31
2 votes
0 answers
1k views

This is all happening for me in PhpStorm 2022.2.1 I've been trying to set up a class in PHP that supports Generics, but to no avail. No matter what I tried, PhpStorm always type hints as mixed. Here ...
Amelia J.'s user avatar
  • 126
2 votes
1 answer
93 views

I have a huge project with 100+ tables in my database. Over the years, we add some new columns in some tables, but we forgot to reflect this on Models phpDocs. Those phpdocs were initially generate by ...
celsowm's user avatar
  • 474
1 vote
2 answers
1k views

How can I declare my model relationships and custom attributes properly so that they will be available from auto-completion and have the warning "property accessed via magic method" ...
magicianiam's user avatar
  • 1,579
2 votes
3 answers
13k views

Any idea how to generate phpdoc on VSCode? I have installed intellisense, intelephense extensions but when I type /** it just adds */ so it becomes something like /** */ and that's all. No ...
cristisst's user avatar
0 votes
0 answers
1k views

Say I have a formatter function like this: function prepareValue(mixed $value): string { ... return "{$value}"; } /** * @param array<int, array> $astTreeData * @return ...
wakh's user avatar
  • 1
1 vote
0 answers
1k views

I'm trying to use PhpDoc to hint all the deprecated magic properties set on a Laravel Model using the mixin described in this answer. I am using JetBrains PhpStorm 2022.1.1, PHP 8.1.6 and Psalm 4.23.0 ...
Adam Hopkinson's user avatar
0 votes
0 answers
36 views

given this snippet: class Test { public function run2() { } } class Factory { public function createTest() { return new Test(); } } $factory = new Factory(); $m = '...
John Smith's user avatar
  • 6,259
1 vote
0 answers
207 views

In my php code I have a lot of places, where I need to customize the default behaviour of the programming logic for different customers. For documentation purposes I want to annonate every custom ...
Mathias Methner's user avatar
0 votes
2 answers
520 views

I have a abstract class Foo and a abstract builder FooBuilder abstract class Foo { } abstract class FooBuilder { protected Foo $model; /** * Return the class instance * * @return Model //...
André Walker's user avatar
0 votes
0 answers
72 views

I use PHPWORD library to generate .docx document with a simple table. This is the code: require "vendor/autoload.php"; $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->...
Natalya GNS's user avatar
1 vote
1 answer
158 views

PHPDoc shows a default application package, and cannot figure out how to remove it.
Lagasss's user avatar
  • 11
1 vote
0 answers
46 views

Is there any way how I can also document the thrown exceptions if the method is documented via the PHPdoc tag @method? According to the official documentation on @method this seems impossible. But ...
user2690527's user avatar
  • 1,931
0 votes
1 answer
1k views

In my code I created an EventFactory like this: private array $events = [ 'post_created' => PostCreatedEvent::class, 'exercise_executed' => ExerciseExecutedEvent::class, ]; public ...
Lorenzo Piersante's user avatar

1
2 3 4 5
19