PHP code example of taptima / php-cs-fixer
1. Go to this page and download the library: Download taptima/php-cs-fixer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
taptima / php-cs-fixer example snippets
// .php-cs-fixer.php
$config = PhpCsFixer\Config::create()
// ...
->registerCustomFixers(new Taptima\CS\Fixers())
// ...
;
return $config;
// .php-cs-fixer.php
$config = PhpCsFixer\Config::create()
->setRules(
Taptima\CS\RuleSetFactory::create([
'@Taptima' => true,
// other rules
])
->taptima()
->getRules()
)
->registerCustomFixers(
new Taptima\CS\Fixers()
)
return $config;
// .php-cs-fixer.php
$config = PhpCsFixer\Config::create()
// ...
->setRules([
// ...
'Taptima/doctrine_migrations' => true,
// ...
])
// ...
->registerCustomFixers(new Taptima\CS\Fixers())
;
return $config;
// .php-cs-fixer.php.dist
$config = PhpCsFixer\Config::create()
// ...
->setRules(Taptima\CS\RuleSetFactory::create()
->enable('Taptima/doctrine_migrations')
->getRules()
])
// ...
->registerCustomFixers(new Taptima\CS\Fixers())
;
return $config;
// .php-cs-fixer.php
$config = PhpCsFixer\Config::create()
// ...
->setRules([
// ...
'Taptima/doctrine_migrations' => [ 'instanceof' => [ 'Doctrine\Migrations\AbstractMigration' ] ],
// ...
])
// ...
->registerCustomFixers(new Taptima\CS\Fixers())
;
return $config;
// .php-cs-fixer.php.dist
$config = PhpCsFixer\Config::create()
// ...
->setRules(Taptima\CS\RuleSetFactory::create()
->enable('Taptima/doctrine_migrations', [ 'instanceof' => [ 'Doctrine\Migrations\AbstractMigration' ] ])
->getRules()
])
// ...
->registerCustomFixers(new Taptima\CS\Fixers())
;
return $config;
// .php-cs-fixer.php
$config = PhpCsFixer\Config::create()
// ...
->setRules([
// ...
'Taptima/ordered_setters_and_getters' => true,
// ...
])
// ...
->registerCustomFixers(new Taptima\CS\Fixers())
;
return $config;
// .php-cs-fixer.php.dist
$config = PhpCsFixer\Config::create()
// ...
->setRules(Taptima\CS\RuleSetFactory::create()
->enable('Taptima/ordered_setters_and_getters')
->getRules()
])
// ...
->registerCustomFixers(new Taptima\CS\Fixers())
;
return $config;
diff
--- Original // 80 chars
+++ New //
@@ @@ //
use Doctrine\DBAL\Schema\Schema; //
use Doctrine\Migrations\AbstractMigration; //
//
-/** //
- * Auto-generated Migration: Please modify to your needs! //
- */ //
final class Version20190323095102 extends AbstractMigration //
{ //
- public function getDescription() //
- { //
- return ''; //
- } //
//
public function up(Schema $schema) //
{ //
- // this up() migration is auto-generated, please modify it to your needs//
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
//
$this->addSql('CREATE TABLE admin (identifier CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', PRIMARY KEY(identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
@@ @@ //
//
public function down(Schema $schema) //
{ //
- // this down() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
//
$this->addSql('DROP TABLE admin'); //
} //
} //
//
diff
--- Original // 80 chars
+++ New //
@@ @@ //
use Doctrine\DBAL\Schema\Schema; //
use Doctrine\Migrations\AbstractMigration; //
//
-/** //
- * Auto-generated Migration: Please modify to your needs! //
- */ //
final class Version20190323095102 extends AbstractMigration //
{ //
- public function getDescription() //
- { //
- return ''; //
- } //
//
public function up(Schema $schema) //
{ //
- // this up() migration is auto-generated, please modify it to your needs//
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
//
$this->addSql('CREATE TABLE admin (identifier CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', PRIMARY KEY(identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
@@ @@ //
//
public function down(Schema $schema) //
{ //
- // this down() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
//
$this->addSql('DROP TABLE admin'); //
} //
} //
//
diff
--- Original // 80 chars
+++ New //
@@ @@ //
$this->firstName = $firstName; //
} //
//
- public function setName($name) //
+ public function getFirstName() //
{ //
- $this->name = $name; //
+ return $this->firstName; //
} //
//
- public function isEnabled() //
+ public function setName($name) //
{ //
- return $this->enabled; //
+ $this->name = $name; //
} //
//
public function getName() //
@@ @@ //
return $this->name; //
} //
//
- public function getIdentifier() //
+ public function isEnabled() //
{ //
- return $this->identifier; //
+ return $this->enabled; //
} //
//
- public function getFirstName() //
+ public function getIdentifier() //
{ //
- return $this->firstName; //
+ return $this->identifier; //
} //
//
public function enable() //
@@ @@ //
} //
//
/** //
- * @return Item //
- */ //
- public function getItems() //
- { //
- return $this->items; //
- } //
- //
- /** //
* @param Item $item //
* @return User //
*/ //
@@ @@ //
$this->items->removeElement($item); //
//
return $this; //
+ } //
+ //
+ /** //
+ * @return Item //
+ */ //
+ public function getItems() //
+ { //
+ return $this->items; //
} //
} //
//