@@ -365,8 +365,8 @@ |
||
365 | 365 | /** |
366 | 366 | * Check that package is white-listed, is git-package and up-to-date |
367 | 367 | * |
368 | - * @param $package |
|
369 | - * @param $branch |
|
368 | + * @param Package $package |
|
369 | + * @param string $branch |
|
370 | 370 | * |
371 | 371 | * @return void |
372 | 372 | * |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | foreach (['whitelistNames', 'whitelistPaths', 'whitelistRemotes'] as $key) { |
59 | 59 | if (!array_key_exists($key, $config['composer'])) { |
60 | - $config['composer'][ $key ] = null; |
|
60 | + $config['composer'][$key] = null; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | $this->git('push', $package->path, array('u' => 'origin', $package->branch)); |
105 | 105 | $this->console->output( |
106 | 106 | str_repeat(chr(8), strlen($package->name)) |
107 | - . '<info>' . $package->name . '</info>' |
|
107 | + . '<info>'.$package->name.'</info>' |
|
108 | 108 | ); |
109 | - unset($this->pushPackages[ $i ]); |
|
109 | + unset($this->pushPackages[$i]); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | $checkedOutPackages = array_keys($packages); |
148 | 148 | $unfixedRequirements = 0; |
149 | 149 | while ($packageName = array_shift($checkedOutPackages)) { |
150 | - $branch = $packages[ $packageName ]->branch; |
|
151 | - $version = 'dev-' . $branch; |
|
150 | + $branch = $packages[$packageName]->branch; |
|
151 | + $version = 'dev-'.$branch; |
|
152 | 152 | foreach ($this->getPackages(false, false) as $package) { |
153 | 153 | if (array_key_exists($packageName, $package->requires)) { |
154 | 154 | // TODO: Set required version to branch alias, if any |
155 | - $requiredVersion = $package->requires[ $packageName ]; |
|
155 | + $requiredVersion = $package->requires[$packageName]; |
|
156 | 156 | if ($requiredVersion === '@dev') { |
157 | 157 | $requiredVersion = 'dev-master'; |
158 | 158 | } |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | $checkedOutPackages[] = $package->name; |
175 | 175 | } |
176 | 176 | if (!array_key_exists($package->name, $packages)) { |
177 | - $packages[ $package->name ] = $package; |
|
177 | + $packages[$package->name] = $package; |
|
178 | 178 | } |
179 | - $this->pushPackages[ $packageName ] = $packages[ $packageName ]; |
|
179 | + $this->pushPackages[$packageName] = $packages[$packageName]; |
|
180 | 180 | $this->rewriteRequirement($package, $packageName, $version); |
181 | 181 | } else { |
182 | 182 | $unfixedRequirements++; |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | { |
207 | 207 | $this->assertPackageIsWhiteListed($package); |
208 | 208 | |
209 | - $currentVersion = $package->requires[ $requiredPackage ]; |
|
210 | - $composerFile = $package->path . '/composer.json'; |
|
209 | + $currentVersion = $package->requires[$requiredPackage]; |
|
210 | + $composerFile = $package->path.'/composer.json'; |
|
211 | 211 | $composerFileContents = file_get_contents($composerFile); |
212 | 212 | $newComposerFileContents = preg_replace( |
213 | 213 | sprintf( |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | preg_quote($requiredPackage, '/'), |
216 | 216 | preg_quote($currentVersion, '/') |
217 | 217 | ), |
218 | - '$1' . $newVersion, |
|
218 | + '$1'.$newVersion, |
|
219 | 219 | $composerFileContents |
220 | 220 | ); |
221 | 221 | file_put_contents($composerFile, $newComposerFileContents); |
222 | 222 | $package->reloadRequires(); |
223 | - if ($package->requires[ $requiredPackage ] !== $newVersion) { |
|
223 | + if ($package->requires[$requiredPackage] !== $newVersion) { |
|
224 | 224 | file_put_contents($composerFile, $composerFileContents); |
225 | 225 | $this->output('<error>Could not replace version</error> - generated composer.json was:'); |
226 | 226 | $this->output($newComposerFileContents); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | $this->console->output("Made <comment>$package->name</comment> require <comment>$requiredPackage $newVersion</comment>"); |
237 | 237 | |
238 | - $this->pushPackages[ $package->name ] = $package; |
|
238 | + $this->pushPackages[$package->name] = $package; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | if (!$package->git) { |
276 | 276 | throw new Exception('Non git package can not be checked out'); |
277 | 277 | } |
278 | - $remoteBranch = 'origin/' . $branch; |
|
278 | + $remoteBranch = 'origin/'.$branch; |
|
279 | 279 | $isRemote = in_array($remoteBranch, $package->branches, true); |
280 | 280 | if (in_array($branch, $package->branches, true)) { |
281 | 281 | $this->git('checkout', $package->path, $branch); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | } elseif ($create) { |
285 | 285 | $branches = array_unique( |
286 | 286 | array_map( |
287 | - function ($el) { |
|
287 | + function($el) { |
|
288 | 288 | $parts = explode('/', $el); |
289 | 289 | |
290 | 290 | return array_pop($parts); |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | if ($isRemote) { |
310 | - if (!isset($package->upstreams[ $branch ]) || $package->upstreams[ $branch ] !== $remoteBranch) { |
|
310 | + if (!isset($package->upstreams[$branch]) || $package->upstreams[$branch] !== $remoteBranch) { |
|
311 | 311 | $this->git('branch', $package->path, array('u' => $remoteBranch)); |
312 | - $package->upstreams[ $branch ] = $remoteBranch; |
|
312 | + $package->upstreams[$branch] = $remoteBranch; |
|
313 | 313 | } |
314 | 314 | $this->git('rebase', $package->path); |
315 | 315 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $this->console->output("Checked out <comment>{$package->name}</comment> at <comment>$branch</comment>"); |
318 | 318 | |
319 | 319 | $package->reloadRequires(); |
320 | - $package->version = 'dev-' . $branch; |
|
320 | + $package->version = 'dev-'.$branch; |
|
321 | 321 | $package->branch = $branch; |
322 | 322 | |
323 | 323 | return true; |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | if (isset($conflictedFiles) || $this->git('status', $package->path, array('porcelain' => true))) { |
349 | - $this->console->output('You are merging package <comment>' . $package->name . '</comment> from <comment>' . $branch . '</comment> into <comment>' . $package->branch . "</comment>.\n"); |
|
349 | + $this->console->output('You are merging package <comment>'.$package->name.'</comment> from <comment>'.$branch.'</comment> into <comment>'.$package->branch."</comment>.\n"); |
|
350 | 350 | if (!$message) { |
351 | 351 | $message = $this->answer( |
352 | 352 | 'Enter commit message:', |
353 | - 'Merged ' . $branch . ' into ' . $package->branch |
|
353 | + 'Merged '.$branch.' into '.$package->branch |
|
354 | 354 | ); |
355 | 355 | } |
356 | 356 | $this->git('commit', $package->path, array('n' => true, 'm' => $message)); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $this->console->output("Merged with <comment>$branch</comment> in <comment>{$package->name}</comment>"); |
360 | 360 | |
361 | 361 | $package->reloadRequires(); |
362 | - $this->pushPackages[ $package->name ] = $package; |
|
362 | + $this->pushPackages[$package->name] = $package; |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | /** |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | throw new Exception('Non git package can not be merged'); |
381 | 381 | } |
382 | 382 | |
383 | - $this->git('fetch', $package->path, array('force' => true, 'origin', $branch . ':' . $branch)); |
|
383 | + $this->git('fetch', $package->path, array('force' => true, 'origin', $branch.':'.$branch)); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | } else { |
402 | 402 | $mergeOptions['no-commit'] = true; |
403 | 403 | $ff = $branch == 'master' ? 'ff' : 'no-ff'; |
404 | - $mergeOptions[ $ff ] = true; |
|
404 | + $mergeOptions[$ff] = true; |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | $mergeOptions[] = $branch; |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | */ |
452 | 452 | private function resolveRequirementsConflict($package) |
453 | 453 | { |
454 | - $contents = file_get_contents($package->path . '/composer.json'); |
|
454 | + $contents = file_get_contents($package->path.'/composer.json'); |
|
455 | 455 | $ours = @json_decode( |
456 | 456 | preg_replace('/^<{7}.+\n(.+)\n(\|{7}|={7}).+>{7}.+$/smU', '$1', $contents) |
457 | 457 | ); |
@@ -463,8 +463,8 @@ discard block |
||
463 | 463 | } |
464 | 464 | $diff = array_diff_key($theirs = get_object_vars($theirs), $ours = get_object_vars($ours)); |
465 | 465 | foreach ($ours as $key => $value) { |
466 | - if ($key !== 'require' && (!array_key_exists($key, $theirs) || serialize($value) !== serialize($theirs[ $key ]))) { |
|
467 | - $diff[ $key ] = $value; |
|
466 | + if ($key !== 'require' && (!array_key_exists($key, $theirs) || serialize($value) !== serialize($theirs[$key]))) { |
|
467 | + $diff[$key] = $value; |
|
468 | 468 | } |
469 | 469 | } |
470 | 470 | if ($diff !== array()) { |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | } |
473 | 473 | |
474 | 474 | $theirs['require'] = $this->mergeRequirements($package, $ours, $theirs); |
475 | - file_put_contents($package->path . '/composer.json', $this->jsonEncode($theirs)); |
|
475 | + file_put_contents($package->path.'/composer.json', $this->jsonEncode($theirs)); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | /** |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | { |
487 | 487 | return json_encode( |
488 | 488 | $var, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE |
489 | - ) . "\n"; |
|
489 | + )."\n"; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
@@ -504,17 +504,17 @@ discard block |
||
504 | 504 | $theirsRequire = isset($theirs['require']) && is_object($theirs['require']) ? get_object_vars($theirs['require']) : []; |
505 | 505 | $mergedRequires = array_merge($oursRequire, $theirsRequire); |
506 | 506 | $packages = $this->getPackages(false, false); |
507 | - $preferredVersion = 'dev-' . $package->branch; |
|
507 | + $preferredVersion = 'dev-'.$package->branch; |
|
508 | 508 | foreach ($mergedRequires as $packageName => $version) { |
509 | 509 | $actualVersion = ($version === '@dev') ? 'dev-master' : $version; |
510 | 510 | if (array_key_exists($packageName, $oursRequire) |
511 | - && $version !== $oursRequire[ $packageName ] |
|
512 | - && $actualVersion !== $oursRequire[ $packageName ] |
|
511 | + && $version !== $oursRequire[$packageName] |
|
512 | + && $actualVersion !== $oursRequire[$packageName] |
|
513 | 513 | && $actualVersion !== $preferredVersion |
514 | 514 | && array_key_exists($packageName, $packages) |
515 | - && in_array($package->branch, $packages[ $packageName ]->branches, true) |
|
515 | + && in_array($package->branch, $packages[$packageName]->branches, true) |
|
516 | 516 | ) { |
517 | - $mergedRequires[ $packageName ] = $preferredVersion; |
|
517 | + $mergedRequires[$packageName] = $preferredVersion; |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $packages = array(); |
537 | 537 | foreach ($this->get('composer.packages') as $package) { |
538 | 538 | if ((!$gitOnly || $package->git) && (!$allowedOnly || $this->isPackageAllowed($package))) { |
539 | - $packages[ $package->name ] = $package; |
|
539 | + $packages[$package->name] = $package; |
|
540 | 540 | } |
541 | 541 | } |
542 | 542 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | protected function isPackageAllowed(Package $package) |
570 | 570 | { |
571 | 571 | if (!is_array($this->packageNames)) { |
572 | - $this->packageNames = array_fill_keys($this->get('packages') ? : [], null); |
|
572 | + $this->packageNames = array_fill_keys($this->get('packages') ?: [], null); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | if ($this->packageNames) { |
@@ -577,11 +577,11 @@ discard block |
||
577 | 577 | return false; |
578 | 578 | } |
579 | 579 | if ($this->isPackageWhiteListed($package) === false) { |
580 | - if ($this->packageNames[ $package->name ] === null) { |
|
581 | - $this->packageNames[ $package->name ] = $this->confirm("The package $package->name is excluded by your whitelist configuration - are you sure you want to include it anyway?"); |
|
580 | + if ($this->packageNames[$package->name] === null) { |
|
581 | + $this->packageNames[$package->name] = $this->confirm("The package $package->name is excluded by your whitelist configuration - are you sure you want to include it anyway?"); |
|
582 | 582 | } |
583 | 583 | |
584 | - return $this->packageNames[ $package->name ]; |
|
584 | + return $this->packageNames[$package->name]; |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | return true; |
@@ -602,9 +602,9 @@ discard block |
||
602 | 602 | if (!is_array($this->whitelists)) { |
603 | 603 | $this->whitelists = []; |
604 | 604 | foreach (['path', 'remote', 'name'] as $whiteListType) { |
605 | - $option = $this->get('whitelist' . ucfirst($whiteListType) . 's'); |
|
605 | + $option = $this->get('whitelist'.ucfirst($whiteListType).'s'); |
|
606 | 606 | if ($option) { |
607 | - $this->whitelists[ $whiteListType ] = '#^' . $option . '$#'; |
|
607 | + $this->whitelists[$whiteListType] = '#^'.$option.'$#'; |
|
608 | 608 | } |
609 | 609 | } |
610 | 610 | } |