callable_bag = $bag; if ($this->callable_bag->internal) { $this->definition_rep = null; return; } /** * @psalm-var string $this->callable_bag->filename * @psalm-var int $this->callable_bag->startline * Psalm issue #11121 */ $this->definition_rep = new CallableDefinitionRepresentation( $this->callable_bag->filename, $this->callable_bag->startline, $this->callable_bag->docstring ); $this->addRepresentation($this->definition_rep); } public function getHint(): string { return parent::getHint() ?? 'callable'; } public function getContext(): MethodContext { /** * @psalm-var MethodContext $this->context * Psalm discuss #11116 */ return $this->context; } public function getCallableBag(): DeclaredCallableBag { return $this->callable_bag; } /** @psalm-api */ public function getDefinitionRepresentation(): ?CallableDefinitionRepresentation { return $this->definition_rep; } public function getFullyQualifiedDisplayName(): string { $c = $this->getContext(); return $c->owner_class.'::'.$c->getName().'('.$this->callable_bag->getParams().')'; } public function getDisplayName(): string { $c = $this->getContext(); if ($c->static || (ClassDeclaredContext::ACCESS_PRIVATE === $c->access && $c->inherited)) { return $this->getFullyQualifiedDisplayName(); } return $c->getName().'('.$this->callable_bag->getParams().')'; } public function getDisplayValue(): ?string { if ($this->definition_rep instanceof CallableDefinitionRepresentation) { return $this->definition_rep->getDocstringFirstLine(); } return parent::getDisplayValue(); } public function getPhpDocUrl(): ?string { if (!$this->callable_bag->internal) { return null; } $c = $this->getContext(); $class = \str_replace('\\', '-', \strtolower($c->owner_class)); $funcname = \str_replace('_', '-', \strtolower($c->getName())); if (0 === \strpos($funcname, '--') && 0 !== \strpos($funcname, '-', 2)) { $funcname = \substr($funcname, 2); } return 'https://www.php.net/'.$class.'.'.$funcname; } }