Skip to content

Commit

Permalink
ORM Extension: Use native CLI mode detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek committed Mar 2, 2022
1 parent f187e23 commit 3d7bfd5
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/Orm/DI/OrmConsoleExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@

final class OrmConsoleExtension extends CompilerExtension
{
private bool $cliMode;


public function __construct(?bool $cliMode = null)
{
$this->cliMode = $cliMode ?? PHP_SAPI === 'cli';
}


/**
* @return string[]
*/
Expand Down Expand Up @@ -75,7 +66,7 @@ public function loadConfiguration(): void
->setAutowired(true)
->setArgument('cacheDir', $cacheDir);

if ($this->cliMode === false) {
if (PHP_SAPI !== 'cli') {
return;
}

Expand Down Expand Up @@ -150,8 +141,7 @@ public function loadConfiguration(): void
*/
public function beforeCompile(): void
{
// Skip if it's not CLI mode
if (!$this->cliMode) {
if (PHP_SAPI !== 'cli') { // Skip if it's not CLI mode
return;
}

Expand Down

0 comments on commit 3d7bfd5

Please sign in to comment.