-
-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-adding PHP 7.0 support, which works for most commands #155
Conversation
src/Maker/MakeEntity.php
Outdated
@@ -110,6 +110,10 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma | |||
|
|||
public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator) | |||
{ | |||
if (version_compare(PHP_VERSION, '7.1.0') < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use \PHP_VERSION_ID
instead, as done in Symfony.
src/Test/MakerTestCase.php
Outdated
|
||
class MakerTestCase extends TestCase | ||
{ | ||
protected function executeMakerCommand(MakerTestDetails $testDetails) | ||
{ | ||
if ($testDetails->getMaker() instanceof MakeEntity && version_compare(PHP_VERSION, '7.1.0') < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This MakerTestCase is a reusable one for any maker (including third-party ones). Hardcoding a special case for MakeEntity looks weird to me. I suggest adding a way to mark the test as skipped in MakerTestDetails instead.
src/Util/ClassSourceManipulator.php
Outdated
@@ -504,7 +504,11 @@ private function addStatementToConstructor(Node\Stmt $stmt) | |||
$this->updateSourceCodeFromNewStmts(); | |||
} | |||
|
|||
private function getConstructorNode(): ?Node\Stmt\ClassMethod | |||
/** | |||
* @return null|Node\Stmt\ClassMethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we generally put |null
at the end in Symfony.
src/Test/MakerTestCase.php
Outdated
if ($testDetails->getMaker() instanceof MakeEntity && version_compare(PHP_VERSION, '7.1.0') < 0) { | ||
$this->markTestSkipped('MakeEntity tests require 7.1 or higher'); | ||
if (!$testDetails->isSupportedByCurrentPhpVersion()) { | ||
$this->markTestSkipped(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skipping should have a message.
src/Test/MakerTestDetails.php
Outdated
@@ -245,4 +254,9 @@ public function isCommandAllowedToFail(): bool | |||
{ | |||
return $this->commandAllowedToFail; | |||
} | |||
|
|||
public function isSupportedByCurrentPhpVersion() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: bool
57808d5
to
043efcf
Compare
…weaverryan) This PR was squashed before being merged into the 1.0-dev branch (closes #155). Discussion ---------- Re-adding PHP 7.0 support, which works for most commands PHP 7.0 support was removed when I updated the make:entity command. This is because the make:entity command generates PHP 7.1+ compatible code only (it uses nullable ?). But, having 7.0 support is easy... because 7.1 is only needed for this one command. Commits ------- 043efcf Re-adding PHP 7.0 support, which works for most commands
PHP 7.0 support was removed when I updated the make:entity command. This is because the make:entity command generates PHP 7.1+ compatible code only (it uses nullable ?).
But, having 7.0 support is easy... because 7.1 is only needed for this one command.