Skip to content

Commit a4edcc0

Browse files
authored
Merge pull request #169 from XcoreCMS/master
syntax was updated to PHP 5.6 (::class string, short array syntax etc.)
2 parents 0f8fb61 + 38aadeb commit a4edcc0

File tree

64 files changed

+1271
-866
lines changed

Some content is hidden

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

64 files changed

+1271
-866
lines changed

.styleci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
preset: psr2
22

33
enabled:
4-
- long_array_syntax
4+
- short_array_syntax
55
- duplicate_semicolon

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ before_script:
2121
- if [[ "$PACKAGE_VERSION" == "high" ]]; then composer update --prefer-source; fi
2222
- if [[ "$PACKAGE_VERSION" == "low" ]]; then composer update --prefer-lowest --prefer-source; fi
2323

24-
script: phpunit -c tests/phpunit.xml.dist
24+
script: php vendor/bin/phpunit -c tests/phpunit.xml.dist
2525

2626
notifications:
2727
irc: "irc.freenode.org#jackalope"

bin/phpcr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use Symfony\Component\Console\Application;
55
use Symfony\Component\Console\Helper\HelperSet;
66
use PHPCR\Util\Console\Command;
77

8-
if (!class_exists('\Symfony\Component\Console\Application')) {
8+
if (!class_exists(Application::class)) {
99
if (is_file(__DIR__.'/../vendor/autoload.php')) {
1010
require __DIR__.'/../vendor/autoload.php';
1111
} elseif (is_file(__DIR__.'/../../../autoload.php')) {
@@ -30,7 +30,7 @@ if (file_exists($configFile)) {
3030
require $configFile;
3131

3232
foreach ($GLOBALS as $helperSetCandidate) {
33-
if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
33+
if ($helperSetCandidate instanceof HelperSet) {
3434
$helperSet = $helperSetCandidate;
3535
break;
3636
}
@@ -48,7 +48,7 @@ $cli = new Application('PHPCR Command Line Interface', '0.1');
4848
$cli->setCatchExceptions(true);
4949
$cli->setHelperSet($helperSet);
5050

51-
$cli->addCommands(array(
51+
$cli->addCommands([
5252
new Command\NodeDumpCommand(),
5353
new Command\NodeMoveCommand(),
5454
new Command\NodeRemoveCommand(),
@@ -62,7 +62,7 @@ $cli->addCommands(array(
6262
new Command\WorkspaceImportCommand(),
6363
new Command\WorkspacePurgeCommand(),
6464
new Command\WorkspaceQueryCommand(),
65-
));
65+
]);
6666

6767
$cli->run();
6868

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"symfony/console": "~2.3|~3.0"
3333
},
3434
"require-dev": {
35-
"ramsey/uuid": "^3.5"
35+
"ramsey/uuid": "^3.5",
36+
"phpunit/phpunit": "^5.7"
3637
},
3738
"suggest": {
3839
"ramsey/uuid": "A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID)."

src/PHPCR/Util/Console/Command/BaseNodeManipulationCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,22 @@ protected function configureNodeManipulationInput()
2121
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
2222
'Set node property on nodes use foo=bar'
2323
);
24+
2425
$this->addOption('remove-prop', 'r',
2526
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
2627
'Remove property from nodes'
2728
);
29+
2830
$this->addOption('add-mixin', null,
2931
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
3032
'Add a mixin to the nodes'
3133
);
34+
3235
$this->addOption('remove-mixin', null,
3336
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
3437
'Remove mixin from the nodes'
3538
);
39+
3640
$this->addOption('apply-closure', null,
3741
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
3842
'Apply a closure to each node, closures are passed PHPCR\Session and PHPCR\NodeInterface'

src/PHPCR/Util/Console/Command/NodeDumpCommand.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
namespace PHPCR\Util\Console\Command;
44

5+
use Exception;
56
use PHPCR\ItemNotFoundException;
67
use PHPCR\RepositoryException;
78
use PHPCR\PathNotFoundException;
89
use PHPCR\Util\UUIDHelper;
10+
use Symfony\Component\Console\Exception\InvalidArgumentException;
911
use Symfony\Component\Console\Input\InputArgument;
1012
use Symfony\Component\Console\Input\InputOption;
1113
use Symfony\Component\Console\Input\InputInterface;
@@ -24,6 +26,8 @@ class NodeDumpCommand extends BaseCommand
2426
{
2527
/**
2628
* {@inheritDoc}
29+
*
30+
* @throws InvalidArgumentException
2731
*/
2832
protected function configure()
2933
{
@@ -54,6 +58,10 @@ protected function configure()
5458

5559
/**
5660
* {@inheritDoc}
61+
*
62+
* @throws InvalidArgumentException
63+
* @throws Exception
64+
* @throws RepositoryException
5765
*/
5866
protected function execute(InputInterface $input, OutputInterface $output)
5967
{
@@ -72,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7280
$options['max_line_length'] = $input->getOption('max_line_length');
7381

7482
if (null !== $options['ref_format'] && !in_array($options['ref_format'], array('uuid', 'path'))) {
75-
throw new \Exception('The ref-format option must be set to either "path" or "uuid"');
83+
throw new Exception('The ref-format option must be set to either "path" or "uuid"');
7684
}
7785

7886
$walker = $dumperHelper->getTreeWalker($output, $options);

src/PHPCR/Util/Console/Command/NodeMoveCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PHPCR\Util\Console\Command;
44

55
use Symfony\Component\Console\Command\Command;
6+
use Symfony\Component\Console\Exception\InvalidArgumentException;
67
use Symfony\Component\Console\Input\InputArgument;
78
use Symfony\Component\Console\Input\InputInterface;
89
use Symfony\Component\Console\Output\OutputInterface;
@@ -19,6 +20,8 @@ class NodeMoveCommand extends BaseCommand
1920
{
2021
/**
2122
* {@inheritDoc}
23+
*
24+
* @throws InvalidArgumentException
2225
*/
2326
protected function configure()
2427
{
@@ -42,6 +45,8 @@ protected function configure()
4245

4346
/**
4447
* {@inheritDoc}
48+
*
49+
* @throws InvalidArgumentException
4550
*/
4651
protected function execute(InputInterface $input, OutputInterface $output)
4752
{

src/PHPCR/Util/Console/Command/NodeRemoveCommand.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace PHPCR\Util\Console\Command;
44

5+
use InvalidArgumentException;
56
use PHPCR\NodeInterface;
7+
use Symfony\Component\Console\Exception\InvalidArgumentException as CliInvalidArgumentException;
68
use Symfony\Component\Console\Input\InputArgument;
79
use Symfony\Component\Console\Input\InputOption;
810
use Symfony\Component\Console\Input\InputInterface;
@@ -22,6 +24,8 @@ class NodeRemoveCommand extends BaseCommand
2224
{
2325
/**
2426
* {@inheritDoc}
27+
*
28+
* @throws CliInvalidArgumentException
2529
*/
2630
protected function configure()
2731
{
@@ -51,6 +55,9 @@ protected function configure()
5155

5256
/**
5357
* {@inheritDoc}
58+
*
59+
* @throws CliInvalidArgumentException
60+
* @throws InvalidArgumentException
5461
*/
5562
protected function execute(InputInterface $input, OutputInterface $output)
5663
{
@@ -63,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6370
if ('/' === $path) {
6471
// even if we have only children, this will not work as we would
6572
// try to remove system nodes.
66-
throw new \InvalidArgumentException(
73+
throw new InvalidArgumentException(
6774
'Can not delete root node (path "/"), please use the '.
6875
'workspace:purge command instead to purge the whole workspace.'
6976
);

src/PHPCR/Util/Console/Command/NodeTouchCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PHPCR\Util\Console\Command;
44

55
use Symfony\Component\Console\Command\Command;
6+
use Symfony\Component\Console\Exception\InvalidArgumentException;
67
use Symfony\Component\Console\Input\InputOption;
78
use Symfony\Component\Console\Input\InputArgument;
89
use Symfony\Component\Console\Input\InputInterface;
@@ -23,6 +24,8 @@ class NodeTouchCommand extends BaseNodeManipulationCommand
2324
{
2425
/**
2526
* {@inheritDoc}
27+
*
28+
* @throws InvalidArgumentException
2629
*/
2730
protected function configure()
2831
{
@@ -68,6 +71,8 @@ protected function configure()
6871

6972
/**
7073
* {@inheritDoc}
74+
*
75+
* @throws InvalidArgumentException
7176
*/
7277
protected function execute(InputInterface $input, OutputInterface $output)
7378
{

src/PHPCR/Util/Console/Command/NodeTypeListCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PHPCR\Util\Console\Command;
44

55
use Symfony\Component\Console\Command\Command;
6+
use Symfony\Component\Console\Exception\InvalidArgumentException;
67
use Symfony\Component\Console\Input\InputInterface;
78
use Symfony\Component\Console\Output\OutputInterface;
89

0 commit comments

Comments
 (0)