Skip to content

Commit

Permalink
Merge pull request #602 from TomHAnderson/feature/cursory-review
Browse files Browse the repository at this point in the history
3.0 Reviewed all code for obvious errors
  • Loading branch information
TomHAnderson authored Oct 16, 2024
2 parents 7589569 + d7cbe75 commit ad94c07
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 84 deletions.
2 changes: 0 additions & 2 deletions src/Auth/Authenticatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@

trait Authenticatable
{
/** @ORM\Column(type="string") */
#[ORM\Column(type: 'string')]
protected string $password;

/** @ORM\Column(name="remember_token", type="string", nullable=true) */
#[ORM\Column(name: 'remember_token', type: 'string', nullable: true)]
protected string $rememberToken;

Expand Down
36 changes: 18 additions & 18 deletions src/Configuration/Connections/MysqlConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ class MysqlConnection extends Connection
public function resolve(array $settings = []): array
{
return [
'driver' => 'pdo_mysql',
'host' => Arr::get($settings, 'host'),
'dbname' => Arr::get($settings, 'database'),
'user' => Arr::get($settings, 'username'),
'password' => Arr::get($settings, 'password'),
'charset' => Arr::get($settings, 'charset'),
'port' => Arr::get($settings, 'port'),
'unix_socket' => Arr::get($settings, 'unix_socket'),
'ssl_key' => Arr::get($settings, 'ssl_key'),
'ssl_cert' => Arr::get($settings, 'ssl_cert'),
'ssl_ca' => Arr::get($settings, 'ssl_ca'),
'ssl_capath' => Arr::get($settings, 'ssl_capath'),
'ssl_cipher' => Arr::get($settings, 'ssl_cipher'),
'prefix' => Arr::get($settings, 'prefix'),
'defaultTableOptions' => Arr::get($settings, 'defaultTableOptions', []),
'serverVersion' => Arr::get($settings, 'serverVersion'),
'wrapperClass' => Arr::get($settings, 'wrapperClass'),
'driverOptions' => Arr::get($settings, 'options', []),
'driver' => 'pdo_mysql',
'host' => Arr::get($settings, 'host'),
'dbname' => Arr::get($settings, 'database'),
'user' => Arr::get($settings, 'username'),
'password' => Arr::get($settings, 'password'),
'charset' => Arr::get($settings, 'charset'),
'port' => Arr::get($settings, 'port'),
'unix_socket' => Arr::get($settings, 'unix_socket'),
'ssl_key' => Arr::get($settings, 'ssl_key'),
'ssl_cert' => Arr::get($settings, 'ssl_cert'),
'ssl_ca' => Arr::get($settings, 'ssl_ca'),
'ssl_capath' => Arr::get($settings, 'ssl_capath'),
'ssl_cipher' => Arr::get($settings, 'ssl_cipher'),
'prefix' => Arr::get($settings, 'prefix'),
'defaultTableOptions' => Arr::get($settings, 'defaultTableOptions', []),
'serverVersion' => Arr::get($settings, 'serverVersion'),
'wrapperClass' => Arr::get($settings, 'wrapperClass'),
'driverOptions' => Arr::get($settings, 'options', []),
];
}
}
28 changes: 14 additions & 14 deletions src/Configuration/Connections/OracleConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ class OracleConnection extends Connection
public function resolve(array $settings = []): array
{
return [
'driver' => 'oci8',
'host' => Arr::get($settings, 'host'),
'dbname' => Arr::get($settings, 'database'),
'servicename' => Arr::get($settings, 'service_name'),
'service' => Arr::get($settings, 'service'),
'user' => Arr::get($settings, 'username'),
'password' => Arr::get($settings, 'password'),
'charset' => Arr::get($settings, 'charset'),
'port' => Arr::get($settings, 'port'),
'prefix' => Arr::get($settings, 'prefix'),
'defaultTableOptions' => Arr::get($settings, 'defaultTableOptions', []),
'persistent' => Arr::get($settings, 'persistent'),
'wrapperClass' => Arr::get($settings, 'wrapperClass'),
'connectstring' => Arr::get($settings, 'connectstring'),
'driver' => 'oci8',
'host' => Arr::get($settings, 'host'),
'dbname' => Arr::get($settings, 'database'),
'servicename' => Arr::get($settings, 'service_name'),
'service' => Arr::get($settings, 'service'),
'user' => Arr::get($settings, 'username'),
'password' => Arr::get($settings, 'password'),
'charset' => Arr::get($settings, 'charset'),
'port' => Arr::get($settings, 'port'),
'prefix' => Arr::get($settings, 'prefix'),
'defaultTableOptions' => Arr::get($settings, 'defaultTableOptions', []),
'persistent' => Arr::get($settings, 'persistent'),
'wrapperClass' => Arr::get($settings, 'wrapperClass'),
'connectstring' => Arr::get($settings, 'connectstring'),
];
}
}
2 changes: 1 addition & 1 deletion src/Console/DumpDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function configure(): void

$this->setName('doctrine:dump:sqlite');
$this->setDescription(<<<'EOF'
doctrine:dump:sqlite
doctrine:dump:sqlite
{--connection=sqlite}
{--em=}
Expand Down
3 changes: 2 additions & 1 deletion src/Console/EntityManagerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
namespace LaravelDoctrine\ORM\Console;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Tools\Console\EntityManagerProvider as DoctrineEntityManagerProvider;
use Doctrine\Persistence\ManagerRegistry;

use function assert;

class EntityManagerProvider implements \Doctrine\ORM\Tools\Console\EntityManagerProvider
class EntityManagerProvider implements DoctrineEntityManagerProvider
{
public function __construct(private ManagerRegistry $managerRegistry)
{
Expand Down
4 changes: 3 additions & 1 deletion src/Console/GenerateProxiesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace LaravelDoctrine\ORM\Console;

class GenerateProxiesCommand extends \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand
use Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand as DoctrineGenerateProxiesCommand;

class GenerateProxiesCommand extends DoctrineGenerateProxiesCommand
{
public function __construct(EntityManagerProvider $entityManagerProvider)
{
Expand Down
4 changes: 3 additions & 1 deletion src/Console/InfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace LaravelDoctrine\ORM\Console;

class InfoCommand extends \Doctrine\ORM\Tools\Console\Command\InfoCommand
use Doctrine\ORM\Tools\Console\Command\InfoCommand as DoctrineInfoCommand;

class InfoCommand extends DoctrineInfoCommand
{
public function __construct(EntityManagerProvider $entityManagerProvider)
{
Expand Down
Empty file removed src/EntityFactory.php
Empty file.
14 changes: 0 additions & 14 deletions src/Notifications/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@

use Doctrine\ORM\Mapping as ORM;

/** @ORM\MappedSuperclass */
#[ORM\MappedSuperclass]
class Notification
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
Expand All @@ -24,32 +18,24 @@ class Notification

/**
* The "level" of the notification (info, success, error).
*
* @ORM\Column(type="string")
*/
#[ORM\Column(type: 'string')]
protected string $level = 'info';

/**
* The message of the notification.
*
* @ORM\Column(type="string")
*/
#[ORM\Column(type: 'string')]
protected string $message;

/**
* The text / label for the action.
*
* @ORM\Column(type="string")
*/
#[ORM\Column(type: 'string')]
protected string $actionText;

/**
* The action URL.
*
* @ORM\Column(type="string")
*/
#[ORM\Column(type: 'string')]
protected string $actionUrl;
Expand Down
16 changes: 0 additions & 16 deletions src/Pagination/Paginatable.php

This file was deleted.

18 changes: 2 additions & 16 deletions src/Testing/Concerns/InteractsWithEntities.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace LaravelDoctrine\ORM\Testing\Concerns;

use PHPUnit\Framework\Assert;
use PHPUnit_Framework_AssertionFailedError;
use PHPUnit_Framework_SkippedTestError;

use function collect;
use function count;
Expand All @@ -17,11 +15,7 @@

trait InteractsWithEntities
{
/**
* @return object
*
* @throws PHPUnit_Framework_AssertionFailedError
*/
/** @return object */
public function entityExists(string $class, mixed $id): mixed
{
$entity = $this->entityManager()->find($class, $id);
Expand All @@ -31,7 +25,6 @@ public function entityExists(string $class, mixed $id): mixed
return $entity;
}

/** @throws PHPUnit_Framework_AssertionFailedError */
public function entityDoesNotExist(string $class, mixed $id): void
{
Assert::assertNull(
Expand All @@ -44,8 +37,6 @@ public function entityDoesNotExist(string $class, mixed $id): void
* @param mixed[] $criteria
*
* @return mixed[]
*
* @throws PHPUnit_Framework_AssertionFailedError
*/
public function entitiesMatch(string $class, array $criteria, int|null $count = null): mixed
{
Expand All @@ -65,11 +56,7 @@ public function entitiesMatch(string $class, array $criteria, int|null $count =
return $entities;
}

/**
* @param mixed[] $criteria
*
* @throws PHPUnit_Framework_AssertionFailedError
*/
/** @param mixed[] $criteria */
public function noEntitiesMatch(string $class, array $criteria): void
{
Assert::assertEmpty(
Expand Down Expand Up @@ -101,7 +88,6 @@ private function outputCriteria(array $criteria): string
return print_r($criteria, true);
}

/** @throws PHPUnit_Framework_SkippedTestError */
protected function entityManager(): mixed
{
if (! isset($this->app)) {
Expand Down

0 comments on commit ad94c07

Please sign in to comment.