diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a63c58e..da0fb39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,9 +51,9 @@ jobs: - name: Run PHPUnit run: | if [[ ${{ matrix.php-version }} == '8.5' ]]; then - vendor/bin/phpunit --display-warnings --display-deprecations --display-phpunit-deprecations --display-incomplete --display-skipped --coverage-clover=coverage.xml + vendor/bin/phpunit --display-all-issues --fail-on-all-issues --do-not-fail-on-skipped --do-not-fail-on-incomplete --coverage-clover=coverage.xml else - vendor/bin/phpunit --display-warnings --display-deprecations + vendor/bin/phpunit --display-phpunit-deprecations --display-warnings --display-deprecations fi - name: Code Coverage Report diff --git a/psalm-baseline.xml b/psalm-baseline.xml index dd6f180..2bd6c76 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,12 +1,10 @@ - + - - @@ -29,59 +27,5 @@ - - - - - - - - - - - - - - - - - - - - html()]]> - _Pdf->orientation()]]> - _Pdf->pageSize()]]> - - - - - - _Pdf->html()]]> - - - - - - - - _Pdf->html()]]> - _Pdf->orientation()]]> - - - - - - - _Pdf->encoding()]]> - - - - - - - - _Pdf->html()]]> - - diff --git a/psalm.xml b/psalm.xml index c90aaac..8cdd551 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,5 +1,6 @@ - - - - - - - - - - - - - - - - - - + diff --git a/src/Pdf/CakePdf.php b/src/Pdf/CakePdf.php index ddd1e9c..1f4e30e 100644 --- a/src/Pdf/CakePdf.php +++ b/src/Pdf/CakePdf.php @@ -314,8 +314,7 @@ public function output(?string $html = null): string * Get/Set Html. * * @param string|null $html Html to set - * @return $this|string - * @psalm-return ($html is null ? string : $this) + * @return ($html is null ? string : $this) */ public function html(?string $html = null): static|string { @@ -438,8 +437,7 @@ public function crypto(string|array|null $name = null): AbstractPdfCrypto * Get/Set Page size. * * @param string|null $pageSize Page size to set - * @return $this|string - * @psalm-return ($pageSize is null ? string : $this) + * @return ($pageSize is null ? string : $this) */ public function pageSize(?string $pageSize = null): static|string { @@ -455,8 +453,7 @@ public function pageSize(?string $pageSize = null): static|string * Get/Set Orientation. * * @param string|null $orientation orientation to set - * @return $this|string - * @psalm-return ($orientation is null ? string : $this) + * @return ($orientation is null ? string : $this) */ public function orientation(?string $orientation = null): static|string { @@ -605,8 +602,7 @@ public function margin( * Get/Set bottom margin. * * @param string|int|null $margin margin to set - * @return $this|string|int|null - * @psalm-return ($margin is null ? string|int|null : $this) + * @return ($margin is null ? string|int|null : $this) */ public function marginBottom(string|int|null $margin = null): static|string|int|null { @@ -622,8 +618,7 @@ public function marginBottom(string|int|null $margin = null): static|string|int| * Get/Set left margin. * * @param string|int|null $margin margin to set - * @return $this|string|int|null - * @psalm-return ($margin is null ? string|int|null : $this) + * @return ($margin is null ? string|int|null : $this) */ public function marginLeft(string|int|null $margin = null): static|string|int|null { @@ -639,8 +634,7 @@ public function marginLeft(string|int|null $margin = null): static|string|int|nu * Get/Set right margin. * * @param string|int|null $margin margin to set - * @return $this|string|int|null - * @psalm-return ($margin is null ? string|int|null : $this) + * @return ($margin is null ? string|int|null : $this) */ public function marginRight(string|int|null $margin = null): static|string|int|null { @@ -656,8 +650,7 @@ public function marginRight(string|int|null $margin = null): static|string|int|n * Get/Set top margin. * * @param string|int|null $margin margin to set - * @return $this|string|int|null - * @psalm-return ($margin is null ? string|int|null : $this) + * @return ($margin is null ? string|int|null : $this) */ public function marginTop(string|int|null $margin = null): static|string|int|null { @@ -673,8 +666,7 @@ public function marginTop(string|int|null $margin = null): static|string|int|nul * Get/Set document title. * * @param string|null $title title to set - * @return $this|string|null - * @psalm-return ($title is null ? string|null : $this) + * @return ($title is null ? string|null : $this) */ public function title(?string $title = null): static|string|null { @@ -690,8 +682,7 @@ public function title(?string $title = null): static|string|null * Get/Set javascript delay. * * @param int|null $delay delay to set in milliseconds - * @return $this|int|null - * @psalm-return ($delay is null ? int|null : $this) + * @return ($delay is null ? int|null : $this) */ public function delay(?int $delay = null): static|int|null { @@ -708,8 +699,7 @@ public function delay(?int $delay = null): static|int|null * Waits until the status is equal to the string before rendering the pdf * * @param string|null $status status to set as string - * @return $this|string|null - * @psalm-return ($status is null ? string|null : $this) + * @return ($status is null ? string|null : $this) */ public function windowStatus(?string $status = null): static|string|null { @@ -725,8 +715,7 @@ public function windowStatus(?string $status = null): static|string|null * Get/Set protection. * * @param bool|null $protect True or false - * @return $this|bool - * @psalm-return ($protect is null ? bool : $this) + * @return ($protect is null ? bool : $this) */ public function protect(?bool $protect = null): static|bool { @@ -744,8 +733,7 @@ public function protect(?bool $protect = null): static|bool * The user password is used to control who can open the PDF document. * * @param string|null $password password to set - * @return $this|string|null - * @psalm-return ($password is null ? string|null : $this) + * @return ($password is null ? string|null : $this) */ public function userPassword(?string $password = null): static|string|null { @@ -763,8 +751,7 @@ public function userPassword(?string $password = null): static|string|null * The owner password is used to control who can modify, print, manage the PDF document. * * @param string|null $password password to set - * @return $this|string|null - * @psalm-return ($password is null ? string|null : $this) + * @return ($password is null ? string|null : $this) */ public function ownerPassword(?string $password = null): static|string|null { @@ -785,8 +772,7 @@ public function ownerPassword(?string $password = null): static|string|null * * @param array|string|bool|null $permissions Permissions to set * @throws \Cake\Core\Exception\CakeException - * @return $this|array|string|bool|null - * @psalm-return ($permissions is null ? array|string|bool|null : $this) + * @return ($permissions is null ? array|string|bool|null : $this) */ public function permissions(bool|array|string|null $permissions = null): static|array|string|bool|null { @@ -827,8 +813,7 @@ public function permissions(bool|array|string|null $permissions = null): static| * * @param string|bool|null $cache Cache config name to use, If true is passed, 'cake_pdf' will be used. * @throws \Cake\Core\Exception\CakeException - * @return $this|string|false - * @psalm-return ($cache is null ? string|false : $this) + * @return ($cache is null ? string|false : $this) */ public function cache(bool|string|null $cache = null): static|string|false { @@ -882,8 +867,7 @@ public function template(string|false|null $template = false, ?string $layout = * Template path * * @param ?string $templatePath The path of the template to use - * @return $this|string - * @psalm-return ($templatePath is null ? string : $this) + * @return ($templatePath is null ? string : $this) */ public function templatePath(?string $templatePath = null): static|string { @@ -900,8 +884,7 @@ public function templatePath(?string $templatePath = null): static|string * Layout path * * @param ?string $layoutPath The path of the layout file to use - * @return $this|string - * @psalm-return ($layoutPath is null ? string : $this) + * @return ($layoutPath is null ? string : $this) */ public function layoutPath(?string $layoutPath = null): static|string { @@ -918,8 +901,7 @@ public function layoutPath(?string $layoutPath = null): static|string * View class for render * * @param string|null $viewClass name of the view class to use - * @return $this|string - * @psalm-return ($viewClass is null ? string : $this) + * @return ($viewClass is null ? string : $this) */ public function viewRender(?string $viewClass = null): static|string { @@ -935,8 +917,7 @@ public function viewRender(?string $viewClass = null): static|string * Variables to be set on render * * @param array $viewVars view variables to set - * @return $this|array - * @psalm-return ($viewVars is null ? array : $this) + * @return ($viewVars is null ? array : $this) */ public function viewVars(?array $viewVars = null): static|array { @@ -952,8 +933,7 @@ public function viewVars(?array $viewVars = null): static|array * Theme to use when rendering * * @param string $theme theme to use - * @return $this|string|null - * @psalm-return ($theme is null ? string|null : $this) + * @return ($theme is null ? string|null : $this) */ public function theme(?string $theme = null): static|string|null { diff --git a/tests/TestCase/Pdf/Engine/WkHtmlToPdfEngineTest.php b/tests/TestCase/Pdf/Engine/WkHtmlToPdfEngineTest.php index ca4bc23..95a8033 100644 --- a/tests/TestCase/Pdf/Engine/WkHtmlToPdfEngineTest.php +++ b/tests/TestCase/Pdf/Engine/WkHtmlToPdfEngineTest.php @@ -25,7 +25,6 @@ public function testGetCommand() $class = new ReflectionClass(WkHtmlToPdfEngine::class); $method = $class->getMethod('_getCommand'); - $method->setAccessible(true); $Pdf = new CakePdf([ 'engine' => [ @@ -160,7 +159,6 @@ public function testCoverUrlMissing() $class = new ReflectionClass(WkHtmlToPdfEngine::class); $method = $class->getMethod('_getCommand'); - $method->setAccessible(true); $Pdf = new CakePdf([ 'engine' => [ 'className' => 'CakePdf.WkHtmlToPdf',