-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
There are some errors while using anonymous classes in PHP7, for eg.:
<?php
namespace Brzuchal;
use ArrayObject;
class Base
{
protected $anonymous;
public function __construct()
{
$this->anonymous = new class extends ArrayObject
{
public function __construct()
{
parent::__construct(['a' => 1, 'b' => 2]);
}
};
}
}When running phpspec --standard=PSR2 it outputs some ERROR, like:
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
12 | ERROR | Class name "extends" is not in camel caps format
18 | ERROR | Closing class brace must be on a line by itself
----------------------------------------------------------------------
And when add parenthesis after class, like new class() extends ArrayObject there is different ERROR on method indentation, like:
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
14 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found
| | 12
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------