diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..923432a5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,19 @@ +* text=auto + +/Examples export-ignore +/tests export-ignore +/.codeclimate.yml export-ignore +/.env.example export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php_cs export-ignore +/.php_cs.cache export-ignore +/.prettierrc export-ignore +/.scrutinizer.yml export-ignore +/Makefile export-ignore +/README.3.5.md export-ignore +/README.md export-ignore +/TODO export-ignore +/codeception.yml export-ignore +/composer.lock export-ignore +/jpgraph_logo.jpg export-ignore diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cd27a9c7..1a23cd81 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,9 +27,11 @@ jobs: run: | echo "::add-matcher::${{ runner.tool_cache }}/php.json" echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - name: Install PHP 7 dependencies + - name: Install PHP dependencies run: composer update --'prefer-stable' --no-interaction --no-progress - + + - name: PHPLint + run: composer lint - name: Unit Tests run: composer test \ No newline at end of file diff --git a/.php_cs.php b/.php_cs.php index 45369787..e0769a63 100644 --- a/.php_cs.php +++ b/.php_cs.php @@ -1,8 +1,6 @@ false, 'void_return' => false, - 'static_lambda' => false, 'escape_implicit_backslashes' => false, + 'static_lambda' => false, + 'escape_implicit_backslashes' => false, 'final_class' => false, 'final_internal_class' => false, 'final_public_method_for_abstract_class' => false, diff --git a/composer.json b/composer.json index cebc56de..ecf3da18 100644 --- a/composer.json +++ b/composer.json @@ -1,65 +1,74 @@ { - "name": "amenadiel/jpgraph", - "type": "library", - "description": "jpGraph, library to make graphs and charts", - "version": "4.1.0-beta.01", - "keywords": [ - "graph", - "chart", - "pie", - "jpgraph", - "data" - ], - "homepage": "http://jpgraph.net/", - "license": "QPL-1.0", - "support": { - "issues": "https://github.com/huasofoundries/jpgraph/issues" - }, - "require": { - "php": ">=7.3.0", - "ext-gd": "*" - - }, - "require-dev": { - "kint-php/kint": "^3.3", - "symfony/event-dispatcher": "^4.0 || ^5.0", - "symfony/yaml": "^4.0 || ^5.0", - "squizlabs/php_codesniffer": "^3.5", - "symfony/dotenv": "^4.0 || ^5.0", - "phpstan/phpstan": "^0.12.84", - "ergebnis/composer-normalize": "^2.13", - "ergebnis/php-cs-fixer-config": "^2.13", - "overtrue/phplint": "^2.3", - "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^4.7", - - "codeception/codeception": "^4.1", - "codeception/module-asserts": "^1.3" - - }, - "autoload": { - "psr-4": { - - "Amenadiel\\JpGraph\\": "src/", - "Amenadiel\\JpGraph\\Graph\\": "src/graph", - "Amenadiel\\JpGraph\\Graph\\Scale\\": "src/graph/scale", - "Amenadiel\\JpGraph\\Graph\\Tick\\": "src/graph/tick", - "Amenadiel\\JpGraph\\Graph\\Axis\\": "src/graph/axis", - "Amenadiel\\JpGraph\\Image\\": "src/image", - "Amenadiel\\JpGraph\\Plot\\": "src/plot", - "Amenadiel\\JpGraph\\Text\\": "src/text", - "Amenadiel\\JpGraph\\Themes\\": "src/themes", - "Amenadiel\\JpGraph\\Util\\": "src/util" + "name": "amenadiel/jpgraph", + "type": "library", + "description": "jpGraph, library to make graphs and charts", + "keywords": [ + "graph", + "chart", + "pie", + "jpgraph", + "data" + ], + "homepage": "http://jpgraph.net/", + "version": "4.1.0-beta.01", + "license": "QPL-1.0", + "require": { + "php": ">=7.3.0", + "ext-gd": "*" + }, + "require-dev": { + "codeception/codeception": "^4.1", + "codeception/module-asserts": "^1.3", + "ergebnis/composer-normalize": "^2.13", + "ergebnis/php-cs-fixer-config": "^2.13", + "kint-php/kint": "^3.3", + "overtrue/phplint": "^2.3", + "phpstan/phpstan": "^0.12.84", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.6", + "symfony/dotenv": "^4.0 || ^5.0", + "symfony/event-dispatcher": "^4.0 || ^5.0", + "symfony/yaml": "^4.0 || ^5.0", + "vimeo/psalm": "^4.7" + }, + "extra": { + "composer-normalize": { + "indent-size": 4, + "indent-style": "space" + }, + "version": "4.1.0-beta.01" + }, + "autoload": { + "psr-4": { + "Amenadiel\\JpGraph\\": "src/", + "Amenadiel\\JpGraph\\Graph\\": "src/graph", + "Amenadiel\\JpGraph\\Graph\\Scale\\": "src/graph/scale", + "Amenadiel\\JpGraph\\Graph\\Tick\\": "src/graph/tick", + "Amenadiel\\JpGraph\\Graph\\Axis\\": "src/graph/axis", + "Amenadiel\\JpGraph\\Image\\": "src/image", + "Amenadiel\\JpGraph\\Plot\\": "src/plot", + "Amenadiel\\JpGraph\\Text\\": "src/text", + "Amenadiel\\JpGraph\\Themes\\": "src/themes", + "Amenadiel\\JpGraph\\Util\\": "src/util" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests" + }, + "files": [ + "tests/polyfills.php" + ] + }, + "scripts": { + "act": "act -P ubuntu-latest=shivammathur/node:latest", + "fix": "vendor/bin/phpcbf --standard=.phpcs.xml src/* tests/* && vendor/bin/php-cs-fixer fix --config=.php_cs.php", + "lint":"vendor/bin/phplint", + + "start": "php -S localhost:8000 -t Examples", + "test": "php vendor/bin/codecept run unit " + }, + "support": { + "issues": "https://github.com/huasofoundries/jpgraph/issues" } - }, - "autoload-dev": { - "psr-4": { - "Tests\\":"tests" - },"files":["tests/polyfills.php"] - }, - "scripts": { - "act": "act -P ubuntu-latest=shivammathur/node:latest", - "start": "php -S localhost:8000 -t Examples", - "test": "php vendor/bin/codecept run unit " - } } diff --git a/composer.lock b/composer.lock index f22678f5..187d28ab 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "84518dd29b52c217f54ee6121f3d0a75", + "content-hash": "356b343146451500c2c8bb17dd23c98a", "packages": [], "packages-dev": [ { diff --git a/src/config.inc.php b/src/config.inc.php index 18c53108..463c9765 100644 --- a/src/config.inc.php +++ b/src/config.inc.php @@ -8,7 +8,6 @@ use Amenadiel\JpGraph\Util; - Util\Helper::bootstrapLibrary(); // global variables I won't use anymore but maybe you do. diff --git a/src/image/Image.php b/src/image/Image.php index bfa9355f..3ad76867 100644 --- a/src/image/Image.php +++ b/src/image/Image.php @@ -138,7 +138,7 @@ public function CreateRawCanvas($aWidth = 0, $aHeight = 0) } $this->img = @imagecreatetruecolor((int) $aWidth, (int) $aHeight); - if ($this->img < 1) { + if ($this->img === false) { Util\JpGraphError::RaiseL(25126); //die("Can't create truecolor image. Check that you really have GD2 library installed."); }