Neos\Flow\Tests\Functional\Aop\Fixtures\TargetClassWithPhp7Features::methodWithStaticTypeDeclarations PHP Метод

methodWithStaticTypeDeclarations() публичный Метод

The return type declaration causes syntax errors below PHP 7.0 but is supported by the reflection service and proxy builder in Flow.
public methodWithStaticTypeDeclarations ( string $aString, integer $aNumber ) : string
$aString string
$aNumber integer
Результат string
    public function methodWithStaticTypeDeclarations(string $aString, int $aNumber)
    {
        return "{$aString} and {$aNumber}";
    }

Usage Example

 /**
  * @test
  */
 public function methodWithStaticTypeDeclarationsCanBeAdvised()
 {
     if (version_compare(PHP_VERSION, '7.0.0') < 0) {
         $this->markTestSkipped('Requires PHP 7');
     }
     $targetClass = new Fixtures\TargetClassWithPhp7Features();
     $this->assertSame('This is so NaN', $targetClass->methodWithStaticTypeDeclarations('The answer', 42));
 }
TargetClassWithPhp7Features