I'm using nikic/PHP-Parser to parse/manipulate/print PHP code. However specific PrettyPrinters are not provided, and the default mangles the result on some points. Example:
EXPECTED
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}
ACTUAL
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name', 'email', 'password'];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
}
My question: Where can I find a basic PSR-2 extension of the Standard PrettyPrinter class to fix these (and other) issues?
I need to integrate it in my script so not really looking for a CLI like the mentioned https://github.com/FriendsOfPHP/PHP-CS-Fixer.
I did find this one which looks like a good start but its kind of old and I could not easily get that one to run.