How to use the doctrine.parseParamType function in doctrine

To help you get started, we’ve selected a few doctrine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jonschlinkert / parse-comments / test / parse.type.doctrine.js View on Github external
it('question option', () => {
      let type = doctrine.parseParamType('?=');
      assert.deepEqual(type, {
        type: 'OptionalType',
        expression: {
          type: 'NullableLiteral'
        }
      });
    });
github jonschlinkert / parse-comments / test / parse.type.doctrine.js View on Github external
it('function type union', () => {
      let type = doctrine.parseParamType('function(): ?|number');
      assert.deepEqual(type, {
        type: 'UnionType',
        elements: [
          {
            type: 'FunctionType',
            params: [],
            result: {
              type: 'NullableLiteral'
            }
          },
          {
            type: 'NameExpression',
            name: 'number'
          }
        ]
      });
github jonschlinkert / parse-comments / test / parse.type.doctrine.js View on Github external
it('function option parameters former', () => {
      let type = doctrine.parseParamType('function(?, number)');
      assert.deepEqual(type, {
        type: 'FunctionType',
        params: [
          {
            type: 'NullableLiteral'
          },
          {
            type: 'NameExpression',
            name: 'number'
          }
        ],
        result: null
      });
    });
github jonschlinkert / parse-comments / test / parse.type.doctrine.js View on Github external
it('function option parameters latter', () => {
      let type = doctrine.parseParamType('function(number, ?)');
      assert.deepEqual(type, {
        type: 'FunctionType',
        params: [
          {
            type: 'NameExpression',
            name: 'number'
          },
          {
            type: 'NullableLiteral'
          }
        ],
        result: null
      });
    });
github jonschlinkert / parse-comments / test / parse.type.doctrine.js View on Github external
it('question', () => {
      let type = doctrine.parseParamType('?');
      assert.deepEqual(type, {
        type: 'NullableLiteral'
      });
    });
github jonschlinkert / parse-comments / test / parse.tag.doctrine.js View on Github external
paramType(str, options) {
          return doctrine.parseParamType(str, options);
        },
        comment(comment, options) {