Added additional type check.

Related to https://scrutinizer-ci.com/g/phpDocumentor/phpDocumentor2/inspections/01df17f4-8aac-49fc-b46a-0e99c42407a8/issues/files/src/phpDocumentor/Descriptor/ConstantDescriptor.php?status=existing&orderField=path&order=asc