PHP code example of kubawerlos / php-cs-fixer-custom-fixers
1. Go to this page and download the library: Download kubawerlos/php-cs-fixer-custom-fixers 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/ */
kubawerlos / php-cs-fixer-custom-fixers example snippets
diff
class Foo {
public function __construct(
$param1,
$param2
- ) {
- }
+ ) {}
}
diff
class FooTest extends TestCase {
/**
- * @dataProvider dataProvider
+ * @dataProvider provideSomethingCases
*/
public function testSomething($expected, $actual) {}
- public function dataProvider() {}
+ public function provideSomethingCases() {}
}
diff
class FooTest extends TestCase {
/**
* @dataProvider provideSomethingCases
*/
public function testSomething($expected, $actual) {}
- public function provideSomethingCases(): array {}
+ public function provideSomethingCases(): iterable {}
}
diff
class Foo {
- public function __construct(private array $a, private bool $b, private int $i) {}
+ public function __construct(
+ private array $a,
+ private bool $b,
+ private int $i
+ ) {}
}
diff
-//var_dump($_POST);
print_r($_POST);
diff
namespace Migrations;
use Doctrine\DBAL\Schema\Schema;
-/**
- * Auto-generated Migration: Please modify to your needs!
- */
final class Version20180609123456 extends AbstractMigration
{
public function up(Schema $schema)
{
- // this up() migration is auto-generated, please modify it to your needs
$this->addSql("UPDATE t1 SET col1 = col1 + 1");
}
public function down(Schema $schema)
{
- // this down() migration is auto-generated, please modify it to your needs
$this->addSql("UPDATE t1 SET col1 = col1 - 1");
}
}
diff
namespace Foo;
-use DateTime;
class Bar {
- public function __construct(DateTime $dateTime) {}
+ public function __construct(\DateTime $dateTime) {}
}
diff
-$x = new \Foo();
+$x = new Foo();
namespace Bar;
$y = new \Baz();