Add internal, event, and property to the list of ignored annotations in the plugin annotation system

Created on 25 August 2015, almost 9 years ago
Updated 7 February 2023, over 1 year ago

Problem/Motivation

The original reason for the issue (see below) was fixed in #2631202: Doctrine no longer supports SimpleAnnotationReader, incorporate a solution into core β†’ . However, Chi pointed out in #46 πŸ› Add internal, event, and property to the list of ignored annotations in the plugin annotation system Closed: won't fix that two annotations, internal and property, are still discovered. Those need to be fixed.

--- original problem/motivation ---
Add a class loader like this:

spl_autoload_register( function ($class_name) {
  file_put_contents(__DIR__ . '/classes.txt', $class_name . "\n", FILE_APPEND);
  },
  FALSE, TRUE);

It generates a classes.txt file.

Look at that file like this:

sort classes.txt | uniq -c

You'll see stuff like this:

   2 Drupal\Core\Annotation\PluginID
   3 Drupal\Core\Annotation\Translation
   5 Drupal\Core\Annotation\code
   3 Drupal\Core\Annotation\end
   3 Drupal\Core\Annotation\end_code
   5 Drupal\Core\Annotation\endcode
  25 Drupal\Core\Annotation\ingroup
   1 Drupal\Core\Annotation\property
  11 Drupal\Core\Annotation\see
   2 Drupal\Core\Annotation\todo

This means that the classloader is being asked to autoload, for instance, Drupal\Core\Annotation\ingroup 25 times in a front page load.

That's because the annotation system isn't filtering out known-bad annotations.

At absolute best this means that the autoloader has to waste time dealing with this stuff, and at worst has to do a file_exists() for each of these requests.

Proposed resolution

Add internal, property and event to the list of ignored annotations.

Remaining tasks

Review
Commit

User interface changes

N/A

API changes

N/A

Data model changes

N/A

πŸ› Bug report
Status

Closed: won't fix

Version

10.1 ✨

Component
PluginΒ  β†’

Last updated 9 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States Mile23 Seattle, WA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024