Skip to content

Commit

Permalink
fix policies + remaining PHPDoc errors
Browse files Browse the repository at this point in the history
  • Loading branch information
esizer committed Oct 3, 2024
1 parent 8cb6e5f commit 4b6ca6a
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 123 deletions.
2 changes: 0 additions & 2 deletions api/app/Console/Commands/CheckIntl.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Console\Commands;

use App\Discoverers\EnumDiscoverer;
use App\Traits\HasLocalization;
use Illuminate\Console\Command;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Lang;
Expand Down Expand Up @@ -79,7 +78,6 @@ public function handle()
{
$this->localizedEnums = EnumDiscoverer::discoverLocalizedEnums();

/** @var HasLocalization $enum */
foreach ($this->localizedEnums as $enum) {
$this->checkStrings($enum);
}
Expand Down
5 changes: 0 additions & 5 deletions api/app/Policies/ClassificationPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public function viewAny(?User $user)
*
* Note: This action is possible for everyone, including anonymous users
*
* @param \App\Models\Classification $classification
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(?User $user)
Expand All @@ -47,7 +46,6 @@ public function create(User $user)
/**
* Determine whether the user can update the model.
*
* @param \App\Models\Classification $classification
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user)
Expand All @@ -58,7 +56,6 @@ public function update(User $user)
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\Classification $classification
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user)
Expand All @@ -69,7 +66,6 @@ public function delete(User $user)
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\Classification $classification
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user)
Expand All @@ -80,7 +76,6 @@ public function restore(User $user)
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\Classification $classification
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user)
Expand Down
2 changes: 0 additions & 2 deletions api/app/Policies/CommunityPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public function create(User $user)
/**
* Determine whether the user can update models.
*
* @param \App\Models\Community|null $community
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, Community $community)
Expand All @@ -55,7 +54,6 @@ public function update(User $user, Community $community)
/**
* Determine whether the user can view the team members of a specific communities team
*
* @param \App\Models\Community|null $community
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewTeamMembers(User $user, Community $community)
Expand Down
5 changes: 0 additions & 5 deletions api/app/Policies/DepartmentPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public function viewAny(?User $user)
*
* Note: This action is possible for everyone, including anonymous users
*
* @param \App\Models\Department $department
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(?User $user)
Expand All @@ -47,7 +46,6 @@ public function create(User $user)
/**
* Determine whether the user can update the model.
*
* @param \App\Models\Department $department
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user)
Expand All @@ -58,7 +56,6 @@ public function update(User $user)
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\Department $department
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user)
Expand All @@ -69,7 +66,6 @@ public function delete(User $user)
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\Department $department
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user)
Expand All @@ -80,7 +76,6 @@ public function restore(User $user)
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\Department $department
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user)
Expand Down
5 changes: 0 additions & 5 deletions api/app/Policies/GenericJobTitlePolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public function viewAny(?User $user)
*
* Note: This action is possible for everyone, including anonymous users
*
* @param \App\Models\Classification $classification
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(?User $user)
Expand All @@ -47,7 +46,6 @@ public function create(User $user)
/**
* Determine whether the user can update the model.
*
* @param \App\Models\Classification $classification
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user)
Expand All @@ -58,7 +56,6 @@ public function update(User $user)
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\Classification $classification
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user)
Expand All @@ -69,7 +66,6 @@ public function delete(User $user)
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\Classification $classification
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user)
Expand All @@ -80,7 +76,6 @@ public function restore(User $user)
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\Classification $classification
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user)
Expand Down
1 change: 0 additions & 1 deletion api/app/Policies/PoolCandidatePolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ public function suspend(User $user, PoolCandidate $poolCandidate)
* Note: Everyone needs to be able to count applicants
* for now
*
* @param \App\Models\PoolCandidate $poolCandidate
* @return \Illuminate\Auth\Access\Response|bool
*/
public function count()
Expand Down
5 changes: 0 additions & 5 deletions api/app/Policies/RolePolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class RolePolicy
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User|null $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
Expand All @@ -35,8 +34,6 @@ public function viewAnyRoleAssignments(User $user)
/**
* Determine whether the user can view a specific role
*
* @param \App\Models\User|null $user
* @param \App\Models\Role|null $role
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user)
Expand All @@ -47,8 +44,6 @@ public function view(User $user)
/**
* Determine whether the user can update a specific role
*
* @param \App\Models\User|null $user
* @param \App\Models\Role|null $role
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user)
Expand Down
5 changes: 0 additions & 5 deletions api/app/Policies/SkillFamilyPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public function viewAny(?User $user)
*
* Note: This action is possible for everyone, including anonymous users
*
* @param \App\Models\SkillFamily $skillFamily
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(?User $user)
Expand All @@ -47,7 +46,6 @@ public function create(User $user)
/**
* Determine whether the user can update the model.
*
* @param \App\Models\SkillFamily $skillFamily
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user)
Expand All @@ -58,7 +56,6 @@ public function update(User $user)
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\SkillFamily $skillFamily
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user)
Expand All @@ -69,7 +66,6 @@ public function delete(User $user)
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\SkillFamily $skillFamily
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user)
Expand All @@ -80,7 +76,6 @@ public function restore(User $user)
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\SkillFamily $skillFamily
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user)
Expand Down
5 changes: 0 additions & 5 deletions api/app/Policies/SkillPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public function viewAny(?User $user)
*
* Note: This action is possible for everyone, including anonymous users
*
* @param \App\Models\Skill $skill
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(?User $user)
Expand All @@ -47,7 +46,6 @@ public function create(User $user)
/**
* Determine whether the user can update the model.
*
* @param \App\Models\Skill $skill
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user)
Expand All @@ -58,7 +56,6 @@ public function update(User $user)
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\Skill $skill
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user)
Expand All @@ -69,7 +66,6 @@ public function delete(User $user)
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\Skill $skill
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user)
Expand All @@ -80,7 +76,6 @@ public function restore(User $user)
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\Skill $skill
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user)
Expand Down
3 changes: 1 addition & 2 deletions api/app/Policies/TeamPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ public function delete(User $user)
/**
* Determine whether the user can view a specific teams, team members.
*
* @param \App\Models\Team/null $team
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewTeamMembers(User $user, Team $team)
public function viewTeamMembers(User $user, ?Team $team)
{
return $user->isAbleTo('view-any-teamMembers') || $user->isAbleTo('view-team-teamMembers', $team);
}
Expand Down
3 changes: 1 addition & 2 deletions api/app/Providers/GraphQLServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ static function () use ($name, $enum): EnumType {

/** Discover all enums in the App\Enum namespace that implement the HasLocalization trait
* and register them as a LocalizedEnum type in GraphQL
*
* @var array<HasLocalization>
*/
$localizedEnums = EnumDiscoverer::discoverLocalizedEnums();

Expand All @@ -65,6 +63,7 @@ static function () use ($name, $enum): EnumType {
$resolver = function ($value, $args, $context, ResolveInfo $info) use ($enum) {
switch ($info->fieldName) {
case 'value': return $value;
/** @disregard P1013 Can't type hint traits */
case 'label': return $enum::localizedString($value);
default: return null;
}
Expand Down
9 changes: 0 additions & 9 deletions api/app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ class RouteServiceProvider extends ServiceProvider
*/
public const HOME = '/home';

/**
* The controller namespace for the application.
*
* When present, controller route declarations will automatically be prefixed with this namespace.
*
* @var string|null
*/
// protected $namespace = 'App\\Http\\Controllers';

/**
* Define your route model bindings, pattern filters, etc.
*
Expand Down
Loading

0 comments on commit 4b6ca6a

Please sign in to comment.