Skip to content

Commit

Permalink
Merge pull request #24 from richan-fongdasen/analysis-3wx3V9
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI

[ci skip] [skip ci]
  • Loading branch information
richan-fongdasen authored Mar 8, 2020
2 parents 05bd04b + dd66b90 commit 913fe8d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/BlameableObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BlameableObserver
*
* @return void
*/
public function creating(Model $model) :void
public function creating(Model $model): void
{
app(BlameableService::class)->setAttribute($model, 'createdBy', blameable_user($model));
}
Expand All @@ -25,7 +25,7 @@ public function creating(Model $model) :void
*
* @return void
*/
public function deleted(Model $model) :void
public function deleted(Model $model): void
{
app(BlameableService::class)->setAttribute($model, 'deletedBy', blameable_user($model));

Expand All @@ -44,7 +44,7 @@ public function deleted(Model $model) :void
*
* @return void
*/
public function restoring(Model $model) :void
public function restoring(Model $model): void
{
app(BlameableService::class)->setAttribute($model, 'deletedBy', null);
}
Expand All @@ -56,7 +56,7 @@ public function restoring(Model $model) :void
*
* @return void
*/
public function saving(Model $model) :void
public function saving(Model $model): void
{
app(BlameableService::class)->setAttribute($model, 'updatedBy', blameable_user($model));
}
Expand Down
6 changes: 3 additions & 3 deletions src/BlameableService.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct()
*
* @return array<string>
*/
private function getConfigurations(Model $model) :array
private function getConfigurations(Model $model): array
{
$modelConfigurations = method_exists($model, 'blameable') ?
$model->blameable() : [];
Expand All @@ -54,7 +54,7 @@ public function getConfiguration(Model $model, string $key)
*
* @return void
*/
public function loadConfig() :void
public function loadConfig(): void
{
$this->globalConfig = app('config')->get('blameable');
}
Expand All @@ -68,7 +68,7 @@ public function loadConfig() :void
*
* @return bool
*/
public function setAttribute(Model $model, string $key, $userId) :bool
public function setAttribute(Model $model, string $key, $userId): bool
{
$attribute = $this->getConfiguration($model, $key);

Expand Down
18 changes: 9 additions & 9 deletions src/BlameableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait BlameableTrait
*
* @return array
*/
public function blameable() :array
public function blameable(): array
{
if (property_exists($this, 'blameable')) {
return (array) static::$blameable;
Expand All @@ -29,7 +29,7 @@ public function blameable() :array
*
* @return void
*/
public static function bootBlameableTrait() :void
public static function bootBlameableTrait(): void
{
static::observe(app(BlameableObserver::class));
}
Expand All @@ -43,7 +43,7 @@ public static function bootBlameableTrait() :void
*
* @return \Illuminate\Database\Eloquent\Builder
*/
private function buildBlameableScope(Builder $query, $userId, $key) :Builder
private function buildBlameableScope(Builder $query, $userId, $key): Builder
{
if ($userId instanceof Model) {
$userId = $userId->getKey();
Expand All @@ -57,7 +57,7 @@ private function buildBlameableScope(Builder $query, $userId, $key) :Builder
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function creator() :BelongsTo
public function creator(): BelongsTo
{
return $this->belongsTo(
app(BlameableService::class)->getConfiguration($this, 'user'),
Expand All @@ -70,7 +70,7 @@ public function creator() :BelongsTo
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function updater() :BelongsTo
public function updater(): BelongsTo
{
return $this->belongsTo(
app(BlameableService::class)->getConfiguration($this, 'user'),
Expand All @@ -86,7 +86,7 @@ public function updater() :BelongsTo
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeCreatedBy(Builder $query, $userId) :Builder
public function scopeCreatedBy(Builder $query, $userId): Builder
{
return $this->buildBlameableScope($query, $userId, 'createdBy');
}
Expand All @@ -99,7 +99,7 @@ public function scopeCreatedBy(Builder $query, $userId) :Builder
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeUpdatedBy(Builder $query, $userId) :Builder
public function scopeUpdatedBy(Builder $query, $userId): Builder
{
return $this->buildBlameableScope($query, $userId, 'updatedBy');
}
Expand All @@ -110,7 +110,7 @@ public function scopeUpdatedBy(Builder $query, $userId) :Builder
*
* @return int
*/
public function silentUpdate() :int
public function silentUpdate(): int
{
return $this->newQueryWithoutScopes()
->where($this->getKeyName(), $this->getKey())
Expand All @@ -123,7 +123,7 @@ public function silentUpdate() :int
*
* @return bool
*/
public function useSoftDeletes() :bool
public function useSoftDeletes(): bool
{
return in_array(SoftDeletes::class, class_uses_recursive($this), true);
}
Expand Down
6 changes: 3 additions & 3 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ServiceProvider extends Provider
*
* @return bool
*/
protected function isLumen() :bool
protected function isLumen(): bool
{
return strpos($this->app->version(), 'Lumen') !== false;
}
Expand All @@ -21,7 +21,7 @@ protected function isLumen() :bool
*
* @return void
*/
public function boot() :void
public function boot(): void
{
if (!$this->isLumen()) {
$this->publishes([
Expand All @@ -35,7 +35,7 @@ public function boot() :void
*
* @return void
*/
public function register() :void
public function register(): void
{
$configPath = realpath(dirname(__DIR__).'/config/blameable.php');

Expand Down

0 comments on commit 913fe8d

Please sign in to comment.