Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 support #9

Merged
merged 26 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
20 changes: 12 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"forum": "https://discourse.laminas.dev/"
},
"require": {
"php": "^7.3 || ~8.0.0",
"laminas/laminas-db": "^2.12",
"laminas/laminas-paginator": "^2.10"
"php": "^7.4 || ~8.0.0 || ~8.1.0",
"laminas/laminas-db": "^2.13.4",
"laminas/laminas-paginator": "^2.12.1"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.1.4",
"phpunit/phpunit": "^9.3",
"psalm/plugin-phpunit": "^0.15.1",
"vimeo/psalm": "^4.6"
"laminas/laminas-coding-standard": "~2.3.0",
"phpunit/phpunit": "^9.5.10",
"psalm/plugin-phpunit": "^0.15.2",
"vimeo/psalm": "^4.16"
},
"autoload": {
"psr-4": {
Expand All @@ -42,7 +42,11 @@
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"cs-check": "phpcs",
Expand Down
959 changes: 527 additions & 432 deletions composer.lock

Large diffs are not rendered by default.

48 changes: 4 additions & 44 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.6.1@e93e532e4eaad6d68c4d7b606853800eaceccc72">
<files psalm-version="4.16.1@aa7e400908833b10c0333861f86cd48c510b60eb">
<file src="src/DbSelect.php">
<DocblockTypeContradiction occurrences="1">
<code>$adapterOrSqlObject instanceof Sql</code>
</DocblockTypeContradiction>
<MixedArgument occurrences="1">
<code>$row</code>
</MixedArgument>
<MixedAssignment occurrences="1">
<code>$row</code>
</MixedAssignment>
<PropertyNotSetInConstructor occurrences="1">
<code>$rowCount</code>
</PropertyNotSetInConstructor>
<PropertyTypeCoercion occurrences="1">
<code>$resultSetPrototype ?: new ResultSet()</code>
</PropertyTypeCoercion>
<RedundantConditionGivenDocblockType occurrences="1">
<code>$this-&gt;rowCount !== null</code>
</RedundantConditionGivenDocblockType>
</file>
<file src="src/DbSelectFactory.php">
<InvalidStringClass occurrences="1"/>
Expand All @@ -31,21 +19,9 @@
</MoreSpecificReturnType>
</file>
<file src="src/DbTableGateway.php">
<MixedArgument occurrences="1">
<code>$select</code>
</MixedArgument>
<MixedAssignment occurrences="1">
<code>$select</code>
</MixedAssignment>
<MixedMethodCall occurrences="4">
<code>group</code>
<code>having</code>
<code>order</code>
<code>where</code>
</MixedMethodCall>
<PropertyNotSetInConstructor occurrences="1">
<code>DbTableGateway</code>
</PropertyNotSetInConstructor>
<PossiblyInvalidArgument occurrences="1">
<code>$having</code>
</PossiblyInvalidArgument>
</file>
<file src="src/DbTableGatewayFactory.php">
<InvalidStringClass occurrences="1"/>
Expand All @@ -69,15 +45,6 @@
<InternalMethod occurrences="1">
<code>getArrayCopy</code>
</InternalMethod>
<MissingReturnType occurrences="7">
<code>testCount</code>
<code>testCountQueryWithLowerColumnNameShouldReturnValidResult</code>
<code>testCountQueryWithMissingColumnNameShouldRaiseException</code>
<code>testCustomCount</code>
<code>testGetArrayCopyShouldContainSelectItems</code>
<code>testGetItems</code>
<code>testReturnValueIsArray</code>
</MissingReturnType>
<MixedMethodCall occurrences="13">
<code>method</code>
<code>method</code>
Expand Down Expand Up @@ -116,13 +83,6 @@
</PossiblyUndefinedMethod>
</file>
<file src="test/DbTableGatewayTest.php">
<MissingReturnType occurrences="5">
<code>testCount</code>
<code>testGetItems</code>
<code>testGetItemsWithWhereAndOrder</code>
<code>testGetItemsWithWhereAndOrderAndGroup</code>
<code>testGetItemsWithWhereAndOrderAndGroupAndHaving</code>
</MissingReturnType>
<MixedMethodCall occurrences="14">
<code>method</code>
<code>method</code>
Expand Down
2 changes: 2 additions & 0 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Laminas\Paginator\Adapter\LaminasDb;

class ConfigProvider
Expand Down
9 changes: 5 additions & 4 deletions src/DbSelect.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Laminas\Paginator\Adapter\LaminasDb;

use Laminas\Db\Adapter\Adapter;
Expand Down Expand Up @@ -37,13 +39,13 @@ class DbSelect implements AdapterInterface
*/
protected $countSelect;

/** @var ResultSet */
/** @var ResultSetInterface */
protected $resultSetPrototype;

/**
* Total item count
*
* @var int
* @var int|null
*/
protected $rowCount;

Expand Down Expand Up @@ -161,10 +163,9 @@ public function getArrayCopy()
}

/**
* @return int
* @throws MissingRowCountColumnException
*/
private function locateRowCount(array $row)
private function locateRowCount(array $row): int
{
if (array_key_exists(self::ROW_COUNT_COLUMN_NAME, $row)) {
return (int) $row[self::ROW_COUNT_COLUMN_NAME];
Expand Down
2 changes: 2 additions & 0 deletions src/DbSelectFactory.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Laminas\Paginator\Adapter\LaminasDb;

use Psr\Container\ContainerInterface;
Expand Down
8 changes: 5 additions & 3 deletions src/DbTableGateway.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Laminas\Paginator\Adapter\LaminasDb;

use Closure;
Expand All @@ -12,9 +14,9 @@ class DbTableGateway extends DbSelect
/**
* Constructs instance.
*
* @param null|Where|Closure|string|array $where
* @param null|string|array $order
* @param null|string|array $group
* @param null|Where|Closure|string|array $where
* @param null|string|array $order
* @param null|string|array $group
* @param null|Having|Closure|string|array $having
*/
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions src/DbTableGatewayFactory.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Laminas\Paginator\Adapter\LaminasDb;

use Psr\Container\ContainerInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Module.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Laminas\Paginator\Adapter\LaminasDb;

class Module
Expand Down
2 changes: 2 additions & 0 deletions test/DbSelectTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaminasTest\Paginator\Adapter\LaminasDb;

use Laminas\Db\Adapter\Adapter;
Expand Down
2 changes: 2 additions & 0 deletions test/DbTableGatewayTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaminasTest\Paginator\Adapter\LaminasDb;

use Laminas\Db\Adapter\Adapter;
Expand Down