Skip to content

Commit a064af6

Browse files
committed
upgrade to latest version
1 parent 4e49130 commit a064af6

16 files changed

+320
-298
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/composer.lock
2-
/composer.phar
3-
/vendor
4-
/phpunit.xml
1+
composer.phar
2+
composer.lock
3+
vendor/
4+
.phpunit.result.cache

composer-require-checker.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"symbol-whitelist": [
3+
"null",
4+
"true",
5+
"false",
6+
"static",
7+
"self",
8+
"parent",
9+
"array",
10+
"string",
11+
"int",
12+
"float",
13+
"bool",
14+
"iterable",
15+
"callable",
16+
"void",
17+
"object"
18+
]
19+
}

composer.json

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,77 @@
2020
"authors": [
2121
{
2222
"name": "Nikita Loges",
23-
"homepage": "http://nikita-loges.de",
24-
"email": "[email protected]"
23+
"homepage": "https://loges.one",
24+
"email": "[email protected]"
25+
},
26+
{
27+
"name": "Contributors",
28+
"homepage": "https://github.com/shapecode/doctrine-session-handler-bundle/graphs/contributors"
2529
}
2630
],
2731
"require": {
28-
"php": "~5.6|~7.0",
32+
"php": "~7.2",
33+
"ext-session": "*",
2934

30-
"symfony/framework-bundle": "~2.8|~3.0|~4.0|~5.0",
31-
"symfony/config": "~2.8|~3.0|~4.0|~5.0",
32-
"symfony/console": "~2.8|~3.0|~4.0|~5.0",
33-
"symfony/http-kernel": "~2.8|~3.0|~4.0|~5.0",
34-
"symfony/dependency-injection": "~2.8|~3.0|~4.0|~5.0",
35+
"symfony/config": "~4.4|~5.0",
36+
"symfony/console": "~4.4|~5.0",
37+
"symfony/http-kernel": "~4.4|~5.0",
38+
"symfony/dependency-injection": "~4.4|~5.0",
3539

36-
"doctrine/orm": "~2.5"
40+
"doctrine/dbal": "~2.10",
41+
"doctrine/common": "~2.13",
42+
"doctrine/persistence": "~1.3",
43+
"doctrine/orm": "~2.7"
44+
},
45+
"require-dev":{
46+
"doctrine/coding-standard": "~7.0",
47+
"roave/security-advisories": "dev-master",
48+
"squizlabs/php_codesniffer": "~3.4",
49+
"phpstan/phpstan": "~0.12",
50+
"phpstan/phpstan-deprecation-rules": "~0.12",
51+
"phpstan/phpstan-phpunit": "~0.12",
52+
"phpstan/phpstan-strict-rules": "~0.12",
53+
"maglnet/composer-require-checker": "~2.0",
54+
"phpunit/phpunit": "~9.0",
55+
"symfony/var-dumper": "~5.0",
56+
"dg/bypass-finals": "~1.1",
57+
"icanhazstring/composer-unused": "~0.7"
3758
},
3859
"autoload": {
3960
"psr-4": {
4061
"Shapecode\\Bundle\\Doctrine\\SessionHandlerBundle\\": "src/"
4162
}
4263
},
64+
"scripts": {
65+
"check": [
66+
"@crc",
67+
"@unuse",
68+
"@cs-check",
69+
"@phpstan"
70+
],
71+
"unuse": "composer unused --excludeDir=vendor",
72+
"phpstan-update-baseline": "phpstan analyse --ansi --generate-baseline phpstan-baseline.neon",
73+
"phpstan": "./vendor/bin/phpstan analyse ./src",
74+
"crc": "./vendor/bin/composer-require-checker --config-file=./composer-require-checker.json",
75+
"phpunit": "./vendor/bin/phpunit",
76+
"cs-fix": "./vendor/bin/phpcbf",
77+
"cs-check": "./vendor/bin/phpcs -s"
78+
},
4379
"extra": {
4480
"branch-alias": {
4581
"dev-master": "3.0-dev"
4682
}
4783
},
4884
"minimum-stability": "dev",
49-
"prefer-stable": true
85+
"prefer-stable": true,
86+
"funding": [
87+
{
88+
"type": "paypal",
89+
"url": "http://paypal.me/nloges"
90+
},
91+
{
92+
"type": "liberapay",
93+
"url": "https://liberapay.com/nicklog"
94+
}
95+
]
5096
}

phpcs.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
3+
4+
<arg name="basepath" value="."/>
5+
<arg name="colors"/>
6+
<arg name="extensions" value="php"/>
7+
<arg name="tab-width" value="4"/>
8+
9+
<config name="php_version" value="70318"/>
10+
11+
<file>src/</file>
12+
<file>tests/</file>
13+
14+
<rule ref="./vendor/doctrine/coding-standard/lib/Doctrine/ruleset.xml">
15+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>
16+
<exclude name="SlevomatCodingStandard.Commenting.UselessInheritDocComment.UselessInheritDocComment"/>
17+
</rule>
18+
</ruleset>

phpstan-baseline.neon

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Method Shapecode\\\\Bundle\\\\Doctrine\\\\SessionHandlerBundle\\\\Session\\\\Handler\\\\DoctrineHandler\\:\\:destroy\\(\\) has parameter \\$sessionId with no typehint specified\\.$#"
5+
count: 1
6+
path: src/Session/Handler/DoctrineHandler.php
7+
8+
-
9+
message: "#^Method Shapecode\\\\Bundle\\\\Doctrine\\\\SessionHandlerBundle\\\\Session\\\\Handler\\\\DoctrineHandler\\:\\:gc\\(\\) has parameter \\$maxlifetime with no typehint specified\\.$#"
10+
count: 1
11+
path: src/Session/Handler/DoctrineHandler.php
12+
13+
-
14+
message: "#^Method Shapecode\\\\Bundle\\\\Doctrine\\\\SessionHandlerBundle\\\\Session\\\\Handler\\\\DoctrineHandler\\:\\:open\\(\\) has parameter \\$savePath with no typehint specified\\.$#"
15+
count: 1
16+
path: src/Session/Handler/DoctrineHandler.php
17+
18+
-
19+
message: "#^Method Shapecode\\\\Bundle\\\\Doctrine\\\\SessionHandlerBundle\\\\Session\\\\Handler\\\\DoctrineHandler\\:\\:open\\(\\) has parameter \\$sessionId with no typehint specified\\.$#"
20+
count: 1
21+
path: src/Session/Handler/DoctrineHandler.php
22+
23+
-
24+
message: "#^Method Shapecode\\\\Bundle\\\\Doctrine\\\\SessionHandlerBundle\\\\Session\\\\Handler\\\\DoctrineHandler\\:\\:read\\(\\) has parameter \\$sessionId with no typehint specified\\.$#"
25+
count: 1
26+
path: src/Session/Handler/DoctrineHandler.php
27+
28+
-
29+
message: "#^Method Shapecode\\\\Bundle\\\\Doctrine\\\\SessionHandlerBundle\\\\Session\\\\Handler\\\\DoctrineHandler\\:\\:write\\(\\) has parameter \\$sessionData with no typehint specified\\.$#"
30+
count: 1
31+
path: src/Session/Handler/DoctrineHandler.php
32+
33+
-
34+
message: "#^Method Shapecode\\\\Bundle\\\\Doctrine\\\\SessionHandlerBundle\\\\Session\\\\Handler\\\\DoctrineHandler\\:\\:write\\(\\) has parameter \\$sessionId with no typehint specified\\.$#"
35+
count: 1
36+
path: src/Session/Handler/DoctrineHandler.php
37+

phpstan.neon.dist

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
includes:
2+
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
3+
- vendor/phpstan/phpstan-strict-rules/rules.neon
4+
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
5+
- vendor/phpstan/phpstan-phpunit/extension.neon
6+
- vendor/phpstan/phpstan-phpunit/rules.neon
7+
- phpstan-baseline.neon
8+
9+
parameters:
10+
level: max
11+
paths:
12+
- src
13+
- tests
14+
15+
checkGenericClassInNonGenericObjectType: false
16+
checkMissingIterableValueType: false

phpunit.xml.dist

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
4+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
6+
backupGlobals="false"
7+
colors="true"
8+
processIsolation="false"
9+
bootstrap="tests/bootstrap.php">
10+
11+
<testsuites>
12+
<testsuite name="default">
13+
<directory>tests</directory>
14+
</testsuite>
15+
</testsuites>
16+
17+
<filter>
18+
<whitelist>
19+
<directory>src</directory>
20+
</whitelist>
21+
</filter>
22+
</phpunit>
Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,47 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Shapecode\Bundle\Doctrine\SessionHandlerBundle\Command;
46

7+
use Doctrine\ORM\EntityManagerInterface;
58
use Shapecode\Bundle\Doctrine\SessionHandlerBundle\Entity\SessionInterface;
6-
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
9+
use Shapecode\Bundle\Doctrine\SessionHandlerBundle\Repository\SessionRepositoryInterface;
10+
use Symfony\Component\Console\Command\Command;
711
use Symfony\Component\Console\Input\InputInterface;
812
use Symfony\Component\Console\Output\OutputInterface;
13+
use function assert;
914

10-
/**
11-
* Class ClearSessionCommand
12-
*
13-
* @package Shapecode\Bundle\Doctrine\SessionHandlerBundle\Command
14-
* @author Nikita Loges
15-
*/
16-
class ClearSessionCommand extends ContainerAwareCommand
15+
class ClearSessionCommand extends Command
1716
{
17+
/** @var EntityManagerInterface */
18+
private $entityManager;
19+
20+
public function __construct(EntityManagerInterface $entityManager)
21+
{
22+
$this->entityManager = $entityManager;
23+
24+
parent::__construct();
25+
}
1826

1927
/**
2028
* @inheritDoc
2129
*/
22-
protected function configure()
30+
protected function configure() : void
2331
{
2432
$this->setName('shapecode:doctrine-session:clear');
2533
$this->setDescription('Clears all dead session in the database.');
2634
}
2735

28-
/**
29-
* @inheritDoc
30-
*/
31-
protected function execute(InputInterface $input, OutputInterface $output)
36+
protected function execute(InputInterface $input, OutputInterface $output) : int
3237
{
33-
$this->getRepository()->purge();
38+
$repo = $this->entityManager->getRepository(SessionInterface::class);
39+
assert($repo instanceof SessionRepositoryInterface);
40+
41+
$repo->purge();
3442

3543
$output->writeln('sessions cleared.');
36-
}
3744

38-
/**
39-
* @return \Shapecode\Bundle\Doctrine\SessionHandlerBundle\Repository\SessionRepository
40-
*/
41-
protected function getRepository()
42-
{
43-
return $this->getContainer()->get('doctrine.orm.entity_manager')->getRepository(SessionInterface::class);
45+
return 0;
4446
}
45-
4647
}
Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Shapecode\Bundle\Doctrine\SessionHandlerBundle\DependencyInjection;
46

57
use Shapecode\Bundle\Doctrine\SessionHandlerBundle\Entity\Session;
@@ -10,37 +12,26 @@
1012
use Symfony\Component\DependencyInjection\Loader;
1113
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
1214

13-
/**
14-
* Class ShapecodeDoctrineSessionHandlerExtension
15-
*
16-
* @package Shapecode\Bundle\Doctrine\SessionHandlerBundle\DependencyInjection
17-
* @author Nikita Loges
18-
*/
1915
class ShapecodeDoctrineSessionHandlerExtension extends Extension implements PrependExtensionInterface
2016
{
21-
2217
/**
2318
* @inheritdoc
2419
*/
25-
public function load(array $configs, ContainerBuilder $container)
20+
public function load(array $configs, ContainerBuilder $container) : void
2621
{
27-
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));;
22+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
23+
2824
$loader->load('services.yml');
2925
}
3026

31-
/**
32-
* {@inheritDoc}
33-
*/
34-
public function prepend(ContainerBuilder $container)
27+
public function prepend(ContainerBuilder $container) : void
3528
{
36-
$doctrine = [
29+
$container->prependExtensionConfig('doctrine', [
3730
'orm' => [
3831
'resolve_target_entities' => [
3932
SessionInterface::class => Session::class,
40-
]
41-
]
42-
];
43-
44-
$container->prependExtensionConfig('doctrine', $doctrine);
33+
],
34+
],
35+
]);
4536
}
4637
}

0 commit comments

Comments
 (0)