Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('question option', () => {
let type = doctrine.parseParamType('?=');
assert.deepEqual(type, {
type: 'OptionalType',
expression: {
type: 'NullableLiteral'
}
});
});
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'
}
]
});
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
});
});
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
});
});
it('question', () => {
let type = doctrine.parseParamType('?');
assert.deepEqual(type, {
type: 'NullableLiteral'
});
});
paramType(str, options) {
return doctrine.parseParamType(str, options);
},
comment(comment, options) {