Skip to content

PSR-4 for apps - #24386

Merged
MorrisJobke merged 3 commits into
masterfrom
psr4-for-apps
May 3, 2016
Merged

MorrisJobke merged 3 commits into
masterfrom
psr4-for-apps

Conversation

@nickvergessen

@nickvergessen nickvergessen commented May 2, 2016 •

Copy link
Copy Markdown
Contributor

Sample PR on an app: owncloud/announcementcenter#73

@DeepDiver1975 @rullzer @MorrisJobke

The following directories remain unchanged, since they should not contain namespaces classes and have hardcoded usage. Otherwise we would always need to check two directories:

  • appinfo/
  • css/
  • img/
  • js/
  • l10n/
  • templates/

@nickvergessen nickvergessen added this to the 9.1-current milestone May 2, 2016
Comment thread lib/private/Route/Router.php Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is required, because appinfo/ remains lowercase and therefor the class can not be PSR-4 loaded

@nickvergessen nickvergessen mentioned this pull request May 2, 2016
1 task done
@rullzer

rullzer commented May 2, 2016

Copy link
Copy Markdown
Contributor

Awesome stuff!

Would it make sense to have all the php files in a src dir? Just so we don't mix CamelCase and lower case in the root app folder?

@nickvergessen

Copy link
Copy Markdown
Contributor Author

Done, also solves the hacky problemwith duplicated appinfo/.

*/
protected static function registerAutoloading($app, $path) {
// Register on PSR-4 composer autoloader
$appNamespace = \OC\AppFramework\App::buildAppNamespace($app);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

so we move everything in a subfolder called src? Fine with me, but want to point this out.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also good to document this ;)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like it 👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

as explained below - let's name it lib

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I will drop an explanation mail as a response on @rullzer s mail to the mailing list once this is merged.

@rullzer

rullzer commented May 2, 2016

Copy link
Copy Markdown
Contributor

Looks good and looks clean!
I'll tests later more!

But awesome! 🎈

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Would it make sense to have all the php files in a src dir? Just so we don't mix CamelCase and lower case in the root app folder?

Originally we had all php files living in the subfolder lib - this is also reflected in the old class loader.
Over the past years this was a bit relaxed because it simply worked to load classes from various folders.
We should revive this from my pov - all php file should live in one place

@MorrisJobke

Copy link
Copy Markdown
Contributor

We should revive this from my pov - all php file should live in one place

It will with this PR live in src. Only there the PSR-4 autoloader will work :)

@DeepDiver1975

Copy link
Copy Markdown
Contributor

It will with this PR live in src. Only there the PSR-4 autoloader will work :)

And I say: let's name it lib because this is where all php files should live anyhow

@nickvergessen

Copy link
Copy Markdown
Contributor Author

Switched to lib/ and adjusted the app as well

@rullzer

rullzer commented May 2, 2016

Copy link
Copy Markdown
Contributor

Tested (with the apps @nickvergessen already moved) and works like a charm!

I agree we should add this to the docs and send to the ML. But very nice and cool stuff! 👍

@MorrisJobke

Copy link
Copy Markdown
Contributor

Tested and works like a charm with old and new apps 👍

@MorrisJobke
MorrisJobke merged commit a72e6a2 into master May 3, 2016
@MorrisJobke
MorrisJobke deleted the psr4-for-apps branch May 3, 2016 06:24
@lock

lock Bot commented Aug 6, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants