-
Notifications
You must be signed in to change notification settings - Fork 83
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
feat!: support PHP 8 #190
feat!: support PHP 8 #190
Conversation
@c0nst4ntin good work! Unfortunately it looks like Prismic does not care about PHP anymore and has abandoned this repo. We’ve made our own fork and continued working there -> https://github.com/elgentos/prismicio-php-kit |
@peterjaap Thank you! The changes you made to your fork look somewhat close to this PR although I also got the phpDocumentor working again with the Travis CI. I reckon they definitely care about PHP, but shifted their main focus towards frontend-oriented Frameworks etc. @lihbr I know it's been some time since you, me and @NouhaC talked about Prismic but could you please make sure that this PR gets to the right person? Without these changes, the Repository and Prismic as a CMS could become obsolete for future PHP Developers. We would need to create our own Forks and work individually instead of as a community. I'll gladly help to maintain parts of this repository as much as I can. |
Duly noted @c0nst4ntin , just pinging @angeloashmore also, we'll get back to you soon! |
Thanks for the ping, @lihbr, and awesome work, @c0nst4ntin! It's true that our efforts are focused on JavaScript these days, so we would love to work together on keeping the PHP library up to date. @lihbr and I will discuss how we can arrange some form of collaboration. In the meantime, this PR isn't being ignored! Before merging, however, we'll need to do some testing of our own. @peterjaap If you have any comments/feedback on the PR as well, we're more than happy to listen. 🙂 |
@angeloashmore Great. In the meantime let me know if you need anything! Once this package is ready for PHP 8 I might look into migrating some of the other starter repositories for PHP (e.g. php-website) |
@angeloashmore Hey There 👋🏼 I was just wondering how things are going with your testing? There was a recent inquiry from another developer as to the state of this PR on the underlying Issue: #182 |
Hey there, first of all, @angeloashmore and I are really sorry for the delay we're taking getting back to you. We'd like to organize our process better to ensure the PHP SDK remains maintained and usable by PHP users while providing them with the support they need.
Thank you for your understanding, we're looking forward to seeing the PHP kit get back on track~ |
@lihbr Thank you for this opportunity. I filled in my information so we can get on a call as soon as possible. Personally, I feel like the PR from @JeroenBoersma and @peterjaap does more than just a PHP update. This obviously comes from the reasoning behind their fork, which was to continue the development of their organisation. Whilst some of the changes look promising, I believe we should go forward with this PR implementation and revisit some of their changes after the support of PHP 8 was added. This was we can benefit from all our insights |
@c0nst4ntin - you may also be interested in https://github.com/netglue/prismic-client and https://github.com/netglue/prismic-cli - these support up to 8.1 right now but 8.2 support is forthcoming. |
@gsteel Thank you for the resources. I'll look into them 😄 But let's also try to get the official package to support PHP 8 so projects can continue to use it (for eg. when being migrated) |
👍 - Sure thing. I personally abandoned this lib a long time ago. Some of the work in the above may be useful to you in future is all. Good luck with it :) |
Filled out the form, didn't hear back, was out for a annual leave...
I get it that it feels this way, we indeed touched more lines of code. Thought, nothing public API specific besides of PHP 8.1 support and we've splitted the RichtText Block the same way as JavaScript does it. This makes extensibility, testing and maintainability easier long term. That's why we've added it... Maybe we can even rebase on this one and make it a collaboration =) |
Hey @JeroenBoersma 👋 Yesterday I spoke to some of the developers at Prismic. Sad to hear, that you couldn't make it. We figured to move forward with #190 and then revisit some of your refactorings after PHP 8 was supported. Does that sound okay to you? Some of your changes look promising, so maybe we could add them as a clean PR after the update 😊 |
Let's do that and get this project moving... :D - would love to have one source of truth. Would love to catch up with @lihbr and the dev team to see what's in store for the upcoming time! |
@lihbr @angeloashmore I fixed some of the links in this repository to account for the change in organizations. I believe there is a problem with the Travis CI 🤔 Currently, there are no new builds coming from my changes: https://app.travis-ci.com/github/prismicio/php-kit/requests Maybe you could take a look at this and make sure we can get this running again? |
IMO, considering you're going for a major, I'd wait and see what else can be improved that also breaks BC. That said, AFAICT, nothing in this patch actually breaks BC. SemVer allows dependency changes in a minor (Composer has also got your back there). If it were up to me, I'd release this as a minor as soon as CI passes. WRT CI, I'd also advocate GHA over travis. The Prismic client I maintain uses a pretty good setup courtesy of the @laminas org: GHA Yaml, Example Run |
@gsteel Thank you for your input on this. I really value your opinion, as you have been actively contributing to this repository and community for a longer time. I got one final question before I think this PR is "final" 😄 I also found [Bug] APC and APCU mismatch which were attempted to be solved in Fixes #162 - Correctly checks for apcu #163 I can confirm that This change was also made in this closed PR PHP 8.0 support & patches #173 Do you think I should add this to this PR? Seems to be legit, right? |
From what I remember, this lib has a hard dependency on |
@gsteel I implemented the version which I think is best. Once this is merged I will close the other Issue and mention this. I would still tend to go for a new major version. I think, updating the required PHP version and fixing this Anything else you would like to check or add? Otherwise, this now only waits for the CI to get fixed and then this can be released. Once again, I am happy to have you on board |
Hey @c0nst4ntin I disagree with the decision on the major: https://semver.org/#what-should-i-do-if-i-update-my-own-dependencies-without-changing-the-public-api - The public API hasn't changed (Removal of the null default params is debatable), and the APCu alteration is satisfied by the dependencies - it's essentially a bug fix - |
So you would suggest releasing the changes as version Is the change to |
Yes, the changes to |
@angeloashmore @lihbr Then I would also go for version This PR now only waits for Prismic to solve the CI problems and reply to this message 🙂 Thank you @gsteel for the review and insightful thoughts 💪🏼 |
@c0nst4ntin Publishing a minor works for me as long as existing projects won't break by upgrading. We can reserve We tend to be conservative when it comes to publishing breaking changes, ideally not more than once a year. Definitely not a hard rule, just a way to ensure we're giving developers enough time to update and maintain their projects. Re: Travis CI — I don't have access to fix the Travis CI issue, but I reached out the team that does. I'll let you know once I hear back. 🙂 |
@c0nst4ntin We use GitHub Actions for our in-house maintained packages since it's simpler to manage. Feel free to migrate to GHA if you'd like. 🙂 I'm still checking how we can get Travis CI running again though. |
@angeloashmore Once this PR is released and we established a more direct way of communication, we can discuss further changes to contribution guidelines, refactorings and migrating to GitHub Actions. I just dropped the current state of this PR into an old production Website of mine and everything continued to work. So there should be no major problems as far as @gsteel and myself are aware. We can then keep the version Once Travis is back on track, just give me a short heads up including the link. Do you mind releasing a new version on a Friday or should we wait until Monday? |
@c0nst4ntin Releasing on a Friday shouldn't be a problem. Packages are versioned, so if there's an issue in the package or the publishing flow, developers can always stick to the previous version. Whatever works best for you is good. 👍 I'll let you know once I hear back about Travis CI. It may not be this week, FYI. |
@c0nst4ntin So it looks like Travis CI is working correctly except for this PR. I just tested it in PR #193, and we can also see @gsteel's PR #192 also triggered Travis CI. I'm not sure why this specific PR got disconnected. Might be because we moved the repo after it was opened. As long as tests are passing on your machine, I think it's safe to move forward and merge. If you want to be cautious, you can close this PR and re-open a new PR, which should reconnect to Travis CI. (Or alternatively, change to GitHub Actions. Totally up to you!) |
Actions are currently disable for this repo I believe @angeloashmore - could you activate them? |
@angeloashmore I think you might be right. That's also why the two other PRs worked. Does the merge also trigger a CI Check for the master? In that case, I think we can just merge? 🤔 If we close this and re-open we would lose all the communication in context with the changes. |
@angeloashmore I merged the PR, which resulted in a new Travis Build. This sadly failed: https://app.travis-ci.com/github/prismicio-community/php-kit/builds/257470938 As far as I can tell, all checks passed:
Whilst there are a few warnings regarding the APC extension, it appears that the last step failed to publish the docs:
This is also, why your PR did not fail:
Whilst I don't think, that this indicates a problem with releasing the new version, I would like to hear your feedback. I'd guess this is up to your "Travis Team" to figure out? Should I go forward and create a new tag and release? Or wait until we are able to re-run the failed steps? |
Hey @c0nst4ntin, looking at the build logs, it looks like CI failed to push the PHPDoc build to GitHub pages. The GitHub token configured in Travis was invalid since moving the repository to It's fixed now with a new token, so you should be able to create new commits and PRs with Travis CI. If you have time, could you test it on your side and let me know if it works? You can go ahead create a new tag and release the updates whenever you're ready. 🙂 |
As mentioned in Issue #182 this package currently does not support PHP 8 (and PHP 8.1).
There are multiple problems that I tried to solve with this PR:
1. Required Parameters must be declared before optional Parameters
As previously mentioned in #182 the Form class has 2 optional parameters in the constructor followed by several required parameters. This causes the following Notice:
To fix this issue I removed the default value for the parameters but left them nullable. The Code inside the package is not affected by this change, as it already passes a fallback null.
2. The second Parameter of
htmlentities()
is no longer nullable (PHP Docs)Although this was already partially solved by the current open Pull-Request #183 this PR delivers complete support for PHP 8 instead of just solving this one Exception. I do not want to claim credit for this change, but it is required to make this PR work as a whole migration to PHP8.
3. Updating the dependencies and tests to support PHP 8
To support Testing in PHP 8 I updated the dependencies to use PHPUnit Version 9 (Version Support). With this came multiple changes to test files, as certain Functions were deprecated or removed in the new versions of PHPUnit.
To allow all tests to continue working I had to install the packages
phpspec/prophecy
andphpspec/prophecy-phpunit
as a dev-dependency.Furthermore, I made PHP 8.0 a minimum requirement in the packages
composer.json
file.Obviously, this PR introduces some breaking changes and should therefore be considered as part of a new major version.