Skip to content

Define in function or method failed to parse #233

Closed
@marcimat

Description

@marcimat

Hi, seems somewhere between requirement^5.0 and ^5.0@dev (used in phpDocumentor) (now with commit 7666c4b) a define declaration into function or method failed to parse.

It seems that cdda55c introduce this problem, as I don’t get it with the previous 07ce695

Steps to reproduce :

composer.json

{
    "require": {
        "phpdocumentor/reflection": "5.x-dev#cdda55ca794780f1fe119e16b9f8ff3245d4a5ac"
    }
}

test.php

<?php
function test() {
	define('TEST', true);
}

demo.php

<?php
include_once 'vendor/autoload.php';
$projectFactory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance();
$projectFiles = [new \phpDocumentor\Reflection\File\LocalFile('test.php')];
$project = $projectFactory->create('My Project', $projectFiles);
var_dump($project);

Run.

php demo.php

That gives:

Fatal error: Uncaught AssertionError: assert($file instanceof FileElement) in vendor/phpdocumentor/reflection/src/phpDocumentor/Reflection/Php/Factory/Define.php:103

Hope it helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions