From 64802436106b3fa722d141bc5ec00d4bc827bc8e Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Fri, 30 Oct 2020 12:50:30 +0100 Subject: [PATCH] Remove redundant docblocks now that we've started typehinting --- src/PhpSpreadsheet/Comment.php | 80 +++++------------------------- src/PhpSpreadsheet/IOFactory.php | 53 +++++--------------- src/PhpSpreadsheet/Settings.php | 4 +- src/PhpSpreadsheet/Style/Style.php | 4 +- 4 files changed, 26 insertions(+), 115 deletions(-) diff --git a/src/PhpSpreadsheet/Comment.php b/src/PhpSpreadsheet/Comment.php index 12fb0e22..ca6e6c57 100644 --- a/src/PhpSpreadsheet/Comment.php +++ b/src/PhpSpreadsheet/Comment.php @@ -85,8 +85,6 @@ class Comment implements IComparable /** * Get Author. - * - * @return string */ public function getAuthor(): string { @@ -95,12 +93,8 @@ class Comment implements IComparable /** * Set Author. - * - * @param string $author - * - * @return $this */ - public function setAuthor(string $author) + public function setAuthor(string $author): self { $this->author = $author; @@ -109,8 +103,6 @@ class Comment implements IComparable /** * Get Rich text comment. - * - * @return RichText */ public function getText(): RichText { @@ -119,12 +111,8 @@ class Comment implements IComparable /** * Set Rich text comment. - * - * @param RichText $text - * - * @return $this */ - public function setText(RichText $text) + public function setText(RichText $text): self { $this->text = $text; @@ -133,8 +121,6 @@ class Comment implements IComparable /** * Get comment width (CSS style, i.e. XXpx or YYpt). - * - * @return string */ public function getWidth(): string { @@ -143,12 +129,8 @@ class Comment implements IComparable /** * Set comment width (CSS style, i.e. XXpx or YYpt). - * - * @param string $width including units (px or pt) - * - * @return $this */ - public function setWidth(string $width) + public function setWidth(string $width): self { $this->width = $width; @@ -157,8 +139,6 @@ class Comment implements IComparable /** * Get comment height (CSS style, i.e. XXpx or YYpt). - * - * @return string */ public function getHeight(): string { @@ -167,12 +147,8 @@ class Comment implements IComparable /** * Set comment height (CSS style, i.e. XXpx or YYpt). - * - * @param string $height including units (px or pt) - * - * @return $this */ - public function setHeight(string $height) + public function setHeight(string $height): self { $this->height = $height; @@ -181,8 +157,6 @@ class Comment implements IComparable /** * Get left margin (CSS style, i.e. XXpx or YYpt). - * - * @return string */ public function getMarginLeft(): string { @@ -191,12 +165,8 @@ class Comment implements IComparable /** * Set left margin (CSS style, i.e. XXpx or YYpt). - * - * @param string $margin including units (px or pt) - * - * @return $this */ - public function setMarginLeft(string $margin) + public function setMarginLeft(string $margin): self { $this->marginLeft = $margin; @@ -205,8 +175,6 @@ class Comment implements IComparable /** * Get top margin (CSS style, i.e. XXpx or YYpt). - * - * @return string */ public function getMarginTop(): string { @@ -215,12 +183,8 @@ class Comment implements IComparable /** * Set top margin (CSS style, i.e. XXpx or YYpt). - * - * @param string $margin including units (px or pt) - * - * @return $this */ - public function setMarginTop(string $margin) + public function setMarginTop(string $margin): self { $this->marginTop = $margin; @@ -229,8 +193,6 @@ class Comment implements IComparable /** * Is the comment visible by default? - * - * @return bool */ public function getVisible(): bool { @@ -239,12 +201,8 @@ class Comment implements IComparable /** * Set comment default visibility. - * - * @param bool $visibility - * - * @return $this */ - public function setVisible(bool $visibility) + public function setVisible(bool $visibility): self { $this->visible = $visibility; @@ -253,12 +211,8 @@ class Comment implements IComparable /** * Set fill color. - * - * @param Color $color - * - * @return $this */ - public function setFillColor(Color $color) + public function setFillColor(Color $color): self { $this->fillColor = $color; @@ -267,8 +221,6 @@ class Comment implements IComparable /** * Get fill color. - * - * @return Color */ public function getFillColor(): Color { @@ -277,12 +229,8 @@ class Comment implements IComparable /** * Set Alignment. - * - * @param string $alignment see Alignment::HORIZONTAL_* - * - * @return $this */ - public function setAlignment(string $alignment): string + public function setAlignment(string $alignment): self { $this->alignment = $alignment; @@ -294,17 +242,15 @@ class Comment implements IComparable * * @return string */ - public function getAlignment() + public function getAlignment(): string { return $this->alignment; } /** * Get hash code. - * - * @return string Hash code */ - public function getHashCode() + public function getHashCode(): string { return md5( $this->author . @@ -337,10 +283,8 @@ class Comment implements IComparable /** * Convert to string. - * - * @return string */ - public function __toString() + public function __toString(): string { return $this->text->getPlainText(); } diff --git a/src/PhpSpreadsheet/IOFactory.php b/src/PhpSpreadsheet/IOFactory.php index f3ce6a30..4f20ac93 100644 --- a/src/PhpSpreadsheet/IOFactory.php +++ b/src/PhpSpreadsheet/IOFactory.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; use PhpOffice\PhpSpreadsheet\Shared\File; +use PhpOffice\PhpSpreadsheet\Reader\IReader; use PhpOffice\PhpSpreadsheet\Writer\IWriter; /** @@ -37,12 +38,8 @@ abstract class IOFactory /** * Create Writer\IWriter. - * - * @param string $writerType Example: Xlsx - * - * @return Writer\IWriter */ - public static function createWriter(Spreadsheet $spreadsheet, string $writerType): Writer\IWriter + public static function createWriter(Spreadsheet $spreadsheet, string $writerType): IWriter { if (!isset(self::$writers[$writerType])) { throw new Writer\Exception("No writer found for type $writerType"); @@ -55,13 +52,9 @@ abstract class IOFactory } /** - * Create Reader\IReader. - * - * @param string $readerType Example: Xlsx - * - * @return Reader\IReader + * Create IReader. */ - public static function createReader(string $readerType): Reader\IReader + public static function createReader(string $readerType): IReader { if (!isset(self::$readers[$readerType])) { throw new Reader\Exception("No reader found for type $readerType"); @@ -74,11 +67,7 @@ abstract class IOFactory } /** - * Loads Spreadsheet from file using automatic Reader\IReader resolution. - * - * @param string $pFilename The name of the spreadsheet file - * - * @return Spreadsheet + * Loads Spreadsheet from file using automatic IReader resolution. */ public static function load(string $pFilename): Spreadsheet { @@ -88,11 +77,7 @@ abstract class IOFactory } /** - * Identify file type using automatic Reader\IReader resolution. - * - * @param string $pFilename The name of the spreadsheet file to identify - * - * @return string + * Identify file type using automatic IReader resolution. */ public static function identify(string $pFilename): string { @@ -105,13 +90,9 @@ abstract class IOFactory } /** - * Create Reader\IReader for file using automatic Reader\IReader resolution. - * - * @param string $filename The name of the spreadsheet file - * - * @return Reader\IReader + * Create Reader\IReader for file using automatic IReader resolution. */ - public static function createReaderForFile(string $filename): Reader\IReader + public static function createReaderForFile(string $filename): IReader { File::assertFile($filename); @@ -143,10 +124,6 @@ abstract class IOFactory /** * Guess a reader type from the file extension, if any. - * - * @param string $filename - * - * @return null|string */ private static function getReaderTypeFromExtension(string $filename): ?string { @@ -188,14 +165,11 @@ abstract class IOFactory /** * Register a writer with its type and class name. - * - * @param string $writerType - * @param string $writerClass */ public static function registerWriter(string $writerType, string $writerClass): void { - if (!is_a($writerClass, Writer\IWriter::class, true)) { - throw new Writer\Exception('Registered writers must implement ' . Writer\IWriter::class); + if (!is_a($writerClass, IWriter::class, true)) { + throw new Writer\Exception('Registered writers must implement ' . IWriter::class); } self::$writers[$writerType] = $writerClass; @@ -203,14 +177,11 @@ abstract class IOFactory /** * Register a reader with its type and class name. - * - * @param string $readerType - * @param string $readerClass */ public static function registerReader(string $readerType, string $readerClass): void { - if (!is_a($readerClass, Reader\IReader::class, true)) { - throw new Reader\Exception('Registered readers must implement ' . Reader\IReader::class); + if (!is_a($readerClass, IReader::class, true)) { + throw new Reader\Exception('Registered readers must implement ' . IReader::class); } self::$readers[$readerType] = $readerClass; diff --git a/src/PhpSpreadsheet/Settings.php b/src/PhpSpreadsheet/Settings.php index 1b760578..d6223528 100644 --- a/src/PhpSpreadsheet/Settings.php +++ b/src/PhpSpreadsheet/Settings.php @@ -158,9 +158,7 @@ class Settings } /** - * Gets the implementation of cache that should be used for cell collection. - * - * @return CacheInterface + * Gets the implementation of cache that is being used for cell collection. */ public static function getCache(): CacheInterface { diff --git a/src/PhpSpreadsheet/Style/Style.php b/src/PhpSpreadsheet/Style/Style.php index 012677f4..0a048e03 100644 --- a/src/PhpSpreadsheet/Style/Style.php +++ b/src/PhpSpreadsheet/Style/Style.php @@ -107,10 +107,8 @@ class Style extends Supervisor /** * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor. - * - * @return Style */ - public function getSharedComponent(): Style + public function getSharedComponent(): self { $activeSheet = $this->getActiveSheet(); $selectedCell = $this->getActiveCell(); // e.g. 'A1'