1
0
mirror of synced 2025-02-03 05:49:25 +03:00

Reverting 741da7806c5d01796e243de9a122590151cb0c90, which was causing issues due to loose type checking

See this example on why the revert is needed: https://3v4l.org/8T34v

Code copied for reference:

```php
<?php

$a = 1;

switch ($a) {
    case "1";
        echo "FUCK YOU, STUPID LANGUAGE!";
        break;
    case 1;
        echo __LINE__;
        break;
}
```
This commit is contained in:
Marco Pivetta 2016-06-19 09:28:12 +02:00
parent 765e102d01
commit d00069e38b

View File

@ -421,14 +421,14 @@ use Doctrine\Common\Util\ClassUtils;
return null; return null;
} }
switch ($lockMode) { switch (true) {
case LockMode::OPTIMISTIC: case LockMode::OPTIMISTIC === $lockMode:
$this->lock($entity, $lockMode, $lockVersion); $this->lock($entity, $lockMode, $lockVersion);
break; break;
case LockMode::NONE: case LockMode::NONE === $lockMode:
case LockMode::PESSIMISTIC_READ: case LockMode::PESSIMISTIC_READ === $lockMode:
case LockMode::PESSIMISTIC_WRITE: case LockMode::PESSIMISTIC_WRITE === $lockMode:
$persister = $unitOfWork->getEntityPersister($class->name); $persister = $unitOfWork->getEntityPersister($class->name);
$persister->refresh($sortedId, $entity, $lockMode); $persister->refresh($sortedId, $entity, $lockMode);
break; break;
@ -439,8 +439,8 @@ use Doctrine\Common\Util\ClassUtils;
$persister = $unitOfWork->getEntityPersister($class->name); $persister = $unitOfWork->getEntityPersister($class->name);
switch ($lockMode) { switch (true) {
case LockMode::OPTIMISTIC: case LockMode::OPTIMISTIC === $lockMode:
if ( ! $class->isVersioned) { if ( ! $class->isVersioned) {
throw OptimisticLockException::notVersioned($class->name); throw OptimisticLockException::notVersioned($class->name);
} }
@ -451,8 +451,8 @@ use Doctrine\Common\Util\ClassUtils;
return $entity; return $entity;
case LockMode::PESSIMISTIC_READ: case LockMode::PESSIMISTIC_READ === $lockMode:
case LockMode::PESSIMISTIC_WRITE: case LockMode::PESSIMISTIC_WRITE === $lockMode:
if ( ! $this->getConnection()->isTransactionActive()) { if ( ! $this->getConnection()->isTransactionActive()) {
throw TransactionRequiredException::transactionRequired(); throw TransactionRequiredException::transactionRequired();
} }