path = $info->getPathname(); try { // SplFileInfo::getRealPath will return cwd when path is '' if ('' !== $this->path && $info->getRealPath()) { $this->filesize = $info->getSize(); } } catch (RuntimeException $e) { if (false === \strpos($e->getMessage(), ' open_basedir ')) { throw $e; // @codeCoverageIgnore } } } public function getHint(): string { return parent::getHint() ?? 'splfileinfo'; } /** @psalm-api */ public function getFileSize(): ?int { return $this->filesize; } public function getDisplaySize(): ?string { if (null === $this->filesize) { return null; } $size = Utils::getHumanReadableBytes($this->filesize); return $size['value'].$size['unit']; } public function getDisplayValue(): ?string { $shortpath = Utils::shortenPath($this->path); if ($shortpath !== $this->path) { return $shortpath; } return parent::getDisplayValue(); } }