-
Notifications
You must be signed in to change notification settings - Fork 95
Set properties autowired with @required as initialized #348
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
Set properties autowired with @required as initialized #348
Conversation
d9b295f to
238cd47
Compare
f962e83 to
45e92c3
Compare
raalderink
commented
May 23, 2023
@ondrejmirtes could you re-review this PR please? Thank you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fetch the rule with $container->getByType(UninitializedPropertyRule::class). It should be possible. That way it doesn't have to be in the baseline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done that and removed it from the baseline, however, it still fails on the same thing;
Accessing PHPStan\Rules\Properties\UninitializedPropertyRule::class is not covered by backward compatibility promise. The class might change in a minor PHPStan version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the inline @var.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On PHP 7.3 and lower this will throw the following;
Call to method getMethods() on an unknown class PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum.
I'm not quite sure what to do with this, as I'm confused as to why it would do this only on PHP 7.3 and lower
ef1b4bb to
cee621e
Compare
7891218 to
ab20c93
Compare
I have a couple issues here which I'm having a hard time getting resolved, as they fail on some PHP versions and succeed on others. I've baselined them, but unfortunately reportUnmatchedIgnoredErrors is on, which means it will still fail on some and succeed on others.
This following error is actually also baselined in phpstan-src, in enum-adapter-errors.neon. Due to that, I assume it's a known issue for PHP 7.2 and 7.3, but due to the reportUnmatchedIgnoredErrors, I can't really baseline this in this project. How would you want me to solve this issue?
-
message: "#^Call to method getMethods\\(\\) on an unknown class PHPStan\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\ReflectionEnum\\.$#"
count: 1
path: src/Symfony/RequiredAutowiringExtension.php
Secondly, on the lowest dependency builds, I get the following errors. On the highest dependencies, this builds correctly. What I've done is removed the class_exists like you asked, and instead used the class-string as string itself. I am having a lot of trouble in finding where this issue lies, and am uncertain of a solution. This is why I had the class_exists in the first place, and later tried it by including the actual symfony-contracts package that contains it (it makes sense that you don't want that to be included though). Could you please advise on how to approach this and be able to solve this issue?
-
message: "#^Parameter \\#1 \\$name of method PHPStan\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\ReflectionProperty\\:\\:getAttributes\\(\\) expects class\\-string\\|null, string given\\.$#"
count: 1
path: src/Symfony/RequiredAutowiringExtension.php
-
message: "#^Parameter \\#1 \\$name of method PHPStan\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\ReflectionMethod\\:\\:getAttributes\\(\\) expects class\\-string\\|null, string given\\.$#"
count: 1
path: src/Symfony/RequiredAutowiringExtension.php
These are the only things holding this PR back, so hopefully you can help me out by pointing me towards a solution here. Thanks @ondrejmirtes!
7120655 to
931c6b5
Compare
ab20c93 to
8724f2b
Compare
8724f2b to
253f8d3
Compare
253f8d3 to
538586f
Compare
ondrejmirtes
commented
Sep 29, 2023
Solved it, mainly with phpstan/phpstan-src@2b9af36, but also locking contracts package version to a newer one :)
538586f to
80eb1d6
Compare
ondrejmirtes
commented
Sep 29, 2023
Thank you.
Fixes #346