Skip to content

Commit 17fea2b

Browse files
committed
stan
1 parent 7344fc7 commit 17fea2b

57 files changed

Lines changed: 229 additions & 155 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/Console/Commands/Database/MigrateInstrumentaionCommand.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Console\Commands\Database;
44

55
use Carbon\Carbon;
6+
use DateTimeZone;
67
use HMS\Tools\ToolManager;
78
use Illuminate\Console\Command;
89
use Illuminate\Support\Facades\DB;
@@ -379,12 +380,12 @@ class MigrateInstrumentaionCommand extends Command
379380
protected $description = 'Migrate data form old instrumentation database';
380381

381382
/**
382-
* @var null|\DateTimeZone
383+
* @var null|DateTimeZone
383384
*/
384385
private static $utc = null;
385386

386387
/**
387-
* @var null|\DateTimeZone
388+
* @var null|DateTimeZone
388389
*/
389390
private static $gmt = null;
390391

@@ -409,10 +410,10 @@ public function __construct(ToolManager $toolManager)
409410
public function handle()
410411
{
411412
if (is_null(self::$utc)) {
412-
self::$utc = new \DateTimeZone('UTC');
413+
self::$utc = new DateTimeZone('UTC');
413414
}
414415
if (is_null(self::$gmt)) {
415-
self::$gmt = new \DateTimeZone('Europe/London');
416+
self::$gmt = new DateTimeZone('Europe/London');
416417
}
417418

418419
$this->info('Please provide details for connecting to the instrumentation database.');

app/Console/Commands/Database/MigrateMembersAreaCommand.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Console\Commands\Database;
44

55
use Carbon\Carbon;
6+
use DateTimeZone;
67
use Doctrine\ORM\EntityManagerInterface;
78
use HMS\Entities\Banking\BankType;
89
use HMS\Entities\Gatekeeper\AccessLogResult;
@@ -113,12 +114,12 @@ class MigrateMembersAreaCommand extends Command
113114
protected $description = 'Migrate data form old members-area database';
114115

115116
/**
116-
* @var null|\DateTimeZone
117+
* @var null|DateTimeZone
117118
*/
118119
private static $utc = null;
119120

120121
/**
121-
* @var null|\DateTimeZone
122+
* @var null|DateTimeZone
122123
*/
123124
private static $gmt = null;
124125

@@ -130,10 +131,10 @@ class MigrateMembersAreaCommand extends Command
130131
public function handle()
131132
{
132133
if (is_null(self::$utc)) {
133-
self::$utc = new \DateTimeZone('UTC');
134+
self::$utc = new DateTimeZone('UTC');
134135
}
135136
if (is_null(self::$gmt)) {
136-
self::$gmt = new \DateTimeZone('Europe/London');
137+
self::$gmt = new DateTimeZone('Europe/London');
137138
}
138139

139140
$this->info('Please provide details for connecting to the members-area database.');

app/Console/Commands/Invites/PurgeCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Console\Commands\Invites;
44

55
use Carbon\Carbon;
6+
use DateInterval;
67
use HMS\Repositories\InviteRepository;
78
use HMS\Repositories\MetaRepository;
89
use Illuminate\Console\Command;
@@ -59,7 +60,7 @@ public function handle()
5960
if ($this->metaRepository->has('purge_cutoff_interval')) {
6061
$interval = $this->metaRepository->get('purge_cutoff_interval');
6162
$date = Carbon::now()
62-
->sub(new \DateInterval($interval));
63+
->sub(new DateInterval($interval));
6364
} else {
6465
$date = Carbon::now()->subMonths(6);
6566
}

app/Console/Commands/Permissions/BaseCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace App\Console\Commands\Permissions;
44

55
use Doctrine\ORM\EntityManagerInterface;
6-
use Hms\Entities\Role;
6+
use HMS\Entities\Role;
77
use HMS\Repositories\RoleRepository;
88
use Illuminate\Console\Command;
99
use LaravelDoctrine\ACL\Permissions\Permission;

app/Console/Commands/Permissions/ListCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace App\Console\Commands\Permissions;
44

5-
use Hms\Entities\Role;
5+
use HMS\Entities\Role;
66

77
class ListCommand extends BaseCommand
88
{

app/HMS/Doctrine/CarbonType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class CarbonType extends DateTimeType
1414
{
1515
/**
16-
* @var null|\DateTimeZone
16+
* @var null|DateTimeZone
1717
*/
1818
private static $utc = null;
1919

@@ -39,7 +39,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)
3939
}
4040

4141
if (is_null(self::$utc)) {
42-
self::$utc = new \DateTimeZone('UTC');
42+
self::$utc = new DateTimeZone('UTC');
4343
}
4444

4545
if ($value instanceof DateTime) {
@@ -67,7 +67,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform)
6767
}
6868

6969
if (is_null(self::$utc)) {
70-
self::$utc = new \DateTimeZone('UTC');
70+
self::$utc = new DateTimeZone('UTC');
7171
}
7272

7373
if ($value instanceof DateTime) {

app/HMS/Entities/User.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace HMS\Entities;
44

55
use Doctrine\Common\Collections\ArrayCollection;
6+
use Exception;
67
use HMS\Entities\Banking\Account;
78
use HMS\Entities\Gatekeeper\Pin;
89
use HMS\Entities\Gatekeeper\RfidTag;
@@ -240,7 +241,7 @@ public function getAuthPassword()
240241
// TODO: when using Doctrine PasswordStore
241242
// return $this->getPassword();
242243
// else
243-
throw new \Exception('Not Supported');
244+
throw new Exception('Not Supported');
244245
}
245246

246247
/**

app/HMS/Gatekeeper/TemporaryAccessBookingManager.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use App\Events\Gatekeeper\NewBooking;
1010
use Carbon\Carbon;
1111
use Carbon\CarbonInterval;
12+
use DateInterval;
1213
use HMS\Entities\Gatekeeper\BookableArea;
1314
use HMS\Entities\Gatekeeper\Building;
1415
use HMS\Entities\Gatekeeper\BuildingAccessState;
@@ -91,7 +92,7 @@ public function book(
9192

9293
// BASIC CHECKS
9394
$maxLength = (int) CarbonInterval::instance(
94-
new \DateInterval($this->metaRepository->get('temp_access_reset_interval', 'PT12H'))
95+
new DateInterval($this->metaRepository->get('temp_access_reset_interval', 'PT12H'))
9596
)->totalMinutes;
9697
$basicChecks = $this->basicTimeChecks($start, $end, $maxLength);
9798
if (is_string($basicChecks)) {
@@ -217,7 +218,7 @@ public function book(
217218
*
218219
* @return string|TemporaryAccessBooking String with error message or a Booking
219220
*/
220-
public function update(TemporaryAccessBooking $booking, Carbon $start = null, Carbon $end = null)
221+
public function update(TemporaryAccessBooking $booking, ?Carbon $start = null, ?Carbon $end = null)
221222
{
222223
$messages = collect(); // TODO: thinking of a way to pass over limit warnings back to grant.all
223224
// check isApproved
@@ -237,7 +238,7 @@ public function update(TemporaryAccessBooking $booking, Carbon $start = null, Ca
237238
}
238239

239240
$maxLength = (int) CarbonInterval::instance(
240-
new \DateInterval($this->metaRepository->get('temp_access_reset_interval', 'PT12H'))
241+
new DateInterval($this->metaRepository->get('temp_access_reset_interval', 'PT12H'))
241242
)->totalMinutes;
242243
$basicChecks = $this->basicTimeChecks($start, $end, $maxLength);
243244

app/HMS/Tools/BookingManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(
5050
*
5151
* @return string|Booking String with error message or a Booking
5252
*/
53-
public function bookNormal(Tool $tool, Carbon $start, Carbon $end, User $user = null)
53+
public function bookNormal(Tool $tool, Carbon $start, Carbon $end, ?User $user = null)
5454
{
5555
if (is_null($user)) {
5656
$user = Auth::user();
@@ -100,7 +100,7 @@ public function bookNormal(Tool $tool, Carbon $start, Carbon $end, User $user =
100100
*
101101
* @return string|Booking String with error message or a Booking
102102
*/
103-
public function bookInduction(Tool $tool, Carbon $start, Carbon $end, User $user = null)
103+
public function bookInduction(Tool $tool, Carbon $start, Carbon $end, ?User $user = null)
104104
{
105105
if (is_null($user)) {
106106
$user = Auth::user();
@@ -143,7 +143,7 @@ public function bookInduction(Tool $tool, Carbon $start, Carbon $end, User $user
143143
*
144144
* @return string|Booking String with error message or a Booking
145145
*/
146-
public function bookMaintenance(Tool $tool, Carbon $start, Carbon $end, User $user = null)
146+
public function bookMaintenance(Tool $tool, Carbon $start, Carbon $end, ?User $user = null)
147147
{
148148
if (is_null($user)) {
149149
$user = Auth::user();
@@ -190,7 +190,7 @@ public function bookMaintenance(Tool $tool, Carbon $start, Carbon $end, User $us
190190
*
191191
* @return string|Booking String with error message or a Booking
192192
*/
193-
public function update(Tool $tool, Booking $booking, Carbon $start = null, Carbon $end = null)
193+
public function update(Tool $tool, Booking $booking, ?Carbon $start = null, ?Carbon $end = null)
194194
{
195195
$user = Auth::user();
196196

app/HMS/Traits/Entities/SoftDeletable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trait SoftDeletable
1818
*
1919
* @return $this
2020
*/
21-
public function setDeletedAt(Carbon $deletedAt = null)
21+
public function setDeletedAt(?Carbon $deletedAt = null)
2222
{
2323
$this->deletedAt = $deletedAt;
2424

0 commit comments

Comments
 (0)