Skip to content

Commit 6bf5a7c

Browse files
committed
adjust to symfony BC break
1 parent e7c2f73 commit 6bf5a7c

File tree

9 files changed

+21
-30
lines changed

9 files changed

+21
-30
lines changed

Diff for: src/PHPCR/Shell/Console/Application/ShellApplication.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Symfony\Component\Console\Application;
2424
use Symfony\Component\Console\Command\Command;
2525
use Symfony\Component\Console\Formatter\OutputFormatter;
26+
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
2627
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
2728
use Symfony\Component\Console\Input\ArrayInput;
2829
use Symfony\Component\Console\Input\InputInterface;
@@ -201,7 +202,7 @@ protected function registerShellCommands()
201202
/**
202203
* Configure the output formatter.
203204
*/
204-
private function configureFormatter(OutputFormatter $formatter)
205+
private function configureFormatter(OutputFormatterInterface $formatter)
205206
{
206207
$style = new OutputFormatterStyle('yellow', null, ['bold']);
207208
$formatter->setStyle('pathbold', $style);
@@ -234,10 +235,7 @@ private function configureFormatter(OutputFormatter $formatter)
234235
$formatter->setStyle('exception', $style);
235236
}
236237

237-
/**
238-
* {@inheritdoc}
239-
*/
240-
public function doRun(InputInterface $input, OutputInterface $output)
238+
public function doRun(InputInterface $input, OutputInterface $output): int
241239
{
242240
$this->init();
243241

@@ -279,7 +277,7 @@ protected function getDefaultCommand()
279277
*
280278
* {@inheritdoc}
281279
*/
282-
public function add(Command $command)
280+
public function add(Command $command): ?Command
283281
{
284282
if ($command instanceof ContainerAwareInterface) {
285283
$command->setContainer($this->container);
@@ -307,7 +305,7 @@ public function dispatchProfileInitEvent(InputInterface $sessionInput, OutputInt
307305
*
308306
* {@inheritdoc}
309307
*/
310-
public function all($namespace = null)
308+
public function all($namespace = null): array
311309
{
312310
$this->init();
313311

Diff for: src/PHPCR/Shell/Console/Helper/EditorHelper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function fromStringWithMessage($string, $message, $messagePrefix = '# ',
8585

8686
$line = current($res);
8787

88-
while (0 === strpos($line, $messagePrefix)) {
88+
while (str_starts_with($line, $messagePrefix)) {
8989
$line = next($res);
9090
}
9191

@@ -99,7 +99,7 @@ public function fromStringWithMessage($string, $message, $messagePrefix = '# ',
9999
return implode("\n", $out);
100100
}
101101

102-
public function getName()
102+
public function getName(): string
103103
{
104104
return 'editor';
105105
}

Diff for: src/PHPCR/Shell/Console/Helper/NodeHelper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function assertNodeIsVersionable(NodeInterface $node)
4545
}
4646
}
4747

48-
public function getName()
48+
public function getName(): string
4949
{
5050
return 'node';
5151
}

Diff for: src/PHPCR/Shell/Console/Helper/PathHelper.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ public function getNodeName($path)
3838
return StaticPathHelper::getNodeName($path);
3939
}
4040

41-
/**
42-
* {@inheritdoc}
43-
*/
44-
public function getName()
41+
public function getName(): string
4542
{
4643
return 'path';
4744
}

Diff for: src/PHPCR/Shell/Console/Helper/RepositoryHelper.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
namespace PHPCR\Shell\Console\Helper;
1414

1515
use PHPCR\Shell\Phpcr\SessionManager;
16+
use PHPCR\Util\Console\Helper\PhpcrHelper;
1617
use Symfony\Component\Console\Helper\Helper;
1718

1819
class RepositoryHelper extends Helper
@@ -80,7 +81,7 @@ private function loadDescriptors()
8081
}
8182
}
8283

83-
public function getName()
84+
public function getName(): string
8485
{
8586
return 'repository';
8687
}

Diff for: src/PHPCR/Shell/Console/Helper/ResultFormatterHelper.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ public function __construct(TextHelper $textHelper, Config $config)
3636
$this->config = $config;
3737
}
3838

39-
/**
40-
* {@inheritdoc}
41-
*/
42-
public function getName()
39+
public function getName(): string
4340
{
4441
return 'result_formatter';
4542
}

Diff for: src/PHPCR/Shell/Console/Helper/TextHelper.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TextHelper extends Helper
3131
/**
3232
* {@inheritdoc}
3333
*/
34-
public function getName()
34+
public function getName(): string
3535
{
3636
return 'text';
3737
}
@@ -43,17 +43,15 @@ public function getName()
4343
* @param int $length Truncate to this length
4444
* @param string $alignment Align to the "left" or the "right"
4545
* @param string $delimString String to use to use to indicate the truncation
46-
*
47-
* @return string
4846
*/
49-
public function truncate($string, $length = null, $alignment = null, $delimString = null)
47+
public function truncate($string, $length = null, $alignment = null, $delimString = null): string
5048
{
5149
if (null === $length) {
5250
$length = $this->truncateLength;
5351
}
5452

55-
$alignment = $alignment === null ? 'left' : $alignment;
56-
$delimString = $delimString === null ? '...' : $delimString;
53+
$alignment = $alignment ?? 'left';
54+
$delimString = $delimString ?? '...';
5755
$delimLen = strlen($delimString);
5856

5957
if (!in_array($alignment, ['left', 'right'])) {

Diff for: src/PHPCR/Shell/Console/Input/StringInput.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ public function __construct($command)
3333
{
3434
$this->rawCommand = trim($command);
3535

36-
if (strpos(strtolower($this->rawCommand), 'select') === 0) {
36+
if (stripos($this->rawCommand, 'select') === 0) {
3737
$command = 'select'.substr($command, 6);
3838
$this->isQuery = true;
3939
}
4040

41-
if (strpos(strtolower($this->rawCommand), 'update') === 0) {
41+
if (stripos($this->rawCommand, 'update') === 0) {
4242
$command = 'update'.substr($command, 6);
4343
$this->isQuery = true;
4444
}
4545

46-
if (strpos(strtolower($this->rawCommand), 'delete') === 0) {
46+
if (stripos($this->rawCommand, 'delete') === 0) {
4747
$command = 'delete'.substr($command, 6);
4848
$this->isQuery = true;
4949
}

Diff for: src/PHPCR/Shell/Test/ContextBase.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,12 @@ public function iShouldSeeATableContainingTheFollowingRows(TableNode $table)
189189
continue;
190190
}
191191

192-
if (false !== strpos($line, $cell)) {
192+
if (str_contains($line, $cell)) {
193193
$foundCells++;
194194
}
195195
}
196196

197-
if ($foundCells == count($row)) {
197+
if ($foundCells === count($row)) {
198198
$foundRows++;
199199
}
200200
}

0 commit comments

Comments
 (0)