Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit d5a6c41

Browse files
Update Doctrine Inflector API (#14)
1 parent 7810993 commit d5a6c41

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

.php_cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ return \PhpCsFixer\Config::create()
5454
'no_trailing_comma_in_singleline_array' => true,
5555
'no_unneeded_control_parentheses' => true,
5656
'no_unneeded_curly_braces' => true,
57-
'no_unneeded_final_method' => true,
57+
'no_unneeded_final_method' => false,
5858
'no_unreachable_default_argument_value' => false,
5959
'no_unused_imports' => true,
6060
'no_useless_else' => true,

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"ext-json": "*",
3333
"doctrine/doctrine-bundle": "~1.6",
3434
"doctrine/orm": "~2.1",
35+
"doctrine/inflector": "^1.4",
3536
"stof/doctrine-extensions-bundle": "*",
3637
"symfony/framework-bundle": "^3.4|^4.0",
3738
"symfony/security-bundle": "^3.4|^4.0"

src/EventListener/VisitorTrackingSubscriber.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Alpha\VisitorTrackingBundle\Entity\PageView;
99
use Alpha\VisitorTrackingBundle\Entity\Session;
1010
use Alpha\VisitorTrackingBundle\Storage\SessionStore;
11-
use Doctrine\Common\Inflector\Inflector;
11+
use Doctrine\Inflector\InflectorFactory;
1212
use Doctrine\ORM\EntityManager;
1313
use Symfony\Bundle\SecurityBundle\Security\FirewallMap;
1414
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -167,10 +167,10 @@ private function generateSessionAndLifetime(Request $request): void
167167
$session->setUserAgent(\is_string($userAgent) ? $userAgent : '');
168168
$session->setQueryString($request->getQueryString() ?: '');
169169
$session->setLoanTerm($request->query->get('y') ?: '');
170-
$session->setRepApr($request->query->has('r') ? (string) (\hexdec($request->query->get('r')) / 100) : '');
170+
$session->setRepApr($request->query->has('r') ? (string) (\hexdec((string) $request->query->get('r')) / 100) : '');
171171

172172
foreach (self::UTM_CODES as $code) {
173-
$method = 'set'.Inflector::classify($code);
173+
$method = 'set'.InflectorFactory::create()->build()->classify($code);
174174
$session->$method($request->query->get($code) ?: '');
175175
}
176176

@@ -209,7 +209,7 @@ private function sessionMatchesRequestParameters(Request $request): bool
209209
}
210210

211211
foreach (self::UTM_CODES as $code) {
212-
$method = 'get'.Inflector::classify($code);
212+
$method = 'get'.InflectorFactory::create()->build()->classify($code);
213213

214214
if ($request->query->get($code, '') !== $session->$method()) {
215215
return false;

src/Features/Context/DeviceContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Behat\Behat\Context\Context;
88
use Behat\Behat\Context\SnippetAcceptingContext;
99
use Behat\MinkExtension\Context\RawMinkContext;
10-
use Doctrine\Common\Inflector\Inflector;
10+
use Doctrine\Inflector\InflectorFactory;
1111
use Doctrine\ORM\EntityManagerInterface;
1212
use Alpha\VisitorTrackingBundle\Entity\Lifetime;
1313

@@ -44,7 +44,7 @@ public function theCookieHasTheValue(): void
4444
$session->setLoanTerm('');
4545
$session->setRepApr('');
4646
foreach ($this->utmCodes as $code) {
47-
$method = 'set'.Inflector::classify($code);
47+
$method = 'set'.InflectorFactory::create()->build()->classify($code);
4848
$session->$method('');
4949
}
5050

tools/phpstan/phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77
checkMissingIterableValueType: false
88
reportUnmatchedIgnoredErrors: false
99
ignoreErrors:
10-
- "#Call to function method_exists() with 'Symfony\\\\Component…' and 'getRootNode' will always evaluate to false.#"
10+
- "#Call to function method_exists\\(\\) with 'Symfony\\\\Component…' and 'getRootNode' will always evaluate to false.#"
1111

1212
services:
1313
-

0 commit comments

Comments
 (0)