- Issue created by @joachim
- First commit to issue fork.
- ๐ฎ๐ณIndia Sandeep SanwaleSandeep Sanwale โ made their first commit to this issueโs fork. 
- Merge request !7820Issue #3441295: AttributeClassDiscovery should throw an exception if it finds... โ (Open) created by adwivedi008
- Status changed to RTBCover 1 year ago 6:34am 29 April 2024
- ๐ฎ๐ณIndia Sandeep Sanwaleupdated the docblock for InvalidPluginDefinitionException . 
- Status changed to Needs workover 1 year ago 7:39am 29 April 2024
- ๐ฌ๐งUnited Kingdom alexpott ๐ช๐บ๐What is the impact of having more than one attribute? What actually breaks? 
- ๐ฌ๐งUnited Kingdom joachim> What is the impact of having more than one attribute? What actually breaks? Nothing breaks, but only the first attribute is read: if ($attributes = $reflection_class->getAttributes($this->pluginDefinitionAttributeName, \ReflectionAttribute::IS_INSTANCEOF)) { /** @var \Drupal\Component\Plugin\Attribute\AttributeInterface $attribute */ $attribute = $attributes[0]->newInstance();This change is just for DX, so developers understand why the code they've added does nothing. 
- ๐บ๐ธUnited States xjmThis is also failing static analysis: ------ ------------------------------------------------------------------------ Line core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php ------ ------------------------------------------------------------------------ 131 Instantiated class Drupal\Component\Plugin\Discovery\InvalidPluginDefinitionException not found. ๐ก Learn more at https://phpstan.org/user-guide/discovering-symbols ------ ------------------------------------------------------------------------
- ๐ฌ๐งUnited Kingdom joachimFixed the missing class. Not sure what to do about tests, as the current MR is actually causing AttributeClassDiscoveryTest::testGetDefinitions() to fail, because it's doing **PRECISELY** what this MR sets out to prevent from happening! The problem is that we have: class CustomPlugin extends Plugin {and #[Plugin( id: "discovery_test_1", )] #[CustomPlugin( id: "discovery_test_1", title: "Discovery test plugin" )] class AttributeDiscoveryTest1 {}Some git digging is required to understand what that test is trying to test and why it was set up that way. Is it specifically trying to test a class with two different attributes (and why??)? Or was that just a space-saving shortcut which we can change?