Problem/Motivation
Annotations are not checked for deprecated / changed keys and new keys required.
- The
contextkey should becontext_definitionto define cache contexts. See https://www.drupal.org/node/3016699 - The
config_exportkey was added to config entities which is required in practice currently. See https://www.drupal.org/node/2481909. It may become optional once/if #2483407: Allow configuration schema fallback in ConfigEntityType::getPropertiesToExport() to work without an ID is done.
Steps to reproduce
Context definition came up in #3160753: Drupal 9 compatibility among others. The config export key was originally reported as part of #3131063: Detect GetResponseForExceptionEvent is deprecated in favour of ExceptionEvent.
Proposed resolution
Scan annotations and find issues in them.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | interdiff.txt | 775 bytes | gábor hojtsy |
| #30 | 3161052-30.patch | 6.65 KB | gábor hojtsy |
| #28 | interdiff.txt | 2.54 KB | gábor hojtsy |
| #28 | 3161052-28.patch | 6.65 KB | gábor hojtsy |
| #26 | interdiff.txt | 1.27 KB | gábor hojtsy |
Issue fork upgrade_status-3161052
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3161052-fix-against-3.x
changes, plain diff MR !5
- 3161052-annotation-checking-missing
changes, plain diff MR !4
Comments
Comment #2
gábor hojtsyCan you copy here what exactly would need to be detected?
Comment #3
grimreaperHello,
In the following code, https://git.drupalcode.org/project/context_profile_role/-/blob/8.x-1.x/s...
context had been changed into context_definitions:
Change record: https://www.drupal.org/node/3016699
Issue: https://www.drupal.org/project/drupal/issues/3014949
Comment #4
gábor hojtsyGood point, parenting to the missing coverage issue. We don't currently check annotations I believe. We could add a very basic / crude check for this specific annotations. Are you aware of other annotations that would need to be checked?
Comment #5
grimreaperHello,
Currently not aware of other deprecation in annotations, sorry.
I though it would already be handled in PHPStan or detected somewhere else. So I was surprised when the issue had been opened :)
And thanks for the update.
Comment #6
gábor hojtsyUpdated issue summary. Brought in config_export annotation report from #3131063: Detect GetResponseForExceptionEvent is deprecated in favour of ExceptionEvent.
Comment #7
gábor hojtsyComment #8
mglamanAll right, I have a pull request for phpstan-drupal to add a rule that will catch this: https://github.com/mglaman/phpstan-drupal/pull/186
EDIT: this is only for `context` to `context_definitions`
Comment #9
mglamanThis handles config_export https://github.com/mglaman/phpstan-drupal/pull/188
Comment #11
mglamanComment #12
gábor hojtsyI am still puzzled by branch switching with MRs. Did the following to get a fresh upgrade status checkout so I don't break my other dev checkouts:
Did the following as per the above docs:
Checked out
3161052-annotation-checking-missing:Attempted to rebase to 8.x-3.x:
I fixed this conflict manually, then:
Then this goes on forever, I stopped after a dozen or so manual conflict resolutions with the info file, the form, the deprecation analyzer (repeatedly on the same context lines multiple times).
What am I doing absolutely wrong here? This must not be the advertised to be super-easy MR workflow :D I am trying to get this one line composer.json change to rebase on top of the current 8.x-3.x.
Comment #15
mglaman@Gábor Hojtsy I skipped the rebase fanciness and just made a new branch for the change
Comment #16
mglamanWe probably should add some kind of test in upgrade_status, maybe?
Comment #17
andypostIt just need to change to 4 failures I guess
Comment #18
gábor hojtsyCould be that fails are related to #3224167: Parameter excludes_analyse is deprecated. I committed that now. How do I send this MR to retest?
Comment #19
gábor hojtsyI did not find a way to send the MR to retest, so going to post the change in a patch.
Comment #20
gábor hojtsyBeginning of a test.
Comment #22
gábor hojtsyFurther fixing of the tests.
Comment #24
gábor hojtsyContrib item shows up first alphabetically and now they have the same amount of problems.
Comment #26
gábor hojtsy0 based indexing.
Comment #28
gábor hojtsyOf course its a warning, not an error because there is no version number involved.
Comment #30
gábor hojtsyMissed one spot.
Comment #32
gábor hojtsyIn #3224393: Parameters excludes_analyse and excludePaths cannot be used at the same time, @Eric_A noted another reason to update to
mglaman/phpstan-drupal: ^0.12.11. Closed that as a duplicate, even though the reason is not the same, the patch would be the same as the first hunk here. Transporting the credits here.Comment #34
gábor hojtsyThanks all!
Comment #35
mglamanWoo!