This repository has been archived by the owner on Jan 6, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed KernelManipulator to work with PHP short array syntax.
- Loading branch information
Showing
8 changed files
with
203 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Tests/Manipulator/Stubs/ContainsBundlesShortArraySyntaxKernelStub.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KernelManipulatorTest\Stubs; | ||
|
||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; | ||
use Sensio\Bundle\GeneratorBundle\Tests\Manipulator\Stubs\StubBundle; | ||
|
||
class ContainsBundlesShortArraySyntaxKernelStub extends KernelForTest | ||
{ | ||
public function registerBundles() | ||
{ | ||
$bundles = [ | ||
new StubBundle(), | ||
new StubBundle(), | ||
new StubBundle(), | ||
]; | ||
|
||
return $bundles; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Tests/Manipulator/Stubs/ContainsCommaShortArraySyntaxKernelStub.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KernelManipulatorTest\Stubs; | ||
|
||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; | ||
use Sensio\Bundle\GeneratorBundle\Tests\Manipulator\Stubs\StubBundle; | ||
|
||
class ContainsCommaShortArraySyntaxKernelStub extends KernelForTest | ||
{ | ||
public function registerBundles() | ||
{ | ||
$bundles = [ | ||
new StubBundle(), | ||
]; | ||
|
||
return $bundles; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
Tests/Manipulator/Stubs/ContainsExtraCodeShortArraySyntaxKernelStub.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KernelManipulatorTest\Stubs; | ||
|
||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; | ||
use Sensio\Bundle\GeneratorBundle\Tests\Manipulator\Stubs\StubBundle; | ||
|
||
class ContainsExtraCodeShortArraySyntaxKernelStub extends KernelForTest | ||
{ | ||
public function registerBundles() | ||
{ | ||
$someVariable = false; | ||
|
||
// some bad formatted definition | ||
$bundles = [ | ||
new StubBundle(), | ||
|
||
new StubBundle(), | ||
|
||
]; | ||
|
||
if (!$someVariable && in_array($this->getEnvironment(), array('dev', 'test'))) { | ||
$bundles[] = new StubBundle(); | ||
} | ||
|
||
return $bundles; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Tests/Manipulator/Stubs/EmptyBundlesMultilineShortArraySyntaxKernelStub.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KernelManipulatorTest\Stubs; | ||
|
||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; | ||
|
||
class EmptyBundlesMultilineShortArraySyntaxKernelStub extends KernelForTest | ||
{ | ||
public function registerBundles() | ||
{ | ||
$bundles = [ | ||
|
||
]; | ||
|
||
return $bundles; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Tests/Manipulator/Stubs/EmptyBundlesShortArraySyntaxKernelStub.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KernelManipulatorTest\Stubs; | ||
|
||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; | ||
|
||
class EmptyBundlesShortArraySyntaxKernelStub extends KernelForTest | ||
{ | ||
public function registerBundles() | ||
{ | ||
$bundles = []; | ||
|
||
return $bundles; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
Tests/Manipulator/Stubs/UsingShortArraySyntaxKernelStub.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KernelManipulatorTest\Stubs; | ||
|
||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; | ||
use Sensio\Bundle\GeneratorBundle\Tests\Manipulator\Stubs\StubBundle; | ||
|
||
class UsingShortArraySyntaxKernelStub extends KernelForTest | ||
{ | ||
public function registerBundles() | ||
{ | ||
// short array syntax | ||
$bundles = [ | ||
new StubBundle(), | ||
new StubBundle(), | ||
]; | ||
|
||
if (!$someVariable && in_array($this->getEnvironment(), array('dev', 'test'))) { | ||
$bundles[] = new StubBundle(); | ||
} | ||
|
||
return $bundles; | ||
} | ||
} |