Skip to content

Conversation

@skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented May 26, 2023

nextcloud/spreed#9629 (comment)
https://getcomposer.org/doc/articles/autoloader-optimization.md

Optimization Level 2/A: Authoritative class maps

How to run it?

There are a few options to enable this:

  • Set "classmap-authoritative": true inside the config key of composer.json
  • Call install or update with -a / --classmap-authoritative
  • Call dump-autoload with -a / --classmap-authoritative

What does it do?

Enabling this automatically enables Level 1 class map optimizations.

This option says that if something is not found in the classmap, then it does not exist and the autoloader should not attempt to look on the filesystem according to PSR-4 rules.

Trade-offs

This option makes the autoloader always return very quickly. On the flipside it also means that in case a class is generated at runtime for some reason, it will not be allowed to be autoloaded. If your project or any of your dependencies does that then you might experience "class not found" issues in production. Enable this with care.

Note: This cannot be combined with Level 2/B optimizations. You have to choose one as they address the same issue in different ways.

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
@skjnldsv
Copy link
Member Author

  • Set "classmap-authoritative": true inside the config key of composer.json

Seeing this, we can also go for that option and let devs handle this on a case-by-case basis

@ChristophWurst
Copy link
Member

Authoritative autoloaders lead to nextcloud/calendar#5191 for app store apps

@skjnldsv
Copy link
Member Author

Authoritative autoloaders lead to nextcloud/calendar#5191 for app store apps

Talk is using those 🤷
I'm just following the track from nextcloud/spreed#9629 (comment)

I have zero knowledge on this :/

@nickvergessen
Copy link
Member

I have zero knowledge on this :/

Same here, just approved the PR coming from christoph back then :P

@skjnldsv
Copy link
Member Author

You're our lord and saviour @ChristophWurst 😁
What do we do then 🙈

@skjnldsv
Copy link
Member Author

  • Set "classmap-authoritative": true inside the config key of composer.json

Seeing this, we can also go for that option and let devs handle this on a case-by-case basis

Maybe this is the way ?
Not touch the workflows but the composer configs ?

@skjnldsv
Copy link
Member Author

skjnldsv commented Jun 6, 2023

Closing then.

@nickvergessen please remove that line from the workflow and move that to the composer.json as a config key :)

@skjnldsv skjnldsv closed this Jun 6, 2023
@skjnldsv skjnldsv added invalid This doesn't seem right and removed 3. to review Waiting for reviews labels Jun 6, 2023
@skjnldsv skjnldsv deleted the fix/classmap-authori branch June 6, 2023 07:28
@ChristophWurst
Copy link
Member

What do we do then see_no_evil

do not follow my lead blindly nextcloud/documentation#10578

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants