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

Mockery 1.6.0 on PHP 7.3 - parse error DefinedTargetClass.php:53 #1266

Closed
michalbundyra opened this issue Jun 5, 2023 · 15 comments
Closed
Assignees
Labels
Bug An error or unexpected behavior. Fixed for bug fixes or error corrections
Milestone

Comments

@michalbundyra
Copy link

michalbundyra commented Jun 5, 2023

ParseError: syntax error, unexpected '...' (T_ELLIPSIS), expecting ']'

[...]/vendor/mockery/mockery/library/Mockery/Generator/DefinedTargetClass.php:53

Unpacking inside arrays is available since PHP 7.4

See: https://github.com/php-mock/php-mock-mockery/actions/runs/5176394271/jobs/9325157828

Requirements on composer allow PHP 7.3:

"php": "^7.3 || ^8.0",

but we are not running tests on PHP 7.3:

php: ['7.4', '8.0', '8.1', '8.2', '8.3']

@GrahamCampbell
Copy link
Contributor

GrahamCampbell commented Jun 5, 2023

This is quite unfortunate. The least worse option here might be to re-tag the 1.6.0 release with the PHP version constraint corrected. The only other option is to re-add PHP 7.3 support in 1.6.1, which may be pretty tricky.

@davedevelopment
Copy link
Collaborator

Fuck.

Sorry everyone, I've not been paying much attention lately. Will install 7.3 and see how quickly I can get it running.

@davedevelopment
Copy link
Collaborator

I can't build 7.3 right now, probably openssl mismatches.

@davedevelopment
Copy link
Collaborator

I don't really want to re-tag like it never happened. Can I tell packagist to ignore 1.6.0 and then tag 1.6.1 with the ^7.4 || ^8.0 constraint?

@GrahamCampbell
Copy link
Contributor

Can I tell packagist to ignore 1.6.0

No. It'll get re-synced as long as it exists on GitHub. You could delete the tag from both?

@anomiex
Copy link

anomiex commented Jun 5, 2023

We're running into this too on our CI runs with PHP 7.3.

If you delete the 1.6.0 tag from the repo, packagist should delist it. If not, you should be able to log in to packagist and manually delete it.

BTW, the problematic commit seems to be e0ecc27, and it could probably be fixed by changing it to something like

        return array_unique(array_merge(['\AllowDynamicProperties'], array_map(
            static function (ReflectionAttribute $attribute) { return '\\' . $attribute->getName(); },
            $this->rfc->getAttributes()
        )));

avoiding the spread-in-array and arrow functions.

@GrahamCampbell
Copy link
Contributor

If you delete the 1.6.0 tag from the repo, packagist should delist it. If not, you should be able to log in to packagist and manually delete it.

I think you will need to manually delete it.

@davedevelopment
Copy link
Collaborator

I think that's sorted 🤦

https://github.com/mockery/mockery/releases/tag/1.6.1

Again, apologies everyone.

@anomiex
Copy link

anomiex commented Jun 5, 2023

Confirmed that our PHP 7.3 runs in CI are picking up 1.5.1 now and so are working again. Thanks!

@michalbundyra
Copy link
Author

@davedevelopment thanks, works for me.

@anomiex
Copy link

anomiex commented Jun 6, 2023

It looks like the broken 1.6.0 tag has reappeared on Packagist, breaking our CI again.

@GrahamCampbell
Copy link
Contributor

Looks like someone who has the tag locally has re-pushed it.

@GrahamCampbell
Copy link
Contributor

cc @ghostwriter

@davedevelopment
Copy link
Collaborator

Deleted here and on packagist

@ghostwriter
Copy link
Member

@GrahamCampbell That was my mistake,

Thanks for the heads up.

@davedevelopment Thanks for taking care of that.

@ghostwriter ghostwriter added this to the 1.6.1 milestone Jun 7, 2023
@ghostwriter ghostwriter added Bug An error or unexpected behavior. Fixed for bug fixes or error corrections labels Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An error or unexpected behavior. Fixed for bug fixes or error corrections
Projects
None yet
Development

No branches or pull requests

5 participants