Remove redundant docblocks now that we've started typehinting

This commit is contained in:
MarkBaker 2020-10-30 12:50:30 +01:00
parent 6966c2fed3
commit 6480243610
4 changed files with 26 additions and 115 deletions

View File

@ -85,8 +85,6 @@ class Comment implements IComparable
/** /**
* Get Author. * Get Author.
*
* @return string
*/ */
public function getAuthor(): string public function getAuthor(): string
{ {
@ -95,12 +93,8 @@ class Comment implements IComparable
/** /**
* Set Author. * Set Author.
*
* @param string $author
*
* @return $this
*/ */
public function setAuthor(string $author) public function setAuthor(string $author): self
{ {
$this->author = $author; $this->author = $author;
@ -109,8 +103,6 @@ class Comment implements IComparable
/** /**
* Get Rich text comment. * Get Rich text comment.
*
* @return RichText
*/ */
public function getText(): RichText public function getText(): RichText
{ {
@ -119,12 +111,8 @@ class Comment implements IComparable
/** /**
* Set Rich text comment. * Set Rich text comment.
*
* @param RichText $text
*
* @return $this
*/ */
public function setText(RichText $text) public function setText(RichText $text): self
{ {
$this->text = $text; $this->text = $text;
@ -133,8 +121,6 @@ class Comment implements IComparable
/** /**
* Get comment width (CSS style, i.e. XXpx or YYpt). * Get comment width (CSS style, i.e. XXpx or YYpt).
*
* @return string
*/ */
public function getWidth(): string public function getWidth(): string
{ {
@ -143,12 +129,8 @@ class Comment implements IComparable
/** /**
* Set comment width (CSS style, i.e. XXpx or YYpt). * 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; $this->width = $width;
@ -157,8 +139,6 @@ class Comment implements IComparable
/** /**
* Get comment height (CSS style, i.e. XXpx or YYpt). * Get comment height (CSS style, i.e. XXpx or YYpt).
*
* @return string
*/ */
public function getHeight(): string public function getHeight(): string
{ {
@ -167,12 +147,8 @@ class Comment implements IComparable
/** /**
* Set comment height (CSS style, i.e. XXpx or YYpt). * 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; $this->height = $height;
@ -181,8 +157,6 @@ class Comment implements IComparable
/** /**
* Get left margin (CSS style, i.e. XXpx or YYpt). * Get left margin (CSS style, i.e. XXpx or YYpt).
*
* @return string
*/ */
public function getMarginLeft(): string public function getMarginLeft(): string
{ {
@ -191,12 +165,8 @@ class Comment implements IComparable
/** /**
* Set left margin (CSS style, i.e. XXpx or YYpt). * 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; $this->marginLeft = $margin;
@ -205,8 +175,6 @@ class Comment implements IComparable
/** /**
* Get top margin (CSS style, i.e. XXpx or YYpt). * Get top margin (CSS style, i.e. XXpx or YYpt).
*
* @return string
*/ */
public function getMarginTop(): string public function getMarginTop(): string
{ {
@ -215,12 +183,8 @@ class Comment implements IComparable
/** /**
* Set top margin (CSS style, i.e. XXpx or YYpt). * 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; $this->marginTop = $margin;
@ -229,8 +193,6 @@ class Comment implements IComparable
/** /**
* Is the comment visible by default? * Is the comment visible by default?
*
* @return bool
*/ */
public function getVisible(): bool public function getVisible(): bool
{ {
@ -239,12 +201,8 @@ class Comment implements IComparable
/** /**
* Set comment default visibility. * Set comment default visibility.
*
* @param bool $visibility
*
* @return $this
*/ */
public function setVisible(bool $visibility) public function setVisible(bool $visibility): self
{ {
$this->visible = $visibility; $this->visible = $visibility;
@ -253,12 +211,8 @@ class Comment implements IComparable
/** /**
* Set fill color. * Set fill color.
*
* @param Color $color
*
* @return $this
*/ */
public function setFillColor(Color $color) public function setFillColor(Color $color): self
{ {
$this->fillColor = $color; $this->fillColor = $color;
@ -267,8 +221,6 @@ class Comment implements IComparable
/** /**
* Get fill color. * Get fill color.
*
* @return Color
*/ */
public function getFillColor(): Color public function getFillColor(): Color
{ {
@ -277,12 +229,8 @@ class Comment implements IComparable
/** /**
* Set Alignment. * 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; $this->alignment = $alignment;
@ -294,17 +242,15 @@ class Comment implements IComparable
* *
* @return string * @return string
*/ */
public function getAlignment() public function getAlignment(): string
{ {
return $this->alignment; return $this->alignment;
} }
/** /**
* Get hash code. * Get hash code.
*
* @return string Hash code
*/ */
public function getHashCode() public function getHashCode(): string
{ {
return md5( return md5(
$this->author . $this->author .
@ -337,10 +283,8 @@ class Comment implements IComparable
/** /**
* Convert to string. * Convert to string.
*
* @return string
*/ */
public function __toString() public function __toString(): string
{ {
return $this->text->getPlainText(); return $this->text->getPlainText();
} }

View File

@ -3,6 +3,7 @@
namespace PhpOffice\PhpSpreadsheet; namespace PhpOffice\PhpSpreadsheet;
use PhpOffice\PhpSpreadsheet\Shared\File; use PhpOffice\PhpSpreadsheet\Shared\File;
use PhpOffice\PhpSpreadsheet\Reader\IReader;
use PhpOffice\PhpSpreadsheet\Writer\IWriter; use PhpOffice\PhpSpreadsheet\Writer\IWriter;
/** /**
@ -37,12 +38,8 @@ abstract class IOFactory
/** /**
* Create Writer\IWriter. * 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])) { if (!isset(self::$writers[$writerType])) {
throw new Writer\Exception("No writer found for type $writerType"); throw new Writer\Exception("No writer found for type $writerType");
@ -55,13 +52,9 @@ abstract class IOFactory
} }
/** /**
* Create Reader\IReader. * Create IReader.
*
* @param string $readerType Example: Xlsx
*
* @return Reader\IReader
*/ */
public static function createReader(string $readerType): Reader\IReader public static function createReader(string $readerType): IReader
{ {
if (!isset(self::$readers[$readerType])) { if (!isset(self::$readers[$readerType])) {
throw new Reader\Exception("No reader found for type $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. * Loads Spreadsheet from file using automatic IReader resolution.
*
* @param string $pFilename The name of the spreadsheet file
*
* @return Spreadsheet
*/ */
public static function load(string $pFilename): Spreadsheet public static function load(string $pFilename): Spreadsheet
{ {
@ -88,11 +77,7 @@ abstract class IOFactory
} }
/** /**
* Identify file type using automatic Reader\IReader resolution. * Identify file type using automatic IReader resolution.
*
* @param string $pFilename The name of the spreadsheet file to identify
*
* @return string
*/ */
public static function identify(string $pFilename): string public static function identify(string $pFilename): string
{ {
@ -105,13 +90,9 @@ abstract class IOFactory
} }
/** /**
* Create Reader\IReader for file using automatic Reader\IReader resolution. * Create Reader\IReader for file using automatic IReader resolution.
*
* @param string $filename The name of the spreadsheet file
*
* @return Reader\IReader
*/ */
public static function createReaderForFile(string $filename): Reader\IReader public static function createReaderForFile(string $filename): IReader
{ {
File::assertFile($filename); File::assertFile($filename);
@ -143,10 +124,6 @@ abstract class IOFactory
/** /**
* Guess a reader type from the file extension, if any. * Guess a reader type from the file extension, if any.
*
* @param string $filename
*
* @return null|string
*/ */
private static function getReaderTypeFromExtension(string $filename): ?string private static function getReaderTypeFromExtension(string $filename): ?string
{ {
@ -188,14 +165,11 @@ abstract class IOFactory
/** /**
* Register a writer with its type and class name. * Register a writer with its type and class name.
*
* @param string $writerType
* @param string $writerClass
*/ */
public static function registerWriter(string $writerType, string $writerClass): void public static function registerWriter(string $writerType, string $writerClass): void
{ {
if (!is_a($writerClass, Writer\IWriter::class, true)) { if (!is_a($writerClass, IWriter::class, true)) {
throw new Writer\Exception('Registered writers must implement ' . Writer\IWriter::class); throw new Writer\Exception('Registered writers must implement ' . IWriter::class);
} }
self::$writers[$writerType] = $writerClass; self::$writers[$writerType] = $writerClass;
@ -203,14 +177,11 @@ abstract class IOFactory
/** /**
* Register a reader with its type and class name. * Register a reader with its type and class name.
*
* @param string $readerType
* @param string $readerClass
*/ */
public static function registerReader(string $readerType, string $readerClass): void public static function registerReader(string $readerType, string $readerClass): void
{ {
if (!is_a($readerClass, Reader\IReader::class, true)) { if (!is_a($readerClass, IReader::class, true)) {
throw new Reader\Exception('Registered readers must implement ' . Reader\IReader::class); throw new Reader\Exception('Registered readers must implement ' . IReader::class);
} }
self::$readers[$readerType] = $readerClass; self::$readers[$readerType] = $readerClass;

View File

@ -158,9 +158,7 @@ class Settings
} }
/** /**
* Gets the implementation of cache that should be used for cell collection. * Gets the implementation of cache that is being used for cell collection.
*
* @return CacheInterface
*/ */
public static function getCache(): CacheInterface public static function getCache(): CacheInterface
{ {

View File

@ -107,10 +107,8 @@ class Style extends Supervisor
/** /**
* Get the shared style component for the currently active cell in currently active sheet. * Get the shared style component for the currently active cell in currently active sheet.
* Only used for style supervisor. * Only used for style supervisor.
*
* @return Style
*/ */
public function getSharedComponent(): Style public function getSharedComponent(): self
{ {
$activeSheet = $this->getActiveSheet(); $activeSheet = $this->getActiveSheet();
$selectedCell = $this->getActiveCell(); // e.g. 'A1' $selectedCell = $this->getActiveCell(); // e.g. 'A1'