Open bartrail opened 6 years ago
Did you may miss the :
in your example ?
public function getValue() >:< ?int
I tested it with a simple function
class Run {
public function test(): ?int
{
return null;
}
}
$x = (new Run())->test();
The PHP-Parser 3.x should support PHP until PHP 7.2.
There's definitely something going on here. I have a similar issue when grouping use declaration.
When using in a file:
use Symfony\Component\HttpFoundation\{
Request,
Response
};
I have an error displayed in the output:
Your project contains invalid code:
Syntax error, unexpected '{', expecting T_STRING in file /project/src/AppBundle/Controller/LayerController.php
When replacing the group use declaration by multiple use:
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
The error is gone.
I'm running deprecation detector using the following docker image: https://github.com/jakzal/phpqa , which runs PHP 7.2. I didn't look deeper but there might be some weird issue lurking somewhere.
Have similar issue.
Syntax error, unexpected '?', expecting T_VARIABLE in file /srv/http/www/src/DTO/ProductFeed/Product.php
public function __construct(
string $name,
?string $category,
?string $brand,
?string $productUrl,
?string $imageUrl,
?string $localId,
?string $gtin
) {
$this->name = trim($name);
$this->category = trim($category) ?: null;
$this->brand = trim($brand) ?: null;
$this->productUrl = trim($productUrl) ?: null;
$this->imageUrl = trim($imageUrl) ?: null;
$this->localId = trim($localId) ?: null;
$this->gtin = trim($gtin) ?: null;
}
I get a syntax error while testing on PHP 7.1 code:
this file contains the optional return value operator
public function getValue() ?int
a quick look into this composer.json reveals the support of php 7.0 - so I'd like to know are there any plans to upgrade to support php 7.1? I assume of course, pull requests are welcome ;)