diff --git a/.php_cs b/.php_cs index ad3e2f7..64eeba8 100644 --- a/.php_cs +++ b/.php_cs @@ -12,9 +12,13 @@ return PhpCsFixer\Config::create() '@PSR2' => true, '@Symfony' => true, 'array_syntax' => array('syntax' => 'long'), - 'phpdoc_order' => true, - 'no_trailing_whitespace' => true, 'concat_space' => array('spacing' => 'one'), + 'ordered_imports' => true, + 'no_trailing_whitespace' => true, + 'no_useless_return' => true, + 'no_useless_else' => true, + 'phpdoc_add_missing_param_annotation' => true, + 'phpdoc_order' => true, )) ->setFinder($finder) ; diff --git a/.travis.yml b/.travis.yml index a6ca186..e361dbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,13 +13,16 @@ matrix: fast_finish: true allow_failures: - php: "nightly" - exclude: - - php: "hhvm" + include: + - php: "5.6" + env: DBASE=yes + - php: "7.0" + env: DBASE=yes + - php: "7.1" env: DBASE=yes env: matrix: - - DBASE=yes - DBASE=no install: diff --git a/CHANGELOG.md b/CHANGELOG.md index e32863d..c572456 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## [2.1] - 2017-05-15 + +* Documentation improvements. + ## [2.0] - 2017-01-23 * Switched to PhpMyAdmin vendor namespace to follow PSR-4. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d5d8705 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,42 @@ +# Contributing to shapefile + +## Reporting issues + +Our issue tracker is hosted at GitHub: + +https://github.com/phpmyadmin/shapefile/issues + +Please search for existing issues before reporting new ones. + +## Working with Git checkout + +The dependencies are managed by Composer, to get them all installed (or update +on consequent runs) do: + +``` +composer update +``` + +## Submitting patches + +Please submit your patches using GitHub pull requests, this allows us to review +them and to run automated tests on the code. + +## Coding standards + +We do follow PSR-1 and PSR-2 coding standards. + +You can use php-cs-fixer to fix the code to match our expectations: + +``` +php-cs-fixer fix . +``` + +## Testsuite + +Our code comes with quite comprehensive testsuite, it is automatically executed +on every commit and pull request, you can also run it locally: + +``` +./vendor/bin/phpunit -c phpunit.xml +``` diff --git a/README.md b/README.md index 3891518..3e0bf23 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ The API documentation is available at To read shape file: ```php -$shp = new ShapeFile\ShapeFile(0); +$shp = new \PhpMyAdmin\ShapeFile\ShapeFile(0); $shp->loadFromFile('path/file.*'); ``` diff --git a/composer.json b/composer.json index f8b5ade..b4968ec 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "ext-dbase": "For dbf files parsing" }, "require-dev": { - "phpunit/phpunit": "~5.2 || ~4.8" + "phpunit/php-code-coverage": "*", + "phpunit/phpunit": "~4.8 || ~5.7" }, "autoload": { "psr-4": { diff --git a/src/ShapeFile.php b/src/ShapeFile.php index 7d51686..5995a82 100644 --- a/src/ShapeFile.php +++ b/src/ShapeFile.php @@ -56,7 +56,9 @@ public static function supports_dbase() } /** - * @param int $shapeType + * @param int $shapeType File shape type, should be same as all records + * @param array $boundingBox File bounding box + * @param null|mixed $FileName File name */ public function __construct($shapeType, $boundingBox = array('xmin' => 0.0, 'ymin' => 0.0, 'xmax' => 0.0, 'ymax' => 0.0), $FileName = null) { @@ -98,9 +100,9 @@ public function loadFromFile($FileName) $this->_closeDBFFile(); return true; - } else { - return false; } + + return false; } /** @@ -633,7 +635,7 @@ public function getShapeName() /** * Check whether file contains measure data. * - * For some reason this is distinguished by zero bouding box in the + * For some reason this is distinguished by zero bounding box in the * specification. * * @return bool diff --git a/src/Util.php b/src/Util.php index 12cf811..f4e2878 100644 --- a/src/Util.php +++ b/src/Util.php @@ -95,9 +95,9 @@ public static function packDouble($value) if (self::$little_endian) { return $bin; - } else { - return self::swap($bin); } + + return self::swap($bin); } /**