fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

10K
active users

Einenlum

question: is there a way to say in a docblock "this method has the same arguments as this other method" ?

@einenlum Are you providing anything in the docblock that's not already in the function signature? Normally the arguments should be just, there.

Otherwise, paging @jaapio

@Crell @jaapio
Let's say I have a method `run(string $foo, int $bar)` on one class and `run(bool $bar)` on another class. I want a `get()` method on a trait that calls the `run` method and automatically passes its arguments to it. Is there a way so that my IDE detects the correct arguments dynamically on `->get` for both classes?

@Crell @jaapio oh, could `@see static::run()` do the trick?

@einenlum @jaapio I'm pretty sure you can't do that. "see" is never interpreted by the use Autocomplete AFAIK.

@einenlum @Crell it looks like a valid use case for the `@method` annotation. However that forces you to reproduce the function header.

There is no valid syntax to accomplish this, if you read the code without the knowledge of the internals it's pretty unclear what is expected in 'get'. To me this feels like a design flaw which you are trying to fix with a docblocks. Although you might have valid reasons to do this.

In that case, look at the method annotation.

@einenlum I‘m curious about this too. Last time I checked the answer was a No.