1616 * Controller to process the Discourse SSO request. There is a good bit of logic in here that almost feels like too
1717 * much for a controller, but given that this is the only thing that this controller is doing, I am not going to break
1818 * it out into a service class.
19- *
20- * @package Spinen\Discourse\Controllers
2119 */
2220class SsoController extends Controller
2321{
2422 /**
2523 * Package configuration
26- *
27- * @var Collection
2824 */
29- protected $ config ;
25+ protected Collection $ config ;
3026
3127 /**
3228 * SSOHelper Instance
33- *
34- * @var SSOHelper
3529 */
36- protected $ sso ;
30+ protected SSOHelper $ sso ;
3731
3832 /**
3933 * Authenticated user
40- *
41- * @var User
4234 */
43- protected $ user ;
35+ protected User $ user ;
4436
4537 /**
4638 * SsoController constructor.
47- *
48- * @param Config $config
49- * @param SSOHelper $sso
5039 */
5140 public function __construct (Config $ config , SSOHelper $ sso )
5241 {
@@ -57,10 +46,8 @@ public function __construct(Config $config, SSOHelper $sso)
5746
5847 /**
5948 * Build out the extra parameters to send to Discourse
60- *
61- * @return array
6249 */
63- protected function buildExtraParameters ()
50+ protected function buildExtraParameters (): array
6451 {
6552 return $ this ->config ->get ('user ' )
6653 ->except (['access ' , 'email ' , 'external_id ' ])
@@ -75,12 +62,8 @@ protected function buildExtraParameters()
7562 *
7663 * The Discourse SSO API does not accept 0 or 1 for false or true. You must send
7764 * "false" or "true", so convert any boolean property to the string version.
78- *
79- * @param $property
80- *
81- * @return string
8265 */
83- public function castBooleansToString ($ property )
66+ public function castBooleansToString (string | bool $ property ): string
8467 {
8568 if (! is_bool ($ property )) {
8669 return $ property ;
@@ -93,10 +76,8 @@ public function castBooleansToString($property)
9376 * Cache the configs on the object as a collection
9477 *
9578 * The 'user' property will be an array, so go ahead and convert it to a collection
96- *
97- * @param Config $config
9879 */
99- protected function loadConfigs (Config $ config )
80+ protected function loadConfigs (Config $ config ): void
10081 {
10182 $ this ->config = collect ($ config ->get ('services.discourse ' ));
10283 $ this ->config ->put ('user ' , collect ($ this ->config ->get ('user ' )));
@@ -105,9 +86,6 @@ protected function loadConfigs(Config $config)
10586 /**
10687 * Process the SSO login request from Discourse
10788 *
108- * @param Request $request
109- *
110- * @return mixed
11189 * @throws 403
11290 */
11391 public function login (Request $ request )
@@ -138,11 +116,8 @@ public function login(Request $request)
138116
139117 /**
140118 * Check to see if property is null
141- *
142- * @param string $property
143- * @return bool
144119 */
145- public function nullProperty ($ property )
120+ public function nullProperty (? string $ property ): bool
146121 {
147122 return is_null ($ property );
148123 }
@@ -151,9 +126,6 @@ public function nullProperty($property)
151126 * Get the property from the user
152127 *
153128 * If a string is passed in, then get it from the user object, otherwise, return what was given
154- *
155- * @param mixed $property
156- * @return mixed
157129 */
158130 public function parseUserValue ($ property )
159131 {
0 commit comments