PHP-CS-Fixer: PHP.CS.Fixer not working
I’ve been trying to beautify codes with PHP.CS.Fixer tha are in Atom. I did run PHP.CS.Fixer in cmd but none of code that I want to fix has changed. When I run PHP.CS.Fixer in cmd the file ‘php-cs-fixer-v2.phar’ creates.
I insatlled PHP.CS.Fixer at https://github.com/FriendsOfPHP/PHP-CS-Fixer.
PHP: 7.1.2 PHP-CS-Fixer: 4.1.1 PHP-CS-Fixer Conf: I don’t know how to do it. ATOM: 1.29.0 Beautify: 0.32.5 Beautify Conf: I don’t know how to do it.
- before running PHP CS Fixer (no changes):
=><?php
$num = 10;
$dsn = 'mysql:host=localhost;dbname=bbs;charset=utf8';
$user = 'tennisuser';
$page = 0;
if (isset($_GET['page']) && $_GET['page'] > 0) {
$page = intval($_GET['page'])-1;
} try {
$db = new PDO($dsn, $user, $password);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$stmt = $db ->prepare("
SELECT * FROM bbs ORDER BY date DESC LIMIT :page, :num
");
$page = $page * $num;
$stmt->bindParam(':page', $page, PDO::PARAM_INT);
$stmt->bindParam(':num', $num, PDO::PARAM_INT);
$stmt ->execute();
} catch (PDOException $e) {
die('エラー:'.$e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>掲示板</title>
</head> <body>
<p><a href="index.php">トップページに戻る</a></p>
<form class="" action="write.html" method="post">
<p>名前:<input type="text" name="name"></p>
<p>タイトル:<input type="text" name="title"></p>
<textarea name="body"></textarea>
<p>削除パスワード(数字4文字):<input type="text" name="pass"></p>
<p><input type="submit" value="書き込む"></p>
</form></body>
</html>
This below is what I want.
<?php
$num = 10;
$dsn = 'mysql:host=localhost;dbname=bbs;charset=utf8';
$user = 'tennisuser';
$page = 0;
if (isset($_GET['page']) && $_GET['page'] > 0) {
$page = intval($_GET['page'])-1;
} try {
$db = new PDO($dsn, $user, $password);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$stmt = $db ->prepare("
SELECT * FROM bbs ORDER BY date DESC LIMIT :page, :num
");
$page = $page * $num;
$stmt->bindParam(':page', $page, PDO::PARAM_INT);
$stmt->bindParam(':num', $num, PDO::PARAM_INT);
$stmt ->execute();
} catch (PDOException $e) {
die('エラー:'.$e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>掲示板</title>
</head>
<body>
<p><a href="index.php">トップページに戻る</a></p>
<form class="" action="write.html" method="post">
<p>名前:<input type="text" name="name"></p>
<p>タイトル:<input type="text" name="title"></p>
<textarea name="body"></textarea>
<p>削除パスワード(数字4文字):<input type="text" name="pass"></p>
<p><input type="submit" value="書き込む"></p>
</form>
</body>
</html>
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 25 (13 by maintainers)
Sorry mate I have a job I have to do as well, I’ll reply to your email in depth tonight