Skip to content

Commit

Permalink
Fixes #1767 - add a passthru attribute so PHPStan can print errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mrook committed Feb 21, 2024
1 parent 52866d6 commit b882493
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions etc/phing-grammar.rng
Original file line number Diff line number Diff line change
Expand Up @@ -5644,6 +5644,11 @@
<optional>
<attribute name="executable"/>
</optional>
<optional>
<attribute name="passthru" a:defaultValue="false">
<data type="boolean"/>
</attribute>
</optional>
<optional>
<attribute name="checkReturn">
<data type="boolean"/>
Expand Down
16 changes: 16 additions & 0 deletions src/Phing/Task/Ext/Analyzer/Phpstan/PHPStanTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ class PHPStanTask extends Task
*/
private $checkreturn;

/**
* @var bool
*/
private $passthru = false;

/**
* @var bool
*/
Expand Down Expand Up @@ -223,6 +228,11 @@ public function isCheckreturn(): ?bool
return $this->checkreturn;
}

public function isPassthru(): ?bool
{
return $this->passthru;
}

public function isDebug(): ?bool
{
return $this->debug;
Expand Down Expand Up @@ -333,6 +343,11 @@ public function setCheckreturn(bool $checkreturn)
$this->checkreturn = $checkreturn;
}

public function setPassthru(bool $passthru)
{
$this->passthru = $passthru;
}

public function setDebug(bool $debug): void
{
$this->debug = $debug;
Expand Down Expand Up @@ -391,6 +406,7 @@ public function main()
$exe->setExecutable($toExecute->getExecutable());
$exe->createArg()->setLine(implode(' ', $toExecute->getArguments()));
$exe->setCheckreturn($this->checkreturn);
$exe->setPassthru($this->passthru);
$exe->setLocation($this->getLocation());
$exe->setProject($this->getProject());
$exe->setLevel('info');
Expand Down
2 changes: 1 addition & 1 deletion src/Phing/Task/System/ExecTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function setError(File $f): void
*
* @param bool $passthru If passthru shall be used
*/
public function setPassthru($passthru): void
public function setPassthru(bool $passthru): void
{
$this->passthru = $passthru;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private function assertCommonDefaults(PHPStanTask $task): void
$this->assertNull($task->isNoInteraction());
$this->assertNull($task->isVerbose());
$this->assertNull($task->isCheckreturn());
$this->assertFalse($task->isPassthru());
}

private function assertAnalyseDefaults(PHPStanTask $task): void
Expand Down

0 comments on commit b882493

Please sign in to comment.