barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.62k stars 965 forks source link

Method not defined when chaining methods #971

Closed yh-ankit closed 11 months ago

yh-ankit commented 1 year ago

Describe the bug IDE and static analysis complains that the method is not defined when chaining methods

To Reproduce Steps to reproduce the behavior:

Create a controller and add the following code. Run static analysis on it like phpstan. Alternatively, inspect the return type of the chained methods in your IDE or try to go to the definition of the chained methods in the IDE. The best way to replicate is to use a static analysis tool like phpstan

$pdf = Pdf::loadView('any.random.view')->setPaper('a4', 'portrait'); // setPaper() not defined
return $pdf->download(); // static analysis complains downlaod() is not defined. Also "go to definition" in IDE doesn't work"
// OR
$pdf->save(...); // static analysis complains save() is not defined. Also "go to definition" in IDE doesn't work"

Expected behavior The methods should be defined according to the docs

erikn69 commented 1 year ago

Hi try #972 and let your review