Преглед изворни кода

:octocat: dependency & CI updates

smiley пре 1 година
родитељ
комит
30c2d46878
6 измењених фајлова са 37 додато и 24 уклоњено
  1. 1 0
      .gitattributes
  2. 19 13
      .github/workflows/ci.yml
  3. 6 0
      .idea/codeStyles/Project.xml
  4. 3 3
      composer.json
  5. 5 5
      docs/qroptions-doc.php
  6. 3 3
      phpunit.xml.dist

+ 1 - 0
.gitattributes

@@ -1,5 +1,6 @@
 /.build            export-ignore
 /.github           export-ignore
+/.idea             export-ignore
 /.phan             export-ignore
 /.phpdoc           export-ignore
 /docs              export-ignore

+ 19 - 13
.github/workflows/ci.yml

@@ -1,5 +1,5 @@
-# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
-# https://github.com/sebastianbergmann/phpunit/blob/master/.github/workflows/ci.yml
+# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
+# https://github.com/sebastianbergmann/phpunit/blob/main/.github/workflows/ci.yaml
 
 on:
   push:
@@ -11,6 +11,10 @@ on:
 
 name: "Continuous Integration"
 
+env:
+  PHP_EXTENSIONS: fileinfo, gd, imagick, json, mbstring
+  PHP_INI_VALUES: memory_limit=-1, error_reporting=-1, display_errors=On
+
 jobs:
 
   static-code-analysis:
@@ -33,18 +37,18 @@ jobs:
 
     steps:
       - name: "Checkout"
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
 
       - name: "Install PHP"
         uses: shivammathur/setup-php@v2
         with:
           php-version: ${{ matrix.php-version }}
+          extensions: ast, ${{ env.PHP_EXTENSIONS }}
+          ini-values: ${{ env.PHP_INI_VALUES }}
           coverage: none
-          tools: pecl
-          extensions: ast, fileinfo, gd, imagick, json, mbstring
 
-      - name: "Update dependencies with composer"
-        uses: ramsey/composer-install@v2
+      - name: "Install dependencies with composer"
+        uses: ramsey/composer-install@v3
 
       - name: "Run phan"
         run: php vendor/bin/phan --target-php-version=${{ matrix.php-version }}
@@ -70,26 +74,28 @@ jobs:
 
     steps:
       - name: "Checkout"
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
 
       - name: "Install PHP with extensions"
         uses: shivammathur/setup-php@v2
         with:
           php-version: ${{ matrix.php-version }}
+          extensions: ${{ env.PHP_EXTENSIONS }}
+          ini-values: ${{ env.PHP_INI_VALUES }}
           coverage: pcov
           tools: pecl
-          extensions: fileinfo, gd, imagick, json, mbstring
 
       - name: "Install dependencies with composer"
-        uses: ramsey/composer-install@v2
+        uses: ramsey/composer-install@v3
 
-      - name: "Run tests with phpunit"
+      - name: "Run tests with PHPUnit"
         run: php vendor/bin/phpunit --colors=always --configuration=phpunit.xml.dist
 
       - name: "Send code coverage report to Codecov.io"
-        uses: codecov/codecov-action@v3
+        uses: codecov/codecov-action@v4
         with:
-         files: .build/coverage/clover.xml
+          token: ${{ secrets.CODECOV_TOKEN }}
+          files: .build/coverage/clover.xml
 
       - name: "Send code coverage report to Codacy"
         uses: codacy/codacy-coverage-reporter-action@v1

+ 6 - 0
.idea/codeStyles/Project.xml

@@ -295,8 +295,14 @@
       <option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
       <option name="ALIGN_PHPDOC_COMMENTS" value="true" />
       <option name="ALIGN_ASSIGNMENTS" value="true" />
+      <option name="ALIGN_NAMED_ARGUMENTS" value="true" />
+      <option name="ALIGN_MATCH_ARM_BODIES" value="true" />
       <option name="CONCAT_SPACES" value="false" />
       <option name="COMMA_AFTER_LAST_ARRAY_ELEMENT" value="true" />
+      <option name="COMMA_AFTER_LAST_PARAMETER" value="true" />
+      <option name="COMMA_AFTER_LAST_CLOSURE_USE_VAR" value="true" />
+      <option name="COMMA_AFTER_LAST_ARGUMENT" value="true" />
+      <option name="COMMA_AFTER_LAST_MATCH_ARM" value="true" />
       <option name="PHPDOC_BLANK_LINE_BEFORE_TAGS" value="true" />
       <option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="true" />
       <option name="PHPDOC_WRAP_LONG_LINES" value="true" />

+ 3 - 3
composer.json

@@ -1,6 +1,6 @@
 {
 	"name": "chillerlan/php-qrcode",
-	"description": "A QR code generator and reader with a user friendly API. PHP 7.4+",
+	"description": "A QR Code generator and reader with a user-friendly API. PHP 7.4+",
 	"homepage": "https://github.com/chillerlan/php-qrcode",
 	"license": [
 		"MIT", "Apache-2.0"
@@ -42,7 +42,7 @@
 	"require": {
 		"php": "^7.4 || ^8.0",
 		"ext-mbstring": "*",
-		"chillerlan/php-settings-container": "^2.1.4 || ^3.1"
+		"chillerlan/php-settings-container": "^2.1.4 || ^3.2"
 	},
 	"require-dev": {
 		"chillerlan/php-authenticator": "^4.1 || ^5.1",
@@ -50,7 +50,7 @@
 		"phpunit/phpunit": "^9.6",
 		"phpmd/phpmd": "^2.15",
 		"setasign/fpdf": "^1.8.2",
-		"squizlabs/php_codesniffer": "^3.8"
+		"squizlabs/php_codesniffer": "^3.9"
 	},
 	"suggest": {
 		"chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.",

+ 5 - 5
docs/qroptions-doc.php

@@ -8,17 +8,17 @@
  * @license      MIT
  */
 
-use chillerlan\QRCode\QROptionsTrait;
+use chillerlan\QRCode\QROptions;
 
 require_once __DIR__.'/../vendor/autoload.php';
 
 $file    = 'Usage/Configuration-settings.md';
 $content = [
 	'# Configuration settings',
-	'<!-- This file is auto generated from the source of QROptionsTrait.php -->',
+	'<!-- This file is auto generated from the source of QROptions.php -->',
 ];
 
-$reflectionClass = new ReflectionClass(QROptionsTrait::class);
+$reflectionClass = new ReflectionClass(QROptions::class);
 
 foreach($reflectionClass->getProperties(ReflectionProperty::IS_PROTECTED) as $reflectionProperty){
 	$docblock = $reflectionProperty->getDocComment();
@@ -71,7 +71,7 @@ foreach($reflectionClass->getProperties(ReflectionProperty::IS_PROTECTED) as $re
 			}
 			// php.net documentation
 			elseif(str_starts_with($line, '\\') && !str_contains($line, 'chillerlan')){
-				$path = str_replace(['\\', '::', '()'], ['', '.', ''], strtolower($line));
+				$path = str_replace(['\\', '::', '()', '_'], ['', '.', '', '-'], strtolower($line));
 
 				if(!str_contains($line, '::')){
 					$path = 'function.'.$path;
@@ -93,6 +93,6 @@ foreach($reflectionClass->getProperties(ReflectionProperty::IS_PROTECTED) as $re
 
 file_put_contents(__DIR__.'/'.$file, implode("\n", $content));
 
-printf('Built "%s" from "%s"', $file, QROptionsTrait::class);
+printf('Built "%s" from "%s"', $file, QROptions::class);
 
 exit(0);

+ 3 - 3
phpunit.xml.dist

@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-		 xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
+		 xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
 		 bootstrap="vendor/autoload.php"
 		 cacheResultFile=".build/phpunit.result.cache"
 		 colors="true"
@@ -8,13 +8,13 @@
 >
 	<testsuites>
 		<testsuite name="php-qrcode test suite">
-			<directory suffix=".php">./tests/</directory>
+			<directory>./tests/</directory>
 			<exclude>./tests/Performance</exclude>
 		</testsuite>
 	</testsuites>
 	<coverage processUncoveredFiles="true">
 		<include>
-			<directory suffix=".php">./src</directory>
+			<directory>./src</directory>
 		</include>
 		<report>
 			<clover outputFile=".build/coverage/clover.xml"/>