Adding override attribute to override code action#3057
Conversation
| {% if prototype.override %} | ||
| #[\Override] | ||
| {% endif %} |
There was a problem hiding this comment.
I don't know what the best way is to scope this only to modern php projects.
| ); | ||
|
|
||
| $methodBuilder = $builder->class($method->declaringClass()->name()->short())->method($method->name()); | ||
| $methodBuilder->override(); |
There was a problem hiding this comment.
you would need to probably take a similar approach as: https://github.com/phpactor/phpactor/pull/3056/changes#diff-64fe3016a6b976b1ad21f7e0babe3331ef32089c520339a013a07c9eaa1d28cbR74
i.e. in
c644c0b to
2ed389b
Compare
| $reflector = $this->reflectorForWorkspace($source); | ||
| $factory = new WorseBuilderFactory($reflector); | ||
| $override = new WorseOverrideMethod($reflector, $factory, $this->updater()); | ||
| $override = new WorseOverrideMethod($reflector, $factory, $this->updater(), '8.5'); |
There was a problem hiding this comment.
Do we also want to test both versions like run the override Method Test for php 8.0 (as an example for a version that should not have the override feature) and for 8.3 again with the Override or is just testing the "newer" version enough?
2ed389b to
cf0a707
Compare
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Phpactor Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.
| Benchmark suite | Current: cf0a707 | Previous: b327eec | Ratio |
|---|---|---|---|
ConfigLoaderBench::benchJsonPlainPhp |
0.015611506849314892 ms (± 1.88%) |
0.007483600782778811 ms (± 3.67%) |
2.09 |
This comment was automatically generated by workflow using github-action-benchmark.
When generating method overrides with phpactor it should also include the Override attribute for those methods.
refs #3056