Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strict_types declaration must be the very first statement in the script #4096

Closed
oojacoboo opened this issue Feb 13, 2020 · 5 comments
Closed

Comments

@oojacoboo
Copy link

[13-Feb-2020 17:56:55 UTC] PHP Fatal error: strict_types declaration must be the very first statement in the script in /srv/www/vendor/phpunit/phpunit/phpunit on line 2

The code style that's being used here, while not a bad style, isn't what the interpreter expects (it seems). Can this just be updated to conform instead of trying to go against the grain?

@sebastianbergmann
Copy link
Owner

Which version of PHPUnit and PHP are you using?

@oojacoboo
Copy link
Author

oojacoboo commented Feb 13, 2020

So, it seems the issue is that I'm trying to include the CLI script. Since it's not executed via a shell, the interpreter is complaining. That's unfortunate though since I have a direct need to wrap PHPUnit, in order to execute code before and after the process.

This is with PHP 7.4

@sebastianbergmann
Copy link
Owner

The script is not meant to be included.

@sebastianbergmann
Copy link
Owner

If you need to run code before the first test and/or after the last test then you should write an extension that hooks into PHPUnit's test runner.

@oojacoboo
Copy link
Author

I'll look into that. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants