function DocParserTest::getAnnotationVarTypeProviderInvalid

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php \Drupal\Tests\Component\Annotation\Doctrine\DocParserTest::getAnnotationVarTypeProviderInvalid()
  2. 8.9.x core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php \Drupal\Tests\Component\Annotation\Doctrine\DocParserTest::getAnnotationVarTypeProviderInvalid()
  3. 10 core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php \Drupal\Tests\Component\Annotation\Doctrine\DocParserTest::getAnnotationVarTypeProviderInvalid()

File

core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php, line 454

Class

DocParserTest
This class is a near-copy of Doctrine\Tests\Common\Annotations\DocParserTest, which is part of the Doctrine project: &lt;<a href="http://www.doctrine-project.org&amp;gt">http://www.doctrine-project.org&amp;gt</a>;. It was copied from version 1.2.7.

Namespace

Drupal\Tests\Component\Annotation\Doctrine

Code

public static function getAnnotationVarTypeProviderInvalid() {
    
    //({attribute name}, {type declared type}, {attribute value} , {given type or class})
    return array(
        // boolean type
array(
            'boolean',
            'boolean',
            '1',
            'integer',
        ),
        array(
            'boolean',
            'boolean',
            '1.2',
            'double',
        ),
        array(
            'boolean',
            'boolean',
            '"str"',
            'string',
        ),
        array(
            'boolean',
            'boolean',
            '{1,2,3}',
            'array',
        ),
        array(
            'boolean',
            'boolean',
            '@Name',
            'an instance of Drupal\\Tests\\Component\\Annotation\\Doctrine\\Name',
        ),
        // alias for internal type boolean
array(
            'bool',
            'bool',
            '1',
            'integer',
        ),
        array(
            'bool',
            'bool',
            '1.2',
            'double',
        ),
        array(
            'bool',
            'bool',
            '"str"',
            'string',
        ),
        array(
            'bool',
            'bool',
            '{"str"}',
            'array',
        ),
        // integer type
array(
            'integer',
            'integer',
            'true',
            'boolean',
        ),
        array(
            'integer',
            'integer',
            'false',
            'boolean',
        ),
        array(
            'integer',
            'integer',
            '1.2',
            'double',
        ),
        array(
            'integer',
            'integer',
            '"str"',
            'string',
        ),
        array(
            'integer',
            'integer',
            '{"str"}',
            'array',
        ),
        array(
            'integer',
            'integer',
            '{1,2,3,4}',
            'array',
        ),
        // alias for internal type double
array(
            'float',
            'float',
            'true',
            'boolean',
        ),
        array(
            'float',
            'float',
            'false',
            'boolean',
        ),
        array(
            'float',
            'float',
            '123',
            'integer',
        ),
        array(
            'float',
            'float',
            '"str"',
            'string',
        ),
        array(
            'float',
            'float',
            '{"str"}',
            'array',
        ),
        array(
            'float',
            'float',
            '{12.34}',
            'array',
        ),
        array(
            'float',
            'float',
            '{1,2,3}',
            'array',
        ),
        // string type
array(
            'string',
            'string',
            'true',
            'boolean',
        ),
        array(
            'string',
            'string',
            'false',
            'boolean',
        ),
        array(
            'string',
            'string',
            '12',
            'integer',
        ),
        array(
            'string',
            'string',
            '1.2',
            'double',
        ),
        array(
            'string',
            'string',
            '{"str"}',
            'array',
        ),
        array(
            'string',
            'string',
            '{1,2,3,4}',
            'array',
        ),
        // annotation instance
array(
            'annotation',
            'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
            'true',
            'boolean',
        ),
        array(
            'annotation',
            'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
            'false',
            'boolean',
        ),
        array(
            'annotation',
            'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
            '12',
            'integer',
        ),
        array(
            'annotation',
            'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
            '1.2',
            'double',
        ),
        array(
            'annotation',
            'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
            '{"str"}',
            'array',
        ),
        array(
            'annotation',
            'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
            '{1,2,3,4}',
            'array',
        ),
        array(
            'annotation',
            'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\AnnotationTargetAll',
            '@Name',
            'an instance of Drupal\\Tests\\Component\\Annotation\\Doctrine\\Name',
        ),
    );
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.