Skip to content

Commit 366ffa2

Browse files
committed
Minor code clean up
This is a small code clean up after adding PHPStan support. There are a number of other recommendations from PHPStan, but at this stage, the test suite needs to be fixed before they can be attended to. But, this small list is workable.
1 parent ec6567a commit 366ffa2

File tree

7 files changed

+61
-61
lines changed

7 files changed

+61
-61
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
},
3434
"require": {
3535
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
36-
"laminas/laminas-stdlib": "^3.7.1"
36+
"laminas/laminas-stdlib": "^3.7.1",
37+
"psr/container": "^1.1"
3738
},
3839
"require-dev": {
3940
"laminas/laminas-coding-standard": "^2.4.0",

composer.lock

Lines changed: 49 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Adapter/AdapterAbstractServiceFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Laminas\Db\Adapter;
44

5-
use Interop\Container\ContainerInterface;
6-
use Laminas\ServiceManager\AbstractFactoryInterface;
5+
use Psr\Container\ContainerInterface;
6+
use Laminas\ServiceManager\Factory\AbstractFactoryInterface;
77
use Laminas\ServiceManager\ServiceLocatorInterface;
88

99
use function is_array;

src/Adapter/AdapterServiceFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Laminas\Db\Adapter;
44

5-
use Interop\Container\ContainerInterface;
6-
use Laminas\ServiceManager\FactoryInterface;
5+
use Laminas\ServiceManager\Factory\FactoryInterface;
76
use Laminas\ServiceManager\ServiceLocatorInterface;
7+
use Psr\Container\ContainerInterface;
88

99
class AdapterServiceFactory implements FactoryInterface
1010
{

src/Adapter/Driver/Pdo/Connection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Laminas\Db\Adapter\Driver\AbstractConnection;
66
use Laminas\Db\Adapter\Exception;
7-
use Laminas\Db\Adapter\Exception\RunTimeException;
7+
use Laminas\Db\Adapter\Exception\RuntimeException;
88
use PDOException;
99
use PDOStatement;
1010

@@ -79,6 +79,8 @@ public function setConnectionParameters(array $connectionParameters)
7979
3
8080
));
8181
}
82+
83+
return $this;
8284
}
8385

8486
/**

src/Adapter/Driver/Pdo/Pdo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ public function formatParameterName($name, $type = null)
318318
if (preg_match('/[^a-zA-Z0-9_]/', $name)) {
319319
throw new Exception\RuntimeException(sprintf(
320320
'The PDO param %s contains invalid characters.'
321-
. ' Only alphabetic characters, digits, and underscores (_)'
322-
. ' are allowed.',
321+
. ' Only alphabetic characters, digits, and underscores (_)'
322+
. ' are allowed.',
323323
$name
324324
));
325325
}

src/ResultSet/HydratingResultSet.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ class HydratingResultSet extends AbstractResultSet
2727
*/
2828
public function __construct(?HydratorInterface $hydrator = null, $objectPrototype = null)
2929
{
30-
$defaultHydratorClass = class_exists(ArraySerializableHydrator::class)
31-
? ArraySerializableHydrator::class
32-
: ArraySerializable::class;
33-
$this->setHydrator($hydrator ?: new $defaultHydratorClass());
30+
$this->setHydrator($hydrator ?: new ArraySerializableHydrator());
3431
$this->setObjectPrototype($objectPrototype ?: new ArrayObject());
3532
}
3633

0 commit comments

Comments
 (0)