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

Commit

Permalink
Update Doctrine Inflector API (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbudny-lendable authored Oct 20, 2020
1 parent 7810993 commit d5a6c41
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ return \PhpCsFixer\Config::create()
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_final_method' => true,
'no_unneeded_final_method' => false,
'no_unreachable_default_argument_value' => false,
'no_unused_imports' => true,
'no_useless_else' => true,
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"ext-json": "*",
"doctrine/doctrine-bundle": "~1.6",
"doctrine/orm": "~2.1",
"doctrine/inflector": "^1.4",
"stof/doctrine-extensions-bundle": "*",
"symfony/framework-bundle": "^3.4|^4.0",
"symfony/security-bundle": "^3.4|^4.0"
Expand Down
8 changes: 4 additions & 4 deletions src/EventListener/VisitorTrackingSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Alpha\VisitorTrackingBundle\Entity\PageView;
use Alpha\VisitorTrackingBundle\Entity\Session;
use Alpha\VisitorTrackingBundle\Storage\SessionStore;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use Doctrine\ORM\EntityManager;
use Symfony\Bundle\SecurityBundle\Security\FirewallMap;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
Expand Down Expand Up @@ -167,10 +167,10 @@ private function generateSessionAndLifetime(Request $request): void
$session->setUserAgent(\is_string($userAgent) ? $userAgent : '');
$session->setQueryString($request->getQueryString() ?: '');
$session->setLoanTerm($request->query->get('y') ?: '');
$session->setRepApr($request->query->has('r') ? (string) (\hexdec($request->query->get('r')) / 100) : '');
$session->setRepApr($request->query->has('r') ? (string) (\hexdec((string) $request->query->get('r')) / 100) : '');

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

Expand Down Expand Up @@ -209,7 +209,7 @@ private function sessionMatchesRequestParameters(Request $request): bool
}

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

if ($request->query->get($code, '') !== $session->$method()) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/Features/Context/DeviceContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\MinkExtension\Context\RawMinkContext;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use Doctrine\ORM\EntityManagerInterface;
use Alpha\VisitorTrackingBundle\Entity\Lifetime;

Expand Down Expand Up @@ -44,7 +44,7 @@ public function theCookieHasTheValue(): void
$session->setLoanTerm('');
$session->setRepApr('');
foreach ($this->utmCodes as $code) {
$method = 'set'.Inflector::classify($code);
$method = 'set'.InflectorFactory::create()->build()->classify($code);
$session->$method('');
}

Expand Down
2 changes: 1 addition & 1 deletion tools/phpstan/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
checkMissingIterableValueType: false
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- "#Call to function method_exists() with 'Symfony\\\\Component…' and 'getRootNode' will always evaluate to false.#"
- "#Call to function method_exists\\(\\) with 'Symfony\\\\Component…' and 'getRootNode' will always evaluate to false.#"

services:
-
Expand Down

0 comments on commit d5a6c41

Please sign in to comment.