This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
bcmath_compatは、PHP 8.1+向けのbcmath拡張機能のポリフィルライブラリです。bcmath拡張機能がインストールされていない環境でも、bcmath関数を使用できるようにします。
# 全テストを実行
composer test
# または
vendor/bin/phpunit
# 特定のテストを実行
vendor/bin/phpunit tests/BCMathTest.php# スタイルチェック
composer check-style
# または
vendor/bin/phpcs src tests
# スタイル自動修正
composer fix-style
# または
vendor/bin/phpcbf src testscomposer install-
lib/bcmath.php: bcmath関数のポリフィル実装。各bcmath関数(bcadd、bcmul等)をBCMathクラスのメソッドにデリゲートする。
-
src/BCMath.php: phpseclib3のBigIntegerクラスを使用してbcmath関数の実際の計算ロジックを実装。スケール(小数点以下の桁数)の管理も行う。
-
tests/BCMathTest.php: 各bcmath関数の動作を検証するユニットテスト。
- phpseclib/phpseclib: 任意精度演算のためのBigIntegerクラスを提供
- PHPUnit: テストフレームワーク(開発時のみ)
- PHP_CodeSniffer: コードスタイルチェック(開発時のみ)
- bcscale()関数の実装はPHP 7.3+の動作に準拠
- エラーハンドリングはPHPバージョンに応じて適切なエラークラス(Error、ArithmeticError、DivisionByZeroError等)を使用
- PSR-2コーディング標準に準拠
- Pull Request がマージされたら関連する issues を更新してください