99namespace ether \simplemap ;
1010
1111use Craft ;
12+ use craft \base \Model ;
1213use craft \base \Plugin ;
1314use craft \events \RegisterComponentTypesEvent ;
14- use craft \events \RegisterGqlQueriesEvent ;
1515use craft \events \RegisterGqlTypesEvent ;
1616use craft \events \RegisterUrlRulesEvent ;
1717use craft \helpers \UrlHelper ;
2121use craft \web \twig \variables \CraftVariable ;
2222use craft \web \UrlManager ;
2323use ether \simplemap \fields \MapField as MapField ;
24- use ether \simplemap \integrations \craftql \GetCraftQLSchema ;
2524use ether \simplemap \integrations \feedme \FeedMeMaps ;
2625use ether \simplemap \integrations \graphql \MapPartsType ;
2726use ether \simplemap \integrations \graphql \MapType ;
3130use ether \simplemap \services \MapService ;
3231use ether \simplemap \services \StaticService ;
3332use ether \simplemap \web \Variable ;
33+ use Exception ;
3434use yii \base \Event ;
35+ use yii \base \InvalidConfigException ;
3536
3637/**
3738 * Class SimpleMap
@@ -52,7 +53,7 @@ class SimpleMap extends Plugin
5253 // Properties
5354 // =========================================================================
5455
55- public $ hasCpSettings = true ;
56+ public bool $ hasCpSettings = true ;
5657
5758 // Static
5859 // =========================================================================
@@ -116,15 +117,6 @@ public function init ()
116117 );
117118 }
118119
119- if (class_exists (\markhuot \CraftQL \CraftQL::class))
120- {
121- Event::on (
122- MapField::class,
123- 'craftQlGetFieldSchema ' ,
124- [new GetCraftQLSchema , 'handle ' ]
125- );
126- }
127-
128120 if (class_exists (\craft \feedme \Plugin::class))
129121 {
130122 Event::on (
@@ -150,39 +142,39 @@ public function init ()
150142 }
151143 }
152144
153- protected function beforeUninstall (): bool
145+ protected function beforeUninstall (): void
154146 {
155147 if ($ this ->getSettings ()->geoLocationService === GeoLocationService::MaxMindLite)
156148 GeoLocationService::purgeDb ();
157-
158- return parent ::beforeUninstall ();
159149 }
160150
161151 // Settings
162152 // =========================================================================
163153
164- protected function createSettingsModel ()
154+ protected function createSettingsModel (): Model
165155 {
166156 return new Settings ();
167157 }
168158
169159 /**
170- * @return bool|\craft\base\ Model|Settings
160+ * @return Model
171161 */
172- public function getSettings ()
162+ public function getSettings (): Model
173163 {
174164 return parent ::getSettings ();
175165 }
176166
177- protected function settingsHtml ()
167+ protected function settingsHtml (): ? string
178168 {
179169 // Redirect to our settings page
180170 Craft::$ app ->controller ->redirect (
181171 UrlHelper::cpUrl ('maps/settings ' )
182172 );
173+
174+ return null ;
183175 }
184176
185- public function afterSaveSettings ()
177+ public function afterSaveSettings (): void
186178 {
187179 parent ::afterSaveSettings ();
188180
@@ -210,7 +202,7 @@ public function onRegisterFieldTypes (RegisterComponentTypesEvent $event)
210202 /**
211203 * @param Event $event
212204 *
213- * @throws \yii\base\ InvalidConfigException
205+ * @throws InvalidConfigException
214206 */
215207 public function onRegisterVariable (Event $ event )
216208 {
@@ -232,7 +224,7 @@ public function onRegisterGqlTypes (RegisterGqlTypesEvent $event)
232224 }
233225
234226 /**
235- * @throws \ Exception
227+ * @throws Exception
236228 */
237229 public function onApplicationInit ()
238230 {
@@ -243,12 +235,12 @@ public function onApplicationInit ()
243235 // Helpers
244236 // =========================================================================
245237
246- public static function t ($ message , $ params = [])
238+ public static function t ($ message , $ params = []): string
247239 {
248240 return Craft::t ('simplemap ' , $ message , $ params );
249241 }
250242
251- public static function v ($ version , $ operator = '= ' )
243+ public static function v ($ version , $ operator = '= ' ): bool
252244 {
253245 return SimpleMap::getInstance ()->is ($ version , $ operator );
254246 }
0 commit comments