magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

PSR, Namespaces and PHP5.3

Open Faryshta opened this issue 13 years ago • 10 comments

Hi I realiced that you require php5.3 for this version of magento

i also realized that you want to use dinamic loading classes but you don't use namespaces on any of them.

You try to use the PSR specification for php 5.2 but you don't support it anymore so I think the best is to start implementing namespaces.

Do you plan to implement namespaces since you require php5.3 for this version of magento?

Faryshta avatar Aug 04 '13 10:08 Faryshta

I see into autoloader core and see that it contains this code:

if (strpos($class, self::NS_SEPARATOR) !== false) {
    $class = ltrim(str_replace(self::NS_SEPARATOR, '_', $class), '_');
}

https://github.com/magento/magento2/blob/master/lib/Magento/Autoload/IncludePath.php#L54-L56

So I think you can use namespaces in your code.

ihor-sviziev avatar Aug 05 '13 08:08 ihor-sviziev

Yes I can use namespaces on my code but I meant to add namespaces to magento2.

Also if I relly on magento autoloader that means I must set all my classes on the same folder. Not separated form third party libraries and my libraries for example

Faryshta avatar Aug 05 '13 08:08 Faryshta

I think we need answer from @mage2-team for that.

ihor-sviziev avatar Aug 05 '13 08:08 ihor-sviziev

I can confirm that Magento 2 will be PSR-0, 1 and 2 compliant (which implies that formal namespaces will be used). Minimum supported PHP version will be 5.4.

We are working on both tasks at this moment and should be able to roll out updates soon.

antonmakarenko avatar Aug 15 '13 18:08 antonmakarenko

Thats wonderful. Can I help?

Is there a PSR branch I can send commits?

Faryshta avatar Aug 15 '13 18:08 Faryshta

@Faryshta

We don't have a mechanism of exposing all dev branches yet, but you can help by forking what you see on the GitHub and submitting pull request.

antonmakarenko avatar Aug 19 '13 15:08 antonmakarenko

Why don't you just use GitHub as your developing platform for Magento 2?

FiveDigital avatar Aug 23 '13 09:08 FiveDigital

@FiveDigital Primarily because we are yet to figure out how to segregate community edition code base in the most efficient way. That is, the code base for other product editions has different publishing strategy.

antonmakarenko avatar Aug 24 '13 06:08 antonmakarenko

I agree, why don't you use Github for your dev platform? I mean since it's opensource wouldn't it help if you took community contributions?

gfxguru avatar Oct 07 '13 12:10 gfxguru

The source is open, the development process is not, and that is eBay's prerogative. I cannot imagine trying to build out the platform and the application features by committee. eBay is taking feedback, issues, PRs, etc. via this channel though:

"issues & pull requests will be reviewed and answered." - Elena Leonova, Magento Product Manager

benmarks avatar Oct 07 '13 12:10 benmarks