Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propose errata for anonymous classes #1206

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions accepted/PSR-12-extended-coding-style-guide-meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,7 @@ _**Note:** Order descending chronologically._

* [Inspiration Mailing List Thread](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/php-fig/wh9avopSR9k)
* [Initial Mailing List PSR Proposal Thread](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/php-fig/MkFacLdfGso)

# 9. Errata and clarifications

* The code example for anonymous classes was fixed (see [#1206](https://github.com/php-fig/fig-standards/pull/1206)) because it contradicted the actual rule: omitting parentheses after the `class` keyword when creating a new instance is not allowed, as prescribed for normal classes.
6 changes: 3 additions & 3 deletions accepted/PSR-12-extended-coding-style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ in the above section.
~~~php
<?php

$instance = new class {};
$instance = new class() {};
~~~

The opening brace MAY be on the same line as the `class` keyword so long as
Expand All @@ -1062,12 +1062,12 @@ interface.
<?php

// Brace on the same line
$instance = new class extends \Foo implements \HandleableInterface {
$instance = new class() extends \Foo implements \HandleableInterface {
// Class content
};

// Brace on the next line
$instance = new class extends \Foo implements
$instance = new class() extends \Foo implements
\ArrayAccess,
\Countable,
\Serializable
Expand Down