@@ -177,28 +177,33 @@ private function assertMagentoConventions($dir, $packageType, \StdClass $json)
177
177
$ this ->assertDependsOnFramework ($ json ->require );
178
178
$ this ->assertRequireInSync ($ json );
179
179
$ this ->assertAutoload ($ json );
180
+ $ this ->assertNoVersionSpecified ($ json );
180
181
break ;
181
182
case 'magento2-language ' :
182
183
$ this ->assertRegExp ('/^magento\/language\-[a-z]{2}_([a-z]{4}_)?[a-z]{2}$/ ' , $ json ->name );
183
184
$ this ->assertDependsOnFramework ($ json ->require );
184
185
$ this ->assertRequireInSync ($ json );
186
+ $ this ->assertNoVersionSpecified ($ json );
185
187
break ;
186
188
case 'magento2-theme ' :
187
189
$ this ->assertRegExp ('/^magento\/theme-(?:adminhtml|frontend)(\-[a-z0-9_]+)+$/ ' , $ json ->name );
188
190
$ this ->assertDependsOnPhp ($ json ->require );
189
191
$ this ->assertPhpVersionInSync ($ json ->name , $ json ->require ->php );
190
192
$ this ->assertDependsOnFramework ($ json ->require );
191
193
$ this ->assertRequireInSync ($ json );
194
+ $ this ->assertNoVersionSpecified ($ json );
192
195
break ;
193
196
case 'magento2-library ' :
194
197
$ this ->assertDependsOnPhp ($ json ->require );
195
198
$ this ->assertRegExp ('/^magento\/framework*/ ' , $ json ->name );
196
199
$ this ->assertPhpVersionInSync ($ json ->name , $ json ->require ->php );
197
200
$ this ->assertRequireInSync ($ json );
198
201
$ this ->assertAutoload ($ json );
202
+ $ this ->assertNoVersionSpecified ($ json );
199
203
break ;
200
204
case 'project ' :
201
205
$ this ->checkProject ();
206
+ $ this ->assertNoVersionSpecified ($ json );
202
207
break ;
203
208
default :
204
209
throw new \InvalidArgumentException ("Unknown package type {$ packageType }" );
@@ -220,6 +225,19 @@ private function assertAutoloadRegistrar(\StdClass $json, $dir)
220
225
$ this ->assertFileExists ("$ dir/registration.php " );
221
226
}
222
227
228
+ /**
229
+ * Version must not be specified in the root and package composer JSON files in Git.
230
+ *
231
+ * All versions are added by tools during release publication by version setter tool.
232
+ *
233
+ * @param \StdClass $json
234
+ */
235
+ private function assertNoVersionSpecified (\StdClass $ json )
236
+ {
237
+ $ errorMessage = 'Version must not be specified in the root and package composer JSON files in Git ' ;
238
+ $ this ->assertObjectNotHasAttribute ('version ' , $ json , $ errorMessage );
239
+ }
240
+
223
241
/**
224
242
* Assert that there is PSR-4 autoload in composer json
225
243
*
0 commit comments