Skip to content
Merged

CI #337

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
58 changes: 1 addition & 57 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="6.0.0@b8e96bb617bf59382113b1b56cef751f648a7dc9">
<files psalm-version="6.15.1@28dc127af1b5aecd52314f6f645bafc10d0e11f9">
<file src="src/Pdf/CakePdf.php">
<InvalidDocblock>
<code><![CDATA[public function cache(bool|string|null $cache = null): static|string|false]]></code>
<code><![CDATA[public function delay(?int $delay = null): static|int|null]]></code>
<code><![CDATA[public function encoding(?string $encoding = null): static|string]]></code>
<code><![CDATA[public function footer(string|array|null $left = null, ?string $center = null, ?string $right = null): static|array]]></code>
<code><![CDATA[public function header(string|array|null $left = null, ?string $center = null, ?string $right = null): static|array]]></code>
<code><![CDATA[public function helpers(?array $helpers = null): static|array]]></code>
<code><![CDATA[public function html(?string $html = null): static|string]]></code>
<code><![CDATA[public function layoutPath(?string $layoutPath = null): static|string]]></code>
Expand All @@ -29,59 +27,5 @@
<code><![CDATA[public function viewVars(?array $viewVars = null): static|array]]></code>
<code><![CDATA[public function windowStatus(?string $status = null): static|string|null]]></code>
</InvalidDocblock>
<PossiblyInvalidArgument>
<code><![CDATA[$cache]]></code>
<code><![CDATA[$cache]]></code>
<code><![CDATA[$cache]]></code>
<code><![CDATA[$viewClass]]></code>
</PossiblyInvalidArgument>
<PossiblyInvalidPropertyAssignmentValue>
<code><![CDATA[$cache]]></code>
<code><![CDATA[$permissions]]></code>
</PossiblyInvalidPropertyAssignmentValue>
</file>
<file src="src/Pdf/Crypto/PdftkCrypto.php">
<PossiblyInvalidArgument>
<code><![CDATA[$ownerPassword]]></code>
<code><![CDATA[$userPassword]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Pdf/Engine/DomPdfEngine.php">
<PossiblyInvalidArgument>
<code><![CDATA[$Pdf->html()]]></code>
<code><![CDATA[$this->_Pdf->orientation()]]></code>
<code><![CDATA[$this->_Pdf->pageSize()]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Pdf/Engine/MpdfEngine.php">
<PossiblyInvalidArgument>
<code><![CDATA[$format]]></code>
<code><![CDATA[$this->_Pdf->html()]]></code>
</PossiblyInvalidArgument>
<PossiblyInvalidOperand>
<code><![CDATA[$format]]></code>
</PossiblyInvalidOperand>
</file>
<file src="src/Pdf/Engine/TcpdfEngine.php">
<PossiblyInvalidArgument>
<code><![CDATA[$this->_Pdf->html()]]></code>
<code><![CDATA[$this->_Pdf->orientation()]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Pdf/Engine/TexToPdfEngine.php">
<PossiblyInvalidArgument>
<code><![CDATA[$output]]></code>
<code><![CDATA[$output]]></code>
<code><![CDATA[$this->_Pdf->encoding()]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Pdf/Engine/WkHtmlToPdfEngine.php">
<PossibleRawObjectIteration>
<code><![CDATA[$margin]]></code>
</PossibleRawObjectIteration>
<PossiblyInvalidArgument>
<code><![CDATA[$this->_Pdf->html()]]></code>
<code><![CDATA[$value]]></code>
</PossiblyInvalidArgument>
</file>
</files>
20 changes: 2 additions & 18 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
resolveFromConfigFile="true"
autoloader="tests/bootstrap.php"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -16,24 +17,7 @@
</ignoreFiles>
</projectFiles>

<stubs>
<file name="vendor/cakephp/cakephp/src/Core/Exception/CakeException.php" preloadClasses="true" />
</stubs>

<issueHandlers>
<LessSpecificReturnType errorLevel="info" />

<MissingClosureReturnType errorLevel="info" />
<MissingPropertyType errorLevel="info" />

<PropertyNotSetInConstructor errorLevel="info" />
<MissingConstructor errorLevel="info" />
<MissingClosureParamType errorLevel="info" />

<DocblockTypeContradiction errorLevel="info" />
<RedundantConditionGivenDocblockType errorLevel="info" />

<UnsafeInstantiation errorLevel="info" />
<RiskyTruthyFalsyComparison errorLevel="info" />
<MissingOverrideAttribute errorLevel="info" />
</issueHandlers>
</psalm>
60 changes: 20 additions & 40 deletions src/Pdf/CakePdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -785,8 +772,7 @@ public function ownerPassword(?string $password = null): static|string|null
*
* @param array<string>|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>|string|bool|null : $this)
* @return ($permissions is null ? array<string>|string|bool|null : $this)
*/
public function permissions(bool|array|string|null $permissions = null): static|array|string|bool|null
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -935,8 +917,7 @@ public function viewRender(?string $viewClass = null): static|string
* Variables to be set on render
*
* @param array<string, mixed> $viewVars view variables to set
* @return $this|array
* @psalm-return ($viewVars is null ? array<string, mixed> : $this)
* @return ($viewVars is null ? array<string, mixed> : $this)
*/
public function viewVars(?array $viewVars = null): static|array
{
Expand All @@ -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
{
Expand Down
2 changes: 0 additions & 2 deletions tests/TestCase/Pdf/Engine/WkHtmlToPdfEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function testGetCommand()

$class = new ReflectionClass(WkHtmlToPdfEngine::class);
$method = $class->getMethod('_getCommand');
$method->setAccessible(true);

$Pdf = new CakePdf([
'engine' => [
Expand Down Expand Up @@ -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',
Expand Down
Loading