per-coding-style icon indicating copy to clipboard operation
per-coding-style copied to clipboard

The Road to 2.1

Open Crell opened this issue 1 year ago • 3 comments

A new PHP release is coming soon, so it's time to get down and catch up on PER-CS! My expectation is that the next release will be 2.1, not 3.0 (though discussion may shift that).

This is a meta issue to track outstanding tasks for 2.1. We can release 2.1 when everything below has been completed, rejected, or postponed.

Please do NOT discuss details of any of these issues on this thread. Discuss them in their own threads. Only comment here with items that should be added to the consideration list.

New language functionality

  • [ ] #88
  • [ ] #89
  • [x] #96
  • [ ] #99

Existing clarifications

  • [ ] #100
  • [ ] #102

Proposals

(That something is listed here doesn't mean it will be included, just that we should make a decision on it one way or another before release.)

  • [ ] #94
  • [ ] #92
  • [ ] #85

Crell avatar Sep 03 '24 22:09 Crell

The full list of implemented RFCs for 8.4 is here: https://wiki.php.net/rfc#php_84

I don't think anything other than the items above warrant our attention. If you disagree, suggest something.

Crell avatar Sep 03 '24 22:09 Crell

I don't think anything other than the items above warrant our attention. If you disagree, suggest something.

Looking at https://wiki.php.net/rfc/exit-as-function, it might make sense to recommend always using exit(); with parentheses.

If tools would automatically rewrite this, then code like: https://3v4l.org/KnX6u would not be confusing any more:

<?php

function test(string $param) {
    var_dump($param);
}

define('exit', 'xxx');

test(exit);

TimWolla avatar Sep 04 '24 06:09 TimWolla

Edited to add #98

KorvinSzanto avatar Sep 11 '24 16:09 KorvinSzanto

@TimWolla Who in their right mind would write code like that???

If you want to make a PR that requires that, go ahead. I'm not opposed.

Crell avatar Jan 03 '25 23:01 Crell

If you want to make a PR that requires that, go ahead. I'm not opposed.

#109. I have chosen a slightly more reasonably example of how exit() could appear in an expression, where the parenthesis-less form would be confusing.


As an aside: Writing that made me wonder if the coding style should have an opinion about the use of function aliases, e.g. join, sizeof, die. Except possibly for die they are almost never used and if they are, they can be confusing.

TimWolla avatar Jan 04 '25 15:01 TimWolla