diff --git a/README.md b/README.md index 50aac98..d795290 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,36 @@ provider, however it should ostensibly work with any provider. * [Configuration](docs/LARAVEL_CONFIG.md) * [Usage](docs/LARAVEL_USAGE.md) -### Other +### Generic -* [Installation](docs/OTHER_INSTALL.md) -* [Usage](docs/OTHER_USAGE.md) +* [Installation](docs/GENERIC_INSTALL.md) +* [Usage](docs/GENERIC_USAGE.md) +### Other Documentation + +* [Internals](docs/INTERNALS.md) +* [TODO](TODO.md) + +## Contributing + +Before submitting a PR, please run phan across your branch and ensure that no +issues are reported: + +``` +$ composer analyze +``` + +If any issues are returned, please resolve the underlying issue(s). Do not just +twist your code into a knot trying to work around the analysis. Any use of the +suppression comments to suppress issues require a comment immediately preceeding +explaining in detail why the code is provably correct. However, if there is any +workaround besides disabling issue reporting the change will be sent back for +further refinement. + +After analysis, please ensure your changes follow the code formatting standards +used in this project by running php-cs-fixer: + +``` +$ composer format +``` diff --git a/docs/OTHER_INSTALL.md b/docs/OTHER_INSTALL.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/OTHER_USAGE.md b/docs/OTHER_USAGE.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/Http/Controllers/AuthenticationController.php b/src/Http/Controllers/AuthenticationController.php index 57bd369..4f9b2fb 100644 --- a/src/Http/Controllers/AuthenticationController.php +++ b/src/Http/Controllers/AuthenticationController.php @@ -95,6 +95,9 @@ class AuthenticationController extends Controller if (!isset($user)) { abort(500); + // We die() after each abort to help the static analyzer (phan) + // along, otherwise it doesn't realize that abort ends execution + // and is worried that we've hit the below code in an invalid state. die(); } elseif (!method_exists($user, 'save')) @@ -118,9 +121,7 @@ class AuthenticationController extends Controller die(); } $token->refresh_token = $refresh_token; - // @phan-suppress-next-line PhanNonClassMethodCall $token->user_id = $user->{$user->getAuthIdentifierName()}; - // @phan-suppress-next-line PhanNonClassMethodCall $token->save(); } else @@ -137,12 +138,12 @@ class AuthenticationController extends Controller { // TODO: Log a useful error message abort(500); + die(); } // If nothing handled the login event, assume we're using laravel default // everything and just go ahead and update the name/email $user->name = $user_info['name']; $user->email = $user_info['email']; - // @phan-suppress-next-line PhanNonClassMethodCall $user->save(); } diff --git a/src/Oidc/Flows/ServiceAccountFlow.php b/src/Oidc/Flows/ServiceAccountFlow.php index 48b3dc7..fdeab19 100644 --- a/src/Oidc/Flows/ServiceAccountFlow.php +++ b/src/Oidc/Flows/ServiceAccountFlow.php @@ -35,6 +35,6 @@ class ServiceAccountFlow */ public function getServiceAccountToken(): Token { - $token = $this->client->createTokenFromClient(); + return $this->client->createTokenFromClient(); } } diff --git a/src/Providers/AuthnServiceProvider.php b/src/Providers/AuthnServiceProvider.php index 3af22c6..5ca416c 100644 --- a/src/Providers/AuthnServiceProvider.php +++ b/src/Providers/AuthnServiceProvider.php @@ -66,6 +66,9 @@ class AuthnServiceProvider extends ServiceProvider // TODO: For some reason route($name) isn't working here. We're // just looking through the routes manually for now... + // Might shoot ourselves in the foot if the routing system is + // ever changed, but for now this works and this whole method + // is a hack anyway. // @phan-suppress-next-line PhanTypeNoPropertiesForeach foreach (\Route::getRoutes() as $route) {