Skip to content

Commit

Permalink
enablePhpLinter()
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Aug 8, 2023
1 parent fce5f6f commit 7e68cf2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/Latte/Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,7 @@ public function getLoader(): Loader
}


/**
* Enables linting of generated PHP templates.
*/
public function setPhpBinary(?string $phpBinary): static
public function enablePhpLinter(?string $phpBinary): static
{
$this->phpBinary = $phpBinary;
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/Tools/Linter.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function scanDirectory(string $path): bool
private function createEngine(): Latte\Engine
{
$engine = new Latte\Engine;
$engine->setPhpBinary(PHP_BINARY);
$engine->enablePhpLinter(PHP_BINARY);
$engine->addExtension(new Latte\Essential\TranslatorExtension(null));

if (class_exists(Nette\Bridges\ApplicationLatte\UIExtension::class)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/common/linter.error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require __DIR__ . '/../bootstrap.php';

$latte = new Latte\Engine;
$latte->setLoader(new Latte\Loaders\StringLoader);
$latte->setPhpBinary(PHP_BINARY);
$latte->enablePhpLinter(PHP_BINARY);

Assert::exception(
fn() => $latte->compile('{= [&$x] = []}'),
Expand Down

0 comments on commit 7e68cf2

Please sign in to comment.