Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPES-1546: Allow to configure user conditions for 2FA #203

Open
wants to merge 6 commits into
base: contribution/OPES-1515-2fa-conditions
Choose a base branch
from

Conversation

brummbar
Copy link
Contributor

@brummbar brummbar commented Feb 7, 2025

Fixes #202 .

Copy link
Contributor

@AaronGilMartinez AaronGilMartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one little remark

*/
protected static $modules = [
'oe_authentication_test',
'user',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need of user module

/**
* The condition manager.
*
* @var \Drupal\Core\Executable\ExecutableManagerInterface&\Drupal\Core\Plugin\FilteredPluginManagerInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to fix here just an observation, it seems a bit odd the full namespaced classes with intersection types, extremely long.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ye I know but there's a bit of a mess with the ConditionManager. There's no real interface that includes all the methods of the above.
But in truth, now that I think of it, we only need the method provided by FilteredPluginManagerInterface. I will drop it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe @donquixote has an opinion on this?

Copy link

@donquixote donquixote Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I see two separate questions here.

  1. Code style and verbosity for union or instersection types in doc comments.
  2. Whether we need this intersection type or can go with a single interface.
  3. (not mentioned in your comments) Whether we can drop a @var doc type if it only repeats the native property type.

For 1. - FQCN or alias

I see plenty examples of union types (|) in core which use full FQCN.

We could come up with a OpenEuropa rule to use aliases for union and intersection types.

The main problem with alias in doc comment is that either we would sometimes add an alias only for the use in doc comments, or we have to make the doc comment conditional on whether the alias is already there for other reasons.

So for the sake of not losing sleep and time we should just put the FQCN.
(In my own side projects I have a mix of FQCN and alias, but this should not be relevant here)

For 2. - all parts of intersection type needed?

In general we should document those interfaces that are needed where we use the object.
The doc type also has informational value, but this is mostly covered by the doc description.
In core I see a mix, where ExecutableManagerInterface is used in php param type, but at least in one place ConditionManager (class) is used in the property @var doc.

There is this issue in core, 2385427: Add a ConditionManagerInterface
which is open since a while.

For 3. - Can we drop @var doc?

On the doc standards page we find

Typed class properties may omit the @var declaration. It is recommended to use typed properties whenever possible.

Seems it was introduced here: 3238192: Allow omitting @var for strictly typed class properties

Also interesting: 3376518: Allow omitting @var, @param and @return tags or their descriptions if the variable name and type is enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants