-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from alexpott/symfony-console-6-and-psr-log-3
Allow symfony console 6 and psr log 3
- Loading branch information
Showing
16 changed files
with
238 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace DrupalCodeGenerator\Compatibility; | ||
|
||
if (\PHP_VERSION_ID >= 80000) { | ||
\class_alias( | ||
'\DrupalCodeGenerator\Compatibility\Php8\AskQuestionTrait', | ||
'\DrupalCodeGenerator\Compatibility\AskQuestionTrait' | ||
); | ||
} | ||
else { | ||
\class_alias( | ||
'\DrupalCodeGenerator\Compatibility\Php7\AskQuestionTrait', | ||
'\DrupalCodeGenerator\Compatibility\AskQuestionTrait' | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* @file | ||
* Compatibility shim. | ||
*/ | ||
|
||
namespace DrupalCodeGenerator\Compatibility; | ||
|
||
if (\PHP_VERSION_ID >= 80000) { | ||
\class_alias( | ||
'\DrupalCodeGenerator\Compatibility\Php8\AskTrait', | ||
'\DrupalCodeGenerator\Compatibility\AskTrait' | ||
); | ||
} | ||
else { | ||
\class_alias( | ||
'\DrupalCodeGenerator\Compatibility\Php7\AskTrait', | ||
'\DrupalCodeGenerator\Compatibility\AskTrait' | ||
); | ||
} |
21 changes: 21 additions & 0 deletions
21
src/Compatibility/GeneratorStyleCompatibilityInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* @file | ||
* Compatibility shim. | ||
*/ | ||
|
||
namespace DrupalCodeGenerator\Compatibility; | ||
|
||
if (\PHP_VERSION_ID >= 80000) { | ||
\class_alias( | ||
'\DrupalCodeGenerator\Compatibility\Php8\GeneratorStyleInterface', | ||
'\DrupalCodeGenerator\Compatibility\GeneratorStyleCompatibilityInterface' | ||
); | ||
} | ||
else { | ||
\class_alias( | ||
'\DrupalCodeGenerator\Compatibility\Php7\GeneratorStyleInterface', | ||
'\DrupalCodeGenerator\Compatibility\GeneratorStyleCompatibilityInterface' | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace DrupalCodeGenerator\Compatibility\Php7; | ||
|
||
use Symfony\Component\Console\Question\Question; | ||
|
||
/** | ||
* PHP 7 compatibility. | ||
*/ | ||
trait AskQuestionTrait { | ||
|
||
/** | ||
* Asks a question. | ||
* | ||
* @return mixed | ||
* The answer. | ||
*/ | ||
public function askQuestion(Question $question) { | ||
return $this->compatAskQuestion($question); | ||
} | ||
|
||
/** | ||
* Asks a question. | ||
* | ||
* @return mixed | ||
* The answer. | ||
*/ | ||
abstract protected function compatAskQuestion(Question $question); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace DrupalCodeGenerator\Compatibility\Php7; | ||
|
||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Question\Question; | ||
|
||
/** | ||
* PHP 7 compatibility. | ||
*/ | ||
trait AskTrait { | ||
|
||
/** | ||
* Asks a question. | ||
* | ||
* @return mixed | ||
* The answer. | ||
*/ | ||
public function ask(InputInterface $input, OutputInterface $output, Question $question) { | ||
return $this->compatAsk($input, $output, $question); | ||
} | ||
|
||
/** | ||
* Asks a question. | ||
* | ||
* @return mixed | ||
* The answer. | ||
*/ | ||
abstract protected function compatAsk(InputInterface $input, OutputInterface $output, Question $question); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace DrupalCodeGenerator\Compatibility\Php7; | ||
|
||
use Symfony\Component\Console\Question\Question; | ||
|
||
/** | ||
* PHP 7 compatibility. | ||
*/ | ||
interface GeneratorStyleInterface { | ||
|
||
/** | ||
* Asks a question to the user. | ||
* | ||
* @return mixed | ||
* The answer. | ||
*/ | ||
public function askQuestion(Question $question); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace DrupalCodeGenerator\Compatibility\Php8; | ||
|
||
use Symfony\Component\Console\Question\Question; | ||
|
||
/** | ||
* PHP 8 compatibility. | ||
*/ | ||
trait AskQuestionTrait { | ||
|
||
public function askQuestion(Question $question): mixed { | ||
return $this->compatAskQuestion($question); | ||
} | ||
|
||
/** | ||
* Asks a question. | ||
* | ||
* @return mixed | ||
* The answer. | ||
*/ | ||
abstract protected function compatAskQuestion(Question $question); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace DrupalCodeGenerator\Compatibility\Php8; | ||
|
||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Question\Question; | ||
|
||
/** | ||
* PHP 8 compatibility. | ||
*/ | ||
trait AskTrait { | ||
|
||
public function ask(InputInterface $input, OutputInterface $output, Question $question): mixed { | ||
return $this->compatAsk($input, $output, $question); | ||
} | ||
|
||
/** | ||
* Asks a question. | ||
* | ||
* @return mixed | ||
* The answer. | ||
*/ | ||
abstract protected function compatAsk(InputInterface $input, OutputInterface $output, Question $question); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace DrupalCodeGenerator\Compatibility\Php8; | ||
|
||
use Symfony\Component\Console\Question\Question; | ||
|
||
/** | ||
* PHP 8 compatibility. | ||
*/ | ||
interface GeneratorStyleInterface { | ||
|
||
/** | ||
* Asks a question to the user. | ||
* | ||
* @return mixed | ||
* The answer. | ||
*/ | ||
public function askQuestion(Question $question): mixed; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters