PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
← All changes | jetpack_vendor/automattic/jetpack-sync/src/class-modules.php +11 -5 12.2.3 → 16.3-a.7 View file →
@@ -89,11 +89,13 @@
89 89 * @static
90 90 *
91 91 * @param string $module_name A module name.
92 92 *
93 - * @return bool|Automattic\Jetpack\Sync\Modules\Module
93 + * @return bool|\Automattic\Jetpack\Sync\Modules\Module
94 94 */
95 95 public static function get_module( $module_name ) {
96 + // @todo Better type hinting for Phan if https://github.com/phan/phan/issues/3842 gets fixed. Then clean up the `@phan-var` on all the callers.
97 +
96 98 foreach ( self::get_modules() as $module ) {
97 99 if ( $module->name() === $module_name ) {
98 100 return $module;
99 101 }
@@ -110,8 +112,9 @@
110 112 *
111 113 * @return array
112 114 */
113 115 public static function initialize_modules() {
116 +
114 117 /**
115 118 * Filters the list of class names of sync modules.
116 119 * If you add to this list, make sure any classes implement the
117 120 * Jetpack_Sync_Module interface.
@@ -120,10 +123,12 @@
120 123 * @since-jetpack 4.2.0
121 124 */
122 125 $modules = apply_filters( 'jetpack_sync_modules', self::DEFAULT_SYNC_MODULES );
123 126
127 + // Exact class duplicates keep the position of their first contribution.
128 + $modules = array_unique( $modules );
129 +
124 130 $modules = array_map( array( __CLASS__, 'load_module' ), $modules );
125 -
126 131 return array_map( array( __CLASS__, 'set_module_defaults' ), $modules );
127 132 }
128 133
129 134 /**
@@ -133,9 +138,9 @@
133 138 * @static
134 139 *
135 140 * @param string $module_class The classname of a Jetpack sync module.
136 141 *
137 - * @return Automattic\Jetpack\Sync\Modules\Module
142 + * @return \Automattic\Jetpack\Sync\Modules\Module
138 143 */
139 144 public static function load_module( $module_class ) {
140 145 return new $module_class();
141 146 }
@@ -145,15 +150,16 @@
145 150 *
146 151 * @access public
147 152 * @static
148 153 *
149 - * @param Automattic\Jetpack\Sync\Modules\Module $module Instance of a Jetpack sync module.
154 + * @param \Automattic\Jetpack\Sync\Modules\Module $module Instance of a Jetpack sync module.
150 155 *
151 - * @return Automattic\Jetpack\Sync\Modules\Module
156 + * @return \Automattic\Jetpack\Sync\Modules\Module
152 157 */
153 158 public static function set_module_defaults( $module ) {
154 159 $module->set_defaults();
155 160 if ( method_exists( $module, 'set_late_default' ) ) {
161 + // @phan-suppress-next-line PhanUndeclaredMethodInCallable -- https://github.com/phan/phan/issues/1204
156 162 add_action( 'init', array( $module, 'set_late_default' ), 90 );
157 163 }
158 164 return $module;
159 165 }