Skip to content

Conversation

plozmun
Copy link
Contributor

@plozmun plozmun commented Oct 29, 2020

In PHP 8 namespaces are treated as single token (T_NAME_FULLY_QUALIFIED)

RFC: https://wiki.php.net/rfc/namespaced_names_as_token

This PR add compatibility with this token

@plozmun
Copy link
Contributor Author

plozmun commented Oct 30, 2020

Test errors are caused by this

https://php.watch/versions/8.0/deprecate-required-param-after-optional

Mostly in Jackalope FS and this

public function migrate($to = null, OutputInterface $output)

It can be solved with

public function migrate(?string $to, OutputInterface $output)

but , which php versions are supported?

@dantleech
Copy link
Member

I think we can bump to 7.1 if not higher cc @dbu @alexander-schranz

if ($tokens[$j][0] === T_STRING) {
if (\defined('T_NAME_QUALIFIED') && $tokens[$j][0] === T_NAME_QUALIFIED) {
$namespace .= '\\' . $tokens[$j][1];
} elseif ($tokens[$j][0] === T_STRING) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexander-schranz
Copy link
Contributor

@dantleech the current major of sulu requires ^7.2 so we could go to ^7.2 from our side.

@plozmun
Copy link
Contributor Author

plozmun commented Oct 30, 2020

Symfony 3.4 will be unmaintained next month. Maybe we can require "php": ">=7.1.3" like finder & console in 4.4?

@dbu
Copy link
Member

dbu commented Oct 30, 2020

requiring php ^7.2|^8.0 is fine with me.

@dantleech
Copy link
Member

dantleech commented Oct 30, 2020

Let's go with ^7.2|^8.0

@plozmun plozmun force-pushed the feature/php-8-compatibility branch from ef834dd to 349ac13 Compare October 30, 2020 11:23
@plozmun
Copy link
Contributor Author

plozmun commented Oct 30, 2020

Simple phpunit is causing errors. But runing ./vendor/bin/phpunit works fine.

Can i change it for phpunit?

@plozmun plozmun force-pushed the feature/php-8-compatibility branch from 349ac13 to e8d738f Compare October 30, 2020 12:56
@dantleech
Copy link
Member

dantleech commented Oct 30, 2020

Maybe @alexander-schranz can comment on that - not sure about simple phpunit.

This error phpspec/prophecy-phpunit v2.0.0 requires php ^7.3 -> your php version (7.2.15) does not satisfy that requirement. is a problem -- I guess we can fix by installing different dev deps for different versions of PHP. For another package I just copy-pasted the trait and made it compatible with both: https://github.com/phpbench/phpbench/blob/master/tests/ProphecyTrait.php - not a very scalable solution though.

dump lower php versions

dump lower php versions

Remove simple phpunit

remove phpspec/prophecy-phpunit
@plozmun plozmun force-pushed the feature/php-8-compatibility branch from e8d738f to 3357634 Compare October 30, 2020 13:01
@plozmun
Copy link
Contributor Author

plozmun commented Oct 30, 2020

I have removed phpspec/prophecy-phpunit . It's a deprecation message from phpunit but it's better to do in another PR

PHPUnit\Framework\TestCase::prophesize() is deprecated and will be removed in PHPUnit 10. Please use the trait provided by phpspec/prophecy-phpunit.

@alexander-schranz
Copy link
Contributor

symfony/phpunit-bridge can be removed when we increase the PHP Version to 7.2 as there it should not longer be needed as BC layer.

@plozmun
Copy link
Contributor Author

plozmun commented Oct 30, 2020

symfony/phpunit-bridge can be removed when we increase the PHP Version to 7.2 as there it should not longer be needed as BC layer.

Removed then 😄

Test are failing due to jackalope/jackalope-fs

@dbu
Copy link
Member

dbu commented Oct 31, 2020

yeah, agree that phpunit-bridge is not necessary here.

adjusting jackalope-fs for php 8 probably needs some effort...

i did it for jackalope-jackrabbit, so the whole of jackalope/jackalope and the phpcr repos are ready: https://github.com/jackalope/jackalope-jackrabbit/releases/tag/1.4.1
for jackalope-doctrine-dbal, i noticed that we need to upgrade doctrine-dbal which may be an issue, and replace phpunit/dbunit because that component got abandoned: jackalope/jackalope-doctrine-dbal#373

lib/Migrator.php Outdated
* @return VersionInterface[] Executed migrations
*/
public function migrate($to = null, OutputInterface $output)
public function migrate(?string $to, OutputInterface $output)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be a BC break?

Copy link
Contributor

@alexander-schranz alexander-schranz Jan 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did change this back in: becd9b9

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. The minimum version required is 7.2 even if it is not specified in composer but we can change it to phpdoc instead.

Copy link
Contributor

@alexander-schranz alexander-schranz Jan 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not mean that its not compatible with PHP Version but public function should not add any typehints or other things in minor or hotfix releases, as somebody could call or extend from that class and php would then error which it would not before. So I would avoid adding any typehints aslong as we don't plan to release a new major version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed !

@dbu
Copy link
Member

dbu commented Jan 22, 2021

thanks a lot @plozmun for starting this!

continued in #13

@dbu dbu closed this Jan 22, 2021
@plozmun plozmun deleted the feature/php-8-compatibility branch January 22, 2021 17:32
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

Successfully merging this pull request may close these issues.

4 participants