Skip to content

Commit

Permalink
__toString function has been DEPRECATED (#801)
Browse files Browse the repository at this point in the history
* __toString function has been DEPRECATED

__toString function has been DEPRECATED as of PHP 7.1.0

* remove code

remove code
  • Loading branch information
cxlblm authored and barryvdh committed Sep 17, 2019
1 parent 428d32c commit 25b61c5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Console/ModelsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,14 @@ protected function getPropertiesFromMethods($model)
) {
//Use reflection to inspect the code, based on Illuminate/Support/SerializableClosure.php
$reflection = new \ReflectionMethod($model, $method);
// php 7.x type or fallback to docblock
$type = (string) ($reflection->getReturnType() ?: $this->getReturnTypeFromDocBlock($reflection));

if ($returnType = $reflection->getReturnType()) {
$type = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string)$returnType;
} else {
// php 7.x type or fallback to docblock
$type = (string)$this->getReturnTypeFromDocBlock($reflection);
}

$file = new \SplFileObject($reflection->getFileName());
$file->seek($reflection->getStartLine() - 1);

Expand Down

0 comments on commit 25b61c5

Please # to comment.