PHP

Upgrade

November 28, 2022
PHP, Rector, Laravel, Upgrade, Refactoring

PHP Upgrade # Supported Versions # https://www.php.net/supported-versions.php https://qiita.com/bezeklik/items/72d1ff8393f66673e2bc Rector # Overview # rectorphp/rector Rector instantly upgrades and refactors the PHP code of your application. Rules Overview Install # $ composer require rector/rector --dev $ composer install $ vendor/bin/rector init $ vi rector.php <?php declare(strict_types=1); // use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { // register paths to upgrade and refactor PHP code $rectorConfig->paths([ __DIR__ . ...

PHP Command Line Option

January 1, 2020
PHP, Command Line

PHP Command Line Option # option description -a --interactive 対話モードで実行 -h, -? --help,--usage コマンドラインオプションと1行の説明文を表示 -i --info phpinfo() をコールした結果を表示 -l --syntax-check 構文チェックを実行 -m --modules ロードされたZendモジュールの一覧を表示 -r --run コマンドラインのみで実行 -S --server ビルトインウェブサーバを開始 -s --syntax-highlight,--syntax-highlighting ハイライト表示されたソースを表示 -t --docroot ビルトインウェブサーバのドキュメントルートを指定 -v --version バージョン情報を表示 -w --strip コメントと空白文字を削除してソースを表示, -r との同時の使用は不可 References # https://qiita.com/akiko-pusu/items/93dc4cf63d23a1bb9bdb https://www.php.net/manual/ja/features.commandline.options.php

PHP Cron Expression

January 1, 2020
PHP, Cron Expression

PHP Cron Expression # Install # composer self-update --2 composer require dragonmantank/cron-expression composer update Example # <?php require_once 'vendor/autoload.php'; $schedule = '10 2 * * *'; $cron = new Cron\CronExpression($schedule); $dates = $cron->getMultipleRunDates(3); foreach ($dates as $date) { echo $date->format('Y-m-d H:i:s') . PHP_EOL; }

PHP

January 1, 2020
PHP

PHP # PHPUnit PHP Upgrade PhpMetrics PHP Command Line

PhpMetrics

January 1, 2020
PHP, PhpMetrics, Metrics

PhpMetrics # PhpMetrics とは # PHPプログラムの静的解析ツール 結果レポートをHTMLで出力 期待する効果 可読性・メンテナンス性・再利用性・テスト容易性の向上 バグ混入率の低下 解析時の評価指標 # 複雑度(循環的複雑度、経路複雑度) オブジェク指向(凝集度、結合度、抽象化) コード量 etc. インストール # $ composer require phpmetrics/phpmetrics --dev 使用方法 # $ php ./vendor/bin/phpmetrics --report-html=myreport.html /path/to/your/sources/ 参考 # https://phpmetrics.org/ https://github.com/phpmetrics/PhpMetrics