Use modern PHP syntax and features in all new code

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.2.x. If you need support for phpBB 3.2.x please visit the 3.2.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply

This is a great idea

I agree and it should apply to new commits to master
22
100%
I agree but I have an actual reservation that I'm going to describe
0
No votes
 
Total votes: 22

User avatar
JoshyPHP
Registered User
Posts: 367
Joined: Fri Jul 08, 2011 9:43 pm

Use modern PHP syntax and features in all new code

Post by JoshyPHP »

Now that phpBB requires a contemporary version of PHP, I suggest that the coding guidelines be updated to take advantage of it.

For instance, if that's not already the case, all new code should use the short array syntax.

All new code should use scalar typing where available and return typing too. Possibly with strict_types if possible. Again, this is for new files, new classes and new interfaces so backward compatibility is not a big concern.

mcordingley
Registered User
Posts: 1
Joined: Thu Aug 15, 2019 6:18 pm

Re: Use modern PHP syntax and features in all new code

Post by mcordingley »

I'm finding the lack of auto-loading to be surprising. Is there any reason --other than historical-- that the project doesn't use e.g. PSR-4 autoloads?

User avatar
JoshyPHP
Registered User
Posts: 367
Joined: Fri Jul 08, 2011 9:43 pm

Re: Use modern PHP syntax and features in all new code

Post by JoshyPHP »

phpBB already uses autoloading, just not for everything. There's a couple dozen of old files that need to be loaded manually, most of them are in common.php anyway.

Post Reply