diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-07-02 11:54:17 +0200 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2015-12-24 09:20:26 +0100 |
commit | 23c754aed3bfa5c795a03e63183158d028a6a408 (patch) | |
tree | c35d37f023edee6fa4784929b85fd88b8bd8676d /tests | |
parent | 9cdc3f0558b8c278e91037c2330b876da7ca99e2 (diff) | |
download | nextcloud-server-23c754aed3bfa5c795a03e63183158d028a6a408.tar.gz nextcloud-server-23c754aed3bfa5c795a03e63183158d028a6a408.zip |
prefer scalar type hints over phpdoc annotation
use method exists lookup to be safe and not break on old hhvm versions
add test that checks if type hint is preferred over annotation
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/appframework/utility/ControllerMethodReflectorTest.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php b/tests/lib/appframework/utility/ControllerMethodReflectorTest.php index a584b5481ba..38bd537e073 100644 --- a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php +++ b/tests/lib/appframework/utility/ControllerMethodReflectorTest.php @@ -104,6 +104,25 @@ class ControllerMethodReflectorTest extends \Test\TestCase { $this->assertEquals('int', $reader->getType('test')); } + /** + * @Annotation + * @param int $a + * @param int $b + * @requires PHP 7 + */ + public function testReadTypeIntAnnotationsScalarTypes($a, float $b, int $c, $d){ + $reader = new ControllerMethodReflector(); + $reader->reflect( + '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + 'testReadTypeIntAnnotationsScalarTypes' + ); + + $this->assertEquals('int', $reader->getType('a')); + $this->assertEquals('float', $reader->getType('b')); + $this->assertEquals('int', $reader->getType('c')); + $this->assertNull($reader->getType('d')); + } + /** * @Annotation |