Skip to content

Commit ea7f0a6

Browse files
authored
Merge pull request #184 from phpcr/apply_style_ci
Added style CI
2 parents eef69ff + f6ea1e6 commit ea7f0a6

File tree

163 files changed

+1163
-1017
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+1163
-1017
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Shell for PHPCR
22
---------------
33

44
[![Build Status](https://travis-ci.org/phpcr/phpcr-shell.png?branch=master)](https://travis-ci.org/phpcr/phpcr-shell)
5+
[![StyleCI](https://styleci.io/repos/14844492/shield)](https://styleci.io/repos/14844492)
56

67
Shell for PHPCR
78

features/fixtures/jackalope-doctrine-dbal-cli-config.php

+25-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
<?php
2-
$dbConn = \Doctrine\DBAL\DriverManager::getConnection(array(
2+
3+
/*
4+
* This file is part of the PHPCR Shell package
5+
*
6+
* (c) Daniel Leech <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
*/
12+
13+
$dbConn = \Doctrine\DBAL\DriverManager::getConnection([
314
'driver' => 'pdo_sqlite',
415
'dbname' => 'test',
516
'path' => __DIR__.'/app.sqlite',
6-
));
17+
]);
718

819
/*
920
* configuration
1021
*/
11-
$workspace = 'default'; // phpcr workspace to use
12-
$user = 'admin';
13-
$pass = 'admin';
22+
$workspace = 'default'; // phpcr workspace to use
23+
$user = 'admin';
24+
$pass = 'admin';
1425

1526
$factory = new \Jackalope\RepositoryFactoryDoctrineDBAL();
16-
$repository = $factory->getRepository(array('jackalope.doctrine_dbal_connection' => $dbConn));
27+
$repository = $factory->getRepository(['jackalope.doctrine_dbal_connection' => $dbConn]);
1728

1829
$credentials = new \PHPCR\SimpleCredentials($user, $pass);
1930

@@ -25,15 +36,14 @@
2536
) {
2637
$session = $repository->login($credentials, $workspace);
2738

28-
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
29-
'dialog' => new \Symfony\Component\Console\Helper\DialogHelper(),
30-
'phpcr' => new \PHPCR\Util\Console\Helper\PhpcrHelper($session),
39+
$helperSet = new \Symfony\Component\Console\Helper\HelperSet([
40+
'dialog' => new \Symfony\Component\Console\Helper\DialogHelper(),
41+
'phpcr' => new \PHPCR\Util\Console\Helper\PhpcrHelper($session),
3142
'phpcr_console_dumper' => new \PHPCR\Util\Console\Helper\PhpcrConsoleDumperHelper(),
32-
));
33-
} else if (isset($argv[1]) && $argv[1] == 'jackalope:init:dbal') {
43+
]);
44+
} elseif (isset($argv[1]) && $argv[1] == 'jackalope:init:dbal') {
3445
// special case: the init command needs the db connection, but a session is impossible if the db is not yet initialized
35-
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
36-
'connection' => new \Jackalope\Tools\Console\Helper\DoctrineDbalHelper($dbConn)
37-
));
46+
$helperSet = new \Symfony\Component\Console\Helper\HelperSet([
47+
'connection' => new \Jackalope\Tools\Console\Helper\DoctrineDbalHelper($dbConn),
48+
]);
3849
}
39-

spec/PHPCR/Shell/Config/ConfigManagerSpec.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
10+
*
1011
*/
1112

1213
namespace spec\PHPCR\Shell\Config;
@@ -19,8 +20,7 @@ class ConfigManagerSpec extends ObjectBehavior
1920
{
2021
public function let(
2122
Filesystem $filesystem
22-
)
23-
{
23+
) {
2424
$this->beConstructedWith($filesystem);
2525
}
2626

@@ -37,10 +37,9 @@ public function it_should_have_a_method_to_get_the_users_config_directory()
3737

3838
public function it_should_be_able_to_parse_a_config_file_and_return_the_config_as_an_array(
3939
Filesystem $filesystem
40-
)
41-
{
42-
$dir = __DIR__ . '/fixtures/config';
43-
putenv('PHPCRSH_HOME=' . $dir);
40+
) {
41+
$dir = __DIR__.'/fixtures/config';
42+
putenv('PHPCRSH_HOME='.$dir);
4443
$filesystem->exists(Argument::any())->willReturn(true);
4544

4645
$this->getConfig('alias')->offsetGet('foobar')->shouldReturn('barfoo');

spec/PHPCR/Shell/Config/ConfigSpec.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,36 @@
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
10+
*
1011
*/
1112

1213
namespace spec\PHPCR\Shell\Config;
1314

1415
use PhpSpec\ObjectBehavior;
15-
use Prophecy\Argument;
1616

1717
class ConfigSpec extends ObjectBehavior
1818
{
19-
function it_is_initializable()
19+
public function it_is_initializable()
2020
{
2121
$this->shouldHaveType('PHPCR\Shell\Config\Config');
2222
}
2323

24-
function let()
24+
public function let()
2525
{
26-
$this->beConstructedWith(array(
26+
$this->beConstructedWith([
2727
'foo' => 'bar',
28-
'bar' => array(
29-
'boo' => 'baz'
30-
),
31-
));
28+
'bar' => [
29+
'boo' => 'baz',
30+
],
31+
]);
3232
}
3333

34-
function it_should_be_able_to_access_data_values()
34+
public function it_should_be_able_to_access_data_values()
3535
{
3636
$this['foo']->shouldReturn('bar');
3737
}
3838

39-
function it_should_be_able_to_access_nested_config()
39+
public function it_should_be_able_to_access_nested_config()
4040
{
4141
$this['bar']['boo']->shouldReturn('baz');
4242
}

spec/PHPCR/Shell/Config/ProfileLoaderSpec.php

+24-26
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
10+
*
1011
*/
1112

1213
namespace spec\PHPCR\Shell\Config;
1314

14-
use PhpSpec\ObjectBehavior;
15-
use Prophecy\Argument;
1615
use PHPCR\Shell\Config\ConfigManager;
1716
use PHPCR\Shell\Config\Profile;
17+
use PhpSpec\ObjectBehavior;
18+
use Prophecy\Argument;
1819
use Symfony\Component\Filesystem\Filesystem;
1920

2021
class ProfileLoaderSpec extends ObjectBehavior
2122
{
2223
public function let(
2324
ConfigManager $configManager,
2425
Filesystem $filesystem
25-
)
26-
{
26+
) {
2727
$configManager->getConfigDir()->willReturn(__DIR__);
2828
$this->beConstructedWith($configManager, $filesystem);
2929
}
@@ -35,49 +35,47 @@ public function it_is_initializable()
3535

3636
public function it_should_list_profile_names()
3737
{
38-
$this->getProfileNames()->shouldReturn(array(
39-
'one', 'two'
40-
));
38+
$this->getProfileNames()->shouldReturn([
39+
'one', 'two',
40+
]);
4141
}
4242

4343
public function it_should_load_data_into_a_given_profile(
4444
Profile $profile,
4545
Filesystem $filesystem
46-
)
47-
{
46+
) {
4847
$profile->get('phpcr', 'workspace')->willReturn('default');
4948
$profile->getName()->willReturn('one');
50-
$profile->set('transport', array(
51-
'name' => 'foobar',
49+
$profile->set('transport', [
50+
'name' => 'foobar',
5251
'bar_foo' => 'barfoo',
5352
'foo_bar' => 'foobar',
54-
))->shouldBeCalled();
55-
$profile->set('phpcr', array(
56-
'username' => 'username',
57-
'password' => 'password',
53+
])->shouldBeCalled();
54+
$profile->set('phpcr', [
55+
'username' => 'username',
56+
'password' => 'password',
5857
'workspace' => 'default',
59-
))->shouldBeCalled();
58+
])->shouldBeCalled();
6059

6160
$this->loadProfile($profile);
6261
}
6362

6463
public function it_should_save_a_given_profile(
6564
Profile $profile,
6665
Filesystem $filesystem
67-
)
68-
{
66+
) {
6967
$profile->getName()->willReturn('newprofile');
70-
$profile->toArray()->willReturn(array(
71-
'transport' => array(
72-
'name' => 'test_transport',
68+
$profile->toArray()->willReturn([
69+
'transport' => [
70+
'name' => 'test_transport',
7371
'option1' => 'value1',
74-
),
75-
'phpcr' => array(
72+
],
73+
'phpcr' => [
7674
'username' => 'daniel',
7775
'password' => 'leech',
78-
),
79-
));
80-
$filesystem->dumpFile(Argument::type('string'), <<<EOT
76+
],
77+
]);
78+
$filesystem->dumpFile(Argument::type('string'), <<<'EOT'
8179
transport:
8280
name: test_transport
8381
option1: value1

spec/PHPCR/Shell/Config/ProfileSpec.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
10+
*
1011
*/
1112

1213
namespace spec\PHPCR\Shell\Config;
1314

1415
use PhpSpec\ObjectBehavior;
15-
use PHPCR\Shell\Config\Config;
1616

1717
class ProfileSpec extends ObjectBehavior
1818
{
@@ -29,16 +29,15 @@ public function it_is_initializable()
2929
}
3030

3131
public function it_has_a_method_to_set_config(
32-
)
33-
{
34-
$this->set('transport', array());
32+
) {
33+
$this->set('transport', []);
3534
}
3635

3736
public function it_has_a_method_to_get_config()
3837
{
39-
$this->set('transport', array(
40-
'foo' => 'bar'
41-
));
38+
$this->set('transport', [
39+
'foo' => 'bar',
40+
]);
4241

4342
$this->get('transport')->shouldHaveType('PHPCR\Shell\Config\Config');
4443

spec/PHPCR/Shell/Console/Application/EmbeddedApplicationSpec.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,19 @@
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
10+
*
1011
*/
1112

1213
namespace spec\PHPCR\Shell\Console\Application;
1314

14-
use PhpSpec\ObjectBehavior;
15-
use PHPCR\Shell\Console\Application\EmbeddedApplication;
16-
use Symfony\Component\DependencyInjection\ContainerInterface;
17-
use PHPCR\Shell\PhpcrShell;
1815
use PHPCR\Shell\DependencyInjection\Container;
16+
use PhpSpec\ObjectBehavior;
1917

2018
class EmbeddedApplicationSpec extends ObjectBehavior
2119
{
2220
public function let(
2321
Container $container
24-
)
25-
{
22+
) {
2623
$this->beConstructedWith($container);
2724
}
2825

spec/PHPCR/Shell/Console/Application/ShellApplicationSpec.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
10+
*
1011
*/
1112

1213
namespace spec\PHPCR\Shell\Console\Application;
1314

15+
use PHPCR\Shell\PhpcrShell;
1416
use PhpSpec\ObjectBehavior;
1517
use Symfony\Component\DependencyInjection\ContainerInterface;
16-
use PHPCR\Shell\Console\Application\EmbeddedApplication;
17-
use PHPCR\Shell\PhpcrShell;
1818

1919
class ShellApplicationSpec extends ObjectBehavior
2020
{
2121
public function let(
2222
ContainerInterface $container
23-
)
24-
{
23+
) {
2524
$this->beConstructedWith($container, PhpcrShell::MODE_EMBEDDED_COMMAND);
2625
}
2726

spec/PHPCR/Shell/Console/Helper/EditorHelperSpec.php

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
10+
*
1011
*/
1112

1213
namespace spec\PHPCR\Shell\Console\Helper;

spec/PHPCR/Shell/Console/Helper/NodeHelperSpec.php

+14-15
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
10+
*
1011
*/
1112

1213
namespace spec\PHPCR\Shell\Console\Helper;
1314

14-
use PhpSpec\ObjectBehavior;
1515
use PHPCR\NodeInterface;
1616
use PHPCR\NodeType\NodeTypeInterface;
17+
use PhpSpec\ObjectBehavior;
1718

1819
class NodeHelperSpec extends ObjectBehavior
1920
{
@@ -27,11 +28,10 @@ public function it_should_provide_a_method_to_determine_if_a_node_has_a_given_mi
2728
NodeTypeInterface $mixin1,
2829
NodeTypeInterface $mixin2,
2930
NodeTypeInterface $mixin3
30-
)
31-
{
32-
$node->getMixinNodeTypes()->willReturn(array(
33-
$mixin1, $mixin2, $mixin3
34-
));
31+
) {
32+
$node->getMixinNodeTypes()->willReturn([
33+
$mixin1, $mixin2, $mixin3,
34+
]);
3535

3636
$mixin1->getName()->willReturn('mixin1');
3737
$mixin2->getName()->willReturn('mixin1');
@@ -46,17 +46,16 @@ public function it_should_provide_a_method_to_determine_if_a_node_is_versionable
4646
NodeInterface $nodeNotVersionable,
4747
NodeTypeInterface $mixin1,
4848
NodeTypeInterface $mixin2
49-
)
50-
{
51-
$nodeVersionable->getMixinNodeTypes()->willReturn(array(
52-
$mixin1, $mixin2
53-
));
54-
$nodeNotVersionable->getMixinNodeTypes()->willReturn(array(
55-
$mixin2
56-
));
49+
) {
50+
$nodeVersionable->getMixinNodeTypes()->willReturn([
51+
$mixin1, $mixin2,
52+
]);
53+
$nodeNotVersionable->getMixinNodeTypes()->willReturn([
54+
$mixin2,
55+
]);
5756
$nodeNotVersionable->getPath()->willReturn('foobar');
5857
$mixin1->getName()->willReturn('mix:versionable');
59-
$this->assertNodeIsVersionable($nodeVersionable)->shouldReturn(null);;
58+
$this->assertNodeIsVersionable($nodeVersionable)->shouldReturn(null);
6059

6160
try {
6261
$this->assertNodeIsVersionable($nodeNotVersionable);

0 commit comments

Comments
 (0)