Skip to content

Commit

Permalink
Fix phpstan analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 committed May 4, 2023
1 parent 424a223 commit 0452f37
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ parameters:
# This is a global alias that cannot be detected by Larastan.
- '#Call to static method loadHtml\(\) on an unknown class PDF\.#'
- '#Call to static method loadHtml\(\) on an unknown class Pdf\.#'
# This is a magic method that cannot be detected by Larastan.
- '#Call to an undefined method Dompdf\\Dompdf::loadView\(\)\.#'
17 changes: 1 addition & 16 deletions src/Facade/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,7 @@
use Illuminate\Support\Facades\Facade as IlluminateFacade;

/**
* @method static \Barryvdh\DomPDF\PDF setPaper($paper, $orientation = 'portrait')
* @method static \Barryvdh\DomPDF\PDF setBaseHost(string $baseHost)
* @method static \Barryvdh\DomPDF\PDF setProtocol(string $protocol)
* @method static \Barryvdh\DomPDF\PDF setHttpContext($httpContext)
* @method static \Barryvdh\DomPDF\PDF setCallbacks(array $callbacks)
* @method static \Barryvdh\DomPDF\PDF setWarnings($warnings)
* @method static \Barryvdh\DomPDF\PDF setOption(array|string $attribute, $value = null)
* @method static \Barryvdh\DomPDF\PDF setOptions(array $options)
* @method static \Barryvdh\DomPDF\PDF loadView($view, $data = array(), $mergeData = array(), $encoding = null)
* @method static \Barryvdh\DomPDF\PDF loadHTML($string, $encoding = null)
* @method static \Barryvdh\DomPDF\PDF loadFile($file)
* @method static \Barryvdh\DomPDF\PDF addInfo($info)
* @method static string output($options = [])
* @method static \Barryvdh\DomPDF\PDF save()
* @method static \Illuminate\Http\Response download($filename = 'document.pdf')
* @method static \Illuminate\Http\Response stream($filename = 'document.pdf')
* @mixin \Barryvdh\DomPDF\PDF
*
*/
class Pdf extends IlluminateFacade
Expand Down
39 changes: 25 additions & 14 deletions src/PDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,31 @@
* @package laravel-dompdf
* @author Barry vd. Heuvel
*
* @mixin \Dompdf\Dompdf
* @method static PDF setBaseHost(string $baseHost)
* @method static PDF setBasePath(string $basePath)
* @method static PDF setCanvas(\Dompdf\Canvas $canvas)
* @method static PDF setCallbacks(array $callbacks)
* @method static PDF setCss(\Dompdf\Css\Stylesheet $css)
* @method static PDF setDefaultView(string $defaultView, array $options)
* @method static PDF setDom(\DOMDocument $dom)
* @method static PDF setFontMetrics(\Dompdf\FontMetrics $fontMetrics)
* @method static PDF setHttpContext(resource|array $httpContext)
* @method static PDF setPaper(string|float[] $paper, string $orientation = 'portrait')
* @method static PDF setProtocol(string $protocol)
* @method static PDF setTree(\Dompdf\Frame\FrameTree $tree)
* @method static string getBaseHost()
* @method static string getBasePath()
* @method static \Dompdf\Canvas getCanvas()
* @method static array getCallbacks()
* @method static \Dompdf\Css\Stylesheet getCss()
* @method static \DOMDocument getDom()
* @method static \Dompdf\FontMetrics getFontMetrics()
* @method static resource getHttpContext()
* @method static Options getOptions()
* @method static \Dompdf\Frame\FrameTree getTree()
* @method static string getPaperOrientation()
* @method static float[] getPaperSize()
* @method static string getProtocol()
*/
class PDF
{
Expand All @@ -43,12 +67,6 @@ class PDF
/** @var string */
protected $public_path;

/**
* @param Dompdf $dompdf
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Illuminate\Filesystem\Filesystem $files
* @param \Illuminate\Contracts\View\Factory $view
*/
public function __construct(Dompdf $dompdf, ConfigRepository $config, Filesystem $files, ViewFactory $view)
{
$this->dompdf = $dompdf;
Expand All @@ -61,8 +79,6 @@ public function __construct(Dompdf $dompdf, ConfigRepository $config, Filesystem

/**
* Get the DomPDF instance
*
* @return Dompdf
*/
public function getDomPDF(): Dompdf
{
Expand All @@ -80,8 +96,6 @@ public function setWarnings(bool $warnings): self

/**
* Load a HTML string
*
* @param string|null $encoding Not used yet
*/
public function loadHTML(string $string, ?string $encoding = null): self
{
Expand All @@ -104,7 +118,6 @@ public function loadFile(string $file): self
/**
* Add metadata info
* @param array<string, string> $info
* @return static
*/
public function addInfo(array $info): self
{
Expand All @@ -118,7 +131,6 @@ public function addInfo(array $info): self
* Load a View and convert to HTML
* @param array<string, mixed> $data
* @param array<string, mixed> $mergeData
* @param string|null $encoding Not used yet
*/
public function loadView(string $view, array $data = [], array $mergeData = [], ?string $encoding = null): self
{
Expand All @@ -131,7 +143,6 @@ public function loadView(string $view, array $data = [], array $mergeData = [],
*
* @param array<string, mixed>|string $attribute
* @param null|mixed $value
* @return $this
*/
public function setOption($attribute, $value = null): self
{
Expand Down

0 comments on commit 0452f37

Please sign in to comment.