Follow-up #2385429: setExecutableManager() is implemented on the wrong class

\Drupal\Core\Condition\ConditionPluginBase::setExecutableManager() accepts \Drupal\Core\Executable\ExecutableManagerInterface but protected variable defined as \Drupal\Core\Executable\ExecutableInterface

Also as manager fails to execute it throws ExecutableException which is not documented in ExecutableInterface

CommentFileSizeAuthor
#8 2996431.patch614 bytesghost of drupal past
#2 2996431-2.patch1022 bytesandypost

Comments

andypost created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
StatusFileSize
new1022 bytes
xano’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

+++ b/core/lib/Drupal/Core/Executable/ExecutableInterface.php
@@ -11,6 +11,9 @@
+   * @throws \Drupal\Core\Executable\ExecutableException

For reference: this mirrors ExecutableManagerInterface::execute().

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/lib/Drupal/Core/Executable/ExecutableInterface.php
@@ -11,6 +11,9 @@
+   * @throws \Drupal\Core\Executable\ExecutableException
+   *   If the plugin could not be executed.

I find this all very confusing looking at \Drupal\Core\Condition\ConditionManager::execute() since that calls ->evaluate() and there are no usages of ExecutableException in core.

I'm tempted to mark this as a duplicate of #2385427: Add a ConditionManagerInterface because that issue should really be updating \Drupal\Core\Condition\ConditionPluginBase::setExecutableManager() to typehint on the new ConditionManagerInterface.

andypost’s picture

hm, good idea - could be incorporated into related
But actually execute() should allow throwing exception

xano’s picture

I'm tempted to mark this as a duplicate of #2385427: Add a ConditionManagerInterface because that issue should really be updating \Drupal\Core\Condition\ConditionPluginBase::setExecutableManager() to typehint on the new ConditionManagerInterface.

In #2385427-29: Add a ConditionManagerInterface you observed changing the type hint in BlockForm would be a BC break. That class is explicitly marked internal, and if I understand our BC policy correctly, plugin classes are internal as well. Could you help me understand the difference between both cases? :)

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ghost of drupal past’s picture

StatusFileSize
new614 bytes

Here's the absolute minimum for this issue, together with #3065586: ConditionManager::execute() implementation doesn't conform to the interface it would make it much easier to understand the code flow of the condition plugins.

ghost of drupal past’s picture

Status: Needs work » Needs review
alexpott’s picture

#8 looks great - if someone could rtbc it then I'd commit it.

bircher’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 7daf1e6988 to 8.8.x and 82731b8283 to 8.7.x. Thanks!

Backported as this is a docs only change.

  • alexpott committed 82731b8 on 8.7.x
    Issue #2996431 by andypost, Charlie ChX Negyesi, Xano: Fix docs for...

  • alexpott committed 7daf1e6 on 8.8.x
    Issue #2996431 by andypost, Charlie ChX Negyesi, Xano: Fix docs for...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.