Skip to content

Commit

Permalink
Minor code clean up
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Matthew Setter <[email protected]>
  • Loading branch information
settermjd committed Dec 3, 2024
1 parent 47989aa commit ae806f7
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 61 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
},
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"laminas/laminas-stdlib": "^3.7.1"
"laminas/laminas-stdlib": "^3.7.1",
"psr/container": "^1.1"
},
"require-dev": {
"laminas/laminas-coding-standard": "^2.4.0",
Expand Down
98 changes: 49 additions & 49 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Adapter/AdapterAbstractServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Laminas\Db\Adapter;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\AbstractFactoryInterface;
use Psr\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\AbstractFactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;

use function is_array;
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/AdapterServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Laminas\Db\Adapter;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Psr\Container\ContainerInterface;

class AdapterServiceFactory implements FactoryInterface
{
Expand Down
4 changes: 3 additions & 1 deletion src/Adapter/Driver/Pdo/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Laminas\Db\Adapter\Driver\AbstractConnection;
use Laminas\Db\Adapter\Exception;
use Laminas\Db\Adapter\Exception\RunTimeException;
use Laminas\Db\Adapter\Exception\RuntimeException;
use PDOException;
use PDOStatement;

Expand Down Expand Up @@ -79,6 +79,8 @@ public function setConnectionParameters(array $connectionParameters)
3
));
}

return $this;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/Driver/Pdo/Pdo.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ public function formatParameterName($name, $type = null)
if (preg_match('/[^a-zA-Z0-9_]/', $name)) {
throw new Exception\RuntimeException(sprintf(
'The PDO param %s contains invalid characters.'
. ' Only alphabetic characters, digits, and underscores (_)'
. ' are allowed.',
. ' Only alphabetic characters, digits, and underscores (_)'
. ' are allowed.',
$name
));
}
Expand Down
5 changes: 1 addition & 4 deletions src/ResultSet/HydratingResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ class HydratingResultSet extends AbstractResultSet
*/
public function __construct(?HydratorInterface $hydrator = null, $objectPrototype = null)
{
$defaultHydratorClass = class_exists(ArraySerializableHydrator::class)
? ArraySerializableHydrator::class
: ArraySerializable::class;
$this->setHydrator($hydrator ?: new $defaultHydratorClass());
$this->setHydrator($hydrator ?: new ArraySerializableHydrator());
$this->setObjectPrototype($objectPrototype ?: new ArrayObject());
}

Expand Down

0 comments on commit ae806f7

Please sign in to comment.