-
Notifications
You must be signed in to change notification settings - Fork 222
Annotations refactoring & PHP 8 Attributes #801
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
Conversation
I thought we are gonna discuss it in January first |
@mcg-web Hey man! I have a bunch of missing type hints but I'm not sure how to handle them when a parameter can accept multiple types (string or array for example). |
@mcg-web Another problem is with the test coverage. As the PHP 8 attribute parser tests only run with PHP8, the coverage drops when used with PHP 7. |
Hey @Vincz !
you should use phpdoc right now since union is available only for php >= 8.0 /**
* @param string|array $myArg
*/
function ($myArg) {}
we can try using php 8.0 for coverage tests |
Ok guys, this PR is almost ready.
We would need to be able to run tests in a PHP8 environment to support attributes (at the moment tests related to attributes are skipped if not in PHP8). Let me know what you think! |
Hey @murtukov! I'm trying to run the test on Github with PHP 8 (see my latest commit). |
@Vincz just released a new version of PHPCodeGenerator. Change the composer requirement to 0.1.5 |
Thank you! |
Fix test
@murtukov It break the PHP 7 tests, because:
but...
|
@Vincz well if both approaches use almost the 100% same codebase, then let it be a single bundle 🙂 One thing I don't understand is why removing shorthands? As I know the Symfony's Router uses both annotations and attributes with a single class and it's still possible to use shorthands. Why can't we do the same? Here is the implementation: https://github.com/symfony/routing/blob/5.x/Annotation/Route.php |
@murtukov Yes, at the end it was exactly the same: Metadata stored on a PHP classes, but the exploitation of this metadata is the same. So there is just a very few differences than we can handle in the parser itself. I removed the shorthands for now, cause I didn't like the implementation. The current route annotation use the "old" way to setup the annotation. It takes the parameters from an array in the first argument of the constructor. So there is no argument validation by the annotation system. So, they introduce the |
@murtukov About the tests, the coverage drops because the attributes tests are skipped. |
Well... The tests with coverage in PHP8 is ok, but the coverage upload to scrutinizer fails. |
@Vincz seems like switching to PHP 8 environment is the only solution |
@mcg-web Hey man! Any idea what the coverage upload would fail? I don't want to mess with the ci tasks so I didn't try to fix it myself... |
@Vincz I don’t know, I never configured GitHub workflows. Try setting the PHP version to “8.0” instead of just “8” |
Ok, so the problem is ocular (the binary to upload the coverage) downloaded from the scrutinizer website is an old version (see scrutinizer-ci/ocular#53).
I tried, it installs fine, but I'm unable execute it, no matter the syntax I use (the binary is stored in
But none of them worked and the binary is not found. Seems like a context problem. |
Fix the path to Ocular
@murtukov You're the best! I'll check the missing tests. |
Uh oh!
There was an error while loading. Please reload this page.