Skip to content

Commit

Permalink
Redundant annotations removed
Browse files Browse the repository at this point in the history
  • Loading branch information
solcik committed Mar 11, 2018
1 parent ae61310 commit 75faa22
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 109 deletions.
7 changes: 0 additions & 7 deletions src/DI/WkhtmltopdfExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ class WkhtmltopdfExtension extends Nette\DI\CompilerExtension
];


/**
* @return void
*/
public function loadConfiguration(): void
{
$builder = $this->getContainerBuilder();
Expand All @@ -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) {
Expand Down
47 changes: 3 additions & 44 deletions src/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -90,9 +83,6 @@ public function getHeader(): Kdyby\Wkhtmltopdf\PageMeta
}


/**
* @return Kdyby\Wkhtmltopdf\PageMeta
*/
public function getFooter(): Kdyby\Wkhtmltopdf\PageMeta
{
if ($this->footer === null) {
Expand All @@ -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
{
Expand All @@ -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();
Expand All @@ -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;

Expand All @@ -153,20 +132,13 @@ 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;
return $this;
}


/**
* @return Kdyby\Wkhtmltopdf\Page
*/
private function createPage(): Kdyby\Wkhtmltopdf\Page
{
$page = new Page;
Expand All @@ -180,8 +152,6 @@ private function createPage(): Kdyby\Wkhtmltopdf\Page

/**
* @internal
* @param string
* @return string
*/
public function saveTempFile(string $content): string
{
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -244,8 +211,6 @@ public function save(string $file): void

/**
* Returns PDF document as string.
*
* @return string
*/
public function __toString(): string
{
Expand All @@ -261,9 +226,6 @@ public function __toString(): string
}


/**
* @return void
*/
private function convert(): void
{
$args = [
Expand Down Expand Up @@ -303,9 +265,6 @@ private function convert(): void
}


/**
* @return void
*/
private function close(): void
{
$this->process->close();
Expand Down
7 changes: 0 additions & 7 deletions src/DocumentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,13 @@ class DocumentFactory
private $executable;


/**
* @param string
* @param string
*/
public function __construct(string $tempDir, string $executable)
{
$this->tempDir = $tempDir;
$this->executable = $executable;
}


/**
* @return Kdyby\Wkhtmltopdf\Document
*/
public function create(): Kdyby\Wkhtmltopdf\Document
{
return new Document($this->tempDir, $this->executable);
Expand Down
4 changes: 0 additions & 4 deletions src/IDocumentPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,5 @@
*/
interface IDocumentPart
{
/**
* @param Kdyby\Wkhtmltopdf\Document
* @return array
*/
function buildShellArgs(Document $document): array;
}
4 changes: 0 additions & 4 deletions src/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
7 changes: 0 additions & 7 deletions src/PageMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
21 changes: 2 additions & 19 deletions src/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -108,25 +96,20 @@ public function getOutput(int $length = null): string

/**
* @param resource
* @return void
*/
public function copyOutputTo($stream): void
{
stream_copy_to_stream($this->pipes[1], $stream);
}


/**
* @return string
*/
public function getErrorOutput(): string
{
return stream_get_contents($this->pipes[2]);
}


/**
* @return void
* @throws \RuntimeException
*/
public function close(): void
Expand Down
4 changes: 0 additions & 4 deletions src/Toc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
6 changes: 0 additions & 6 deletions src/Utils/XvfbWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions tests/KdybyTests/Wkhtmltopdf/Extension.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace KdybyTests\Translation;

use Kdyby;
use Nette;
use Symfony;
use Tester;
use Tester\Assert;

Expand All @@ -27,8 +26,7 @@ class ExtensionTest extends Tester\TestCase
{

/**
* @param string $configFile
* @return \SystemContainer|\Nette\DI\Container
* @return \Nette\DI\Container
*/
public function createContainer()
{
Expand Down
5 changes: 1 addition & 4 deletions tests/KdybyTests/Wkhtmltopdf/Functional.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -29,9 +28,7 @@ require_once __DIR__ . '/../bootstrap.php';
class FunctionalTest extends Tester\TestCase
{

/**
* @var string
*/
/** @var string */
private $binary;


Expand Down

0 comments on commit 75faa22

Please sign in to comment.