Skip to content

Commit fd4a86d

Browse files
Merge branch '4.4' into 5.0
* 4.4: Add missing symfony/mime to require-dev [Validator] Added the missing Mongolian translations [ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable() refactor(Process): fromShellCommandLine [Mailer] Do not ping the SMTP server before sending every message
2 parents 24fc16e + bf9166b commit fd4a86d

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

PhpProcess.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Process;
1313

14+
use Symfony\Component\Process\Exception\LogicException;
1415
use Symfony\Component\Process\Exception\RuntimeException;
1516

1617
/**
@@ -49,6 +50,14 @@ public function __construct(string $script, string $cwd = null, array $env = nul
4950
parent::__construct($php, $cwd, $env, $script, $timeout);
5051
}
5152

53+
/**
54+
* {@inheritdoc}
55+
*/
56+
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
57+
{
58+
throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
59+
}
60+
5261
/**
5362
* {@inheritdoc}
5463
*/

Tests/PhpProcessTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Process\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Process\Exception\LogicException;
1516
use Symfony\Component\Process\PhpExecutableFinder;
1617
use Symfony\Component\Process\PhpProcess;
1718

@@ -60,4 +61,14 @@ public function testPassingPhpExplicitly()
6061
$process->run();
6162
$this->assertEquals($expected, $process->getOutput());
6263
}
64+
65+
public function testProcessCannotBeCreatedUsingFromShellCommandLine()
66+
{
67+
static::expectException(LogicException::class);
68+
static::expectExceptionMessage('The "Symfony\Component\Process\PhpProcess::fromShellCommandline()" method cannot be called when using "Symfony\Component\Process\PhpProcess".');
69+
PhpProcess::fromShellCommandline(<<<PHP
70+
<?php echo 'Hello World!';
71+
PHP
72+
);
73+
}
6374
}

0 commit comments

Comments
 (0)