From 75faa22579ea0cb1e4b7e10f8c82a56d1626eab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20=C5=A0olc?= Date: Sun, 11 Mar 2018 21:40:35 +0100 Subject: [PATCH] Redundant annotations removed --- src/DI/WkhtmltopdfExtension.php | 7 --- src/Document.php | 47 ++------------------ src/DocumentFactory.php | 7 --- src/IDocumentPart.php | 4 -- src/Page.php | 4 -- src/PageMeta.php | 7 --- src/Process.php | 21 +-------- src/Toc.php | 4 -- src/Utils/XvfbWrapper.php | 6 --- tests/KdybyTests/Wkhtmltopdf/Extension.phpt | 4 +- tests/KdybyTests/Wkhtmltopdf/Functional.phpt | 5 +-- 11 files changed, 7 insertions(+), 109 deletions(-) diff --git a/src/DI/WkhtmltopdfExtension.php b/src/DI/WkhtmltopdfExtension.php index a067b22..e2792df 100644 --- a/src/DI/WkhtmltopdfExtension.php +++ b/src/DI/WkhtmltopdfExtension.php @@ -28,9 +28,6 @@ class WkhtmltopdfExtension extends Nette\DI\CompilerExtension ]; - /** - * @return void - */ public function loadConfiguration(): void { $builder = $this->getContainerBuilder(); @@ -48,10 +45,6 @@ public function loadConfiguration(): void } - /** - * @param Nette\Configurator - * @return void - */ public static function register(Nette\Configurator $configurator): void { $configurator->onCompile[] = function ($config, Nette\DI\Compiler $compiler) { diff --git a/src/Document.php b/src/Document.php index e988b88..915e406 100644 --- a/src/Document.php +++ b/src/Document.php @@ -66,20 +66,13 @@ class Document implements Nette\Application\IResponse private $process; - /** - * @param string - * @param string - */ - public function __construct(string $tmpDir, string $executable = null) + public function __construct(string $tmpDir, ?string $executable = null) { $this->tmpDir = $tmpDir; $this->process = new Process($executable); } - /** - * @return Kdyby\Wkhtmltopdf\PageMeta - */ public function getHeader(): Kdyby\Wkhtmltopdf\PageMeta { if ($this->header === null) { @@ -90,9 +83,6 @@ public function getHeader(): Kdyby\Wkhtmltopdf\PageMeta } - /** - * @return Kdyby\Wkhtmltopdf\PageMeta - */ public function getFooter(): Kdyby\Wkhtmltopdf\PageMeta { if ($this->footer === null) { @@ -104,9 +94,7 @@ public function getFooter(): Kdyby\Wkhtmltopdf\PageMeta /** - * @param string|Nette\Bridges\ApplicationLatte\Template - * @param bool - * @return Kdyby\Wkhtmltopdf\Page + * @param string|Nette\Bridges\ApplicationLatte\Template $html */ public function addHtml($html, bool $isCover = false): Kdyby\Wkhtmltopdf\Page { @@ -122,11 +110,6 @@ public function addHtml($html, bool $isCover = false): Kdyby\Wkhtmltopdf\Page } - /** - * @param string - * @param bool - * @return Kdyby\Wkhtmltopdf\Page - */ public function addFile(string $file, bool $isCover = false): Kdyby\Wkhtmltopdf\Page { $this->pages[] = $page = $this->createPage(); @@ -137,11 +120,7 @@ public function addFile(string $file, bool $isCover = false): Kdyby\Wkhtmltopdf\ } - /** - * @param string - * @return Kdyby\Wkhtmltopdf\Toc - */ - public function addToc(string $header = null): Kdyby\Wkhtmltopdf\Toc + public function addToc(?string $header = null): Kdyby\Wkhtmltopdf\Toc { $this->pages[] = $toc = new Toc; @@ -153,10 +132,6 @@ public function addToc(string $header = null): Kdyby\Wkhtmltopdf\Toc } - /** - * @param Kdyby\Wkhtmltopdf\IDocumentPart - * @return Kdyby\Wkhtmltopdf\Document - */ public function addPart(IDocumentPart $part): Kdyby\Wkhtmltopdf\Document { $this->pages[] = $part; @@ -164,9 +139,6 @@ public function addPart(IDocumentPart $part): Kdyby\Wkhtmltopdf\Document } - /** - * @return Kdyby\Wkhtmltopdf\Page - */ private function createPage(): Kdyby\Wkhtmltopdf\Page { $page = new Page; @@ -180,8 +152,6 @@ private function createPage(): Kdyby\Wkhtmltopdf\Page /** * @internal - * @param string - * @return string */ public function saveTempFile(string $content): string { @@ -199,7 +169,6 @@ public function saveTempFile(string $content): string /** * Send headers and outputs PDF document to browser. * - * @return void * @throws Nette\InvalidStateException */ public function send(Nette\Http\IRequest $httpRequest, Nette\Http\IResponse $httpResponse): void @@ -228,8 +197,6 @@ public function send(Nette\Http\IRequest $httpRequest, Nette\Http\IResponse $htt /** * Save PDF document to file. * - * @param string - * @return void * @throws Nette\InvalidStateException */ public function save(string $file): void @@ -244,8 +211,6 @@ public function save(string $file): void /** * Returns PDF document as string. - * - * @return string */ public function __toString(): string { @@ -261,9 +226,6 @@ public function __toString(): string } - /** - * @return void - */ private function convert(): void { $args = [ @@ -303,9 +265,6 @@ private function convert(): void } - /** - * @return void - */ private function close(): void { $this->process->close(); diff --git a/src/DocumentFactory.php b/src/DocumentFactory.php index c07681c..1e0867e 100644 --- a/src/DocumentFactory.php +++ b/src/DocumentFactory.php @@ -31,10 +31,6 @@ class DocumentFactory private $executable; - /** - * @param string - * @param string - */ public function __construct(string $tempDir, string $executable) { $this->tempDir = $tempDir; @@ -42,9 +38,6 @@ public function __construct(string $tempDir, string $executable) } - /** - * @return Kdyby\Wkhtmltopdf\Document - */ public function create(): Kdyby\Wkhtmltopdf\Document { return new Document($this->tempDir, $this->executable); diff --git a/src/IDocumentPart.php b/src/IDocumentPart.php index 9bdf305..aeda9b9 100644 --- a/src/IDocumentPart.php +++ b/src/IDocumentPart.php @@ -18,9 +18,5 @@ */ interface IDocumentPart { - /** - * @param Kdyby\Wkhtmltopdf\Document - * @return array - */ function buildShellArgs(Document $document): array; } diff --git a/src/Page.php b/src/Page.php index b44c304..75c7da9 100644 --- a/src/Page.php +++ b/src/Page.php @@ -48,10 +48,6 @@ class Page implements Kdyby\Wkhtmltopdf\IDocumentPart public $zoom = 1; - /** - * @param Kdyby\Wkhtmltopdf\Document - * @return array - */ public function buildShellArgs(Document $document): array { $args = []; diff --git a/src/PageMeta.php b/src/PageMeta.php index 679489d..02f4da4 100644 --- a/src/PageMeta.php +++ b/src/PageMeta.php @@ -54,19 +54,12 @@ class PageMeta implements Kdyby\Wkhtmltopdf\IDocumentPart private $type; - /** - * @param string - */ public function __construct(string $type) { $this->type = $type; } - /** - * @param Kdyby\Wkhtmltopdf\Document - * @return array - */ public function buildShellArgs(Document $document): array { $args = []; diff --git a/src/Process.php b/src/Process.php index f2abc8c..bc724ab 100644 --- a/src/Process.php +++ b/src/Process.php @@ -36,18 +36,13 @@ class Process private $executedCommand; - /** - * @param string - */ - public function __construct(string $executable = null) + public function __construct(?string $executable = null) { $this->executable = $executable; } /** - * @param array - * @return void * @throws RuntimeException */ public function open(array $args): void @@ -83,20 +78,13 @@ public function open(array $args): void } - /** - * @return void - */ public function printOutput(): void { fpassthru($this->pipes[1]); } - /** - * @param int - * @return string - */ - public function getOutput(int $length = null): string + public function getOutput(?int $length = null): string { if ($length !== null) { return fgets($this->pipes[1], $length); @@ -108,7 +96,6 @@ public function getOutput(int $length = null): string /** * @param resource - * @return void */ public function copyOutputTo($stream): void { @@ -116,9 +103,6 @@ public function copyOutputTo($stream): void } - /** - * @return string - */ public function getErrorOutput(): string { return stream_get_contents($this->pipes[2]); @@ -126,7 +110,6 @@ public function getErrorOutput(): string /** - * @return void * @throws \RuntimeException */ public function close(): void diff --git a/src/Toc.php b/src/Toc.php index 7fdb708..4a566cf 100644 --- a/src/Toc.php +++ b/src/Toc.php @@ -33,10 +33,6 @@ class Toc implements Kdyby\Wkhtmltopdf\IDocumentPart public $headersSizeShrink = 0.9; - /** - * @param Kdyby\Wkhtmltopdf\Document - * @return array - */ public function buildShellArgs(Document $document): array { return [ diff --git a/src/Utils/XvfbWrapper.php b/src/Utils/XvfbWrapper.php index f4bf686..7a2fc35 100644 --- a/src/Utils/XvfbWrapper.php +++ b/src/Utils/XvfbWrapper.php @@ -26,18 +26,12 @@ class XvfbWrapper private $executable; - /** - * @param string - */ public function __construct(string $executable) { $this->executable = $executable; } - /** - * @return string - */ public function __toString(): string { return sprintf('xvfb-run -a --server-args="-screen 0, 1024x768x24" %s', $this->executable); diff --git a/tests/KdybyTests/Wkhtmltopdf/Extension.phpt b/tests/KdybyTests/Wkhtmltopdf/Extension.phpt index cb42595..17007c6 100644 --- a/tests/KdybyTests/Wkhtmltopdf/Extension.phpt +++ b/tests/KdybyTests/Wkhtmltopdf/Extension.phpt @@ -12,7 +12,6 @@ namespace KdybyTests\Translation; use Kdyby; use Nette; -use Symfony; use Tester; use Tester\Assert; @@ -27,8 +26,7 @@ class ExtensionTest extends Tester\TestCase { /** - * @param string $configFile - * @return \SystemContainer|\Nette\DI\Container + * @return \Nette\DI\Container */ public function createContainer() { diff --git a/tests/KdybyTests/Wkhtmltopdf/Functional.phpt b/tests/KdybyTests/Wkhtmltopdf/Functional.phpt index e3c6897..939b572 100644 --- a/tests/KdybyTests/Wkhtmltopdf/Functional.phpt +++ b/tests/KdybyTests/Wkhtmltopdf/Functional.phpt @@ -15,7 +15,6 @@ use Kdyby\Wkhtmltopdf\Document; use Kdyby\Wkhtmltopdf\Utils\ExecutableFinder; use Kdyby\Wkhtmltopdf\Utils\XvfbWrapper; use Nette; -use Symfony; use Tester; use Tester\Assert; @@ -29,9 +28,7 @@ require_once __DIR__ . '/../bootstrap.php'; class FunctionalTest extends Tester\TestCase { - /** - * @var string - */ + /** @var string */ private $binary;