Skip to content

Commit

Permalink
Fix phpstan analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 committed Sep 4, 2023
1 parent 424a223 commit 4cebb06
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 30 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\(\)\.#'
41 changes: 24 additions & 17 deletions src/Facade/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,33 @@

namespace Barryvdh\DomPDF\Facade;

use Barryvdh\DomPDF\PDF as BasePDF;
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')
*
* @method static BasePDF setBaseHost(string $baseHost)
* @method static BasePDF setBasePath(string $basePath)
* @method static BasePDF setCanvas(\Dompdf\Canvas $canvas)
* @method static BasePDF setCallbacks(array $callbacks)
* @method static BasePDF setCss(\Dompdf\Css\Stylesheet $css)
* @method static BasePDF setDefaultView(string $defaultView, array $options)
* @method static BasePDF setDom(\DOMDocument $dom)
* @method static BasePDF setFontMetrics(\Dompdf\FontMetrics $fontMetrics)
* @method static BasePDF setHttpContext(resource|array $httpContext)
* @method static BasePDF setPaper(string|float[] $paper, string $orientation = 'portrait')
* @method static BasePDF setProtocol(string $protocol)
* @method static BasePDF setTree(\Dompdf\Frame\FrameTree $tree)
* @method static BasePDF setWarnings(bool $warnings)
* @method static BasePDF setOption(array|string $attribute, $value = null)
* @method static BasePDF setOptions(array $options)
* @method static BasePDF loadView(string $view, array $data = [], array $mergeData = [], ?string $encoding = null)
* @method static BasePDF loadHTML(string $string, ?string $encoding = null)
* @method static BasePDF loadFile(string $file)
* @method static BasePDF addInfo(array $info)
* @method static string output(array $options = [])
* @method static BasePDF save()
* @method static \Illuminate\Http\Response download(string $filename = 'document.pdf')
* @method static \Illuminate\Http\Response stream(string $filename = 'document.pdf')
*/
class Pdf extends IlluminateFacade
{
Expand Down
36 changes: 25 additions & 11 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 PDF setBaseHost(string $baseHost)
* @method PDF setBasePath(string $basePath)
* @method PDF setCanvas(\Dompdf\Canvas $canvas)
* @method PDF setCallbacks(array $callbacks)
* @method PDF setCss(\Dompdf\Css\Stylesheet $css)
* @method PDF setDefaultView(string $defaultView, array $options)
* @method PDF setDom(\DOMDocument $dom)
* @method PDF setFontMetrics(\Dompdf\FontMetrics $fontMetrics)
* @method PDF setHttpContext(resource|array $httpContext)
* @method PDF setPaper(string|float[] $paper, string $orientation = 'portrait')
* @method PDF setProtocol(string $protocol)
* @method PDF setTree(\Dompdf\Frame\FrameTree $tree)
* @method string getBaseHost()
* @method string getBasePath()
* @method \Dompdf\Canvas getCanvas()
* @method array getCallbacks()
* @method \Dompdf\Css\Stylesheet getCss()
* @method \DOMDocument getDom()
* @method \Dompdf\FontMetrics getFontMetrics()
* @method resource getHttpContext()
* @method Options getOptions()
* @method \Dompdf\Frame\FrameTree getTree()
* @method string getPaperOrientation()
* @method float[] getPaperSize()
* @method 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 Down Expand Up @@ -104,7 +120,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 @@ -131,7 +146,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 4cebb06

Please sign in to comment.