diff --git a/.dockerignore b/.dockerignore index 865248a..aff0a27 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,10 @@ .git/ nbproject/ -vendor/ -build/ -.phpdoc/ -**/*.cache -**/composer.lock \ No newline at end of file +vendor +tools/vendor +**/composer.lock +**/tests/.phpunit.result.cache +**/build/ +# From tools/cache/.gitignore +tools/cache/**/* +!tools/cache/**/.gitignore diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 885cfac..838598c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,15 +1,25 @@ version: 2 updates: - package-ecosystem: composer - versioning-strategy: widen - directory: "/" + versioning-strategy: increase + directories: + - "/" + - "/tools" schedule: interval: weekly day: friday time: "04:00" + groups: + dev-dependencies: + dependency-type: development + - package-ecosystem: github-actions directory: "/" schedule: interval: weekly day: friday time: "04:00" + groups: + github-actions-dependencies: + patterns: + - "*" \ No newline at end of file diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml new file mode 100644 index 0000000..db5a95e --- /dev/null +++ b/.github/workflows/__shared-ci.yml @@ -0,0 +1,77 @@ +name: Shared - Continuous Integration for common tasks + +on: + workflow_call: + +jobs: + checks: + strategy: + matrix: + include: + - php-versions: "8.1" + - php-versions: "8.2" + - php-versions: "8.3" + stable: true + + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: ⚙️ Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: none,iconv,dom,curl,mbstring,tokenizer,xml,xmlwriter,simplexml,ctype + coverage: pcov + + - name: ♻️ Get composer cache directory + id: composer-cache + shell: bash + run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" + + - name: ♻️ Cache composer dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: ⚙️ Install dependencies + shell: bash + run: | + composer install --no-progress --prefer-dist --optimize-autoloader + composer --working-dir=tools install --no-progress --prefer-dist --optimize-autoloader + + - name: ♻️ Tools cache + uses: actions/cache@v4 + with: + path: tools/cache + key: ${{ runner.os }}-tools-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-tools- + + - name: 👕 Lint + if: matrix.stable + run: composer php-cs-fixer -- --format=checkstyle | tools/vendor/bin/cs2pr + + - name: 🔬 Static analysis + if: matrix.stable + run: composer stan -- --error-format=checkstyle | tools/vendor/bin/cs2pr + + - name: ♻️ Tests cache + uses: actions/cache@v4 + with: + path: tests/.phpunit.result.cache + key: ${{ runner.os }}-tests-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-tests- + + - name: 🧪 Test + run: composer test:ci + + - name: 📊 Upload coverage results to Codecov + if: matrix.stable + uses: codecov/codecov-action@v5 + with: + files: ./build/logs/clover.xml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml deleted file mode 100644 index 9b626fc..0000000 --- a/.github/workflows/continuous-integration.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Continuous integration - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - build: - strategy: - matrix: - include: - - php-versions: "8.0" - - php-versions: "8.1" - - php-versions: "8.2" - stable: true - - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: mbstring - coverage: pcov - - - name: ♻️ Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: ♻️ Cache composer dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - - name: ⚙️ Install dependencies - run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader - - - name: ♻️ Test cache - uses: actions/cache@v4 - with: - path: tests/.phpunit.result.cache - key: ${{ runner.os }}-test-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-test- - - - name: 🧪 Test - run: composer test:ci - - - name: 📊 Upload coverage results to Coveralls - if: matrix.stable - uses: codecov/codecov-action@v5 - with: - files: ./build/logs/clover.xml diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml new file mode 100644 index 0000000..ee9340b --- /dev/null +++ b/.github/workflows/main-ci.yml @@ -0,0 +1,110 @@ +name: Main - Continuous Integration + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: + - main + +permissions: + contents: read + pages: write + id-token: write + +jobs: + ci: + name: Continuous Integration + uses: ./.github/workflows/__shared-ci.yml + secrets: inherit + + docs-generate-site: + runs-on: ubuntu-latest + needs: ci + steps: + - uses: actions/checkout@v4 + - run: | + mkdir -p ./_site + + echo -e "theme: jekyll-theme-cayman" > ./_site/_config.yml + + to_title_case() { + echo "$1" | awk '{ + for (i=1; i<=NF; i++) { + $i = toupper(substr($i, 1, 1)) tolower(substr($i, 2)) + } + print + }' + } + + create_site_page() { + page="$1" + title="$(to_title_case "$2")" + content_path="$3" + echo -e "---\nlayout: default\ntitle: $title\n---\n" > "$page" + echo "$(sed -r s"/(\{%[^%]+%\})/{% raw %}\1{% endraw %}/g" "$content_path")" >> "$page" + } + + create_site_page "./_site/index.md" "Home" "./README.md" + + for filepath in ./docs/*.md; do + filename=$(basename -- "$filepath") + section="${filename%.*}" + mkdir -p "./_site/$section" + create_site_page "./_site/$section/index.md" "$section" "$filepath" + done + + - uses: actions/upload-artifact@v4 + with: + name: docs-site + path: ./_site + + docs-generate-phpdoc: + runs-on: ubuntu-latest + needs: ci + steps: + - uses: actions/checkout@v4 + + - name: 📃 Generate PHP documentation + run: docker run --rm -v $(pwd):/data phpdoc/phpdoc:3 -d ./src -t ./_site/phpdoc + + - uses: actions/upload-artifact@v4 + with: + name: docs-phpdoc + path: ./_site + + docs-publish: + name: Publish documentation + needs: [docs-generate-site, docs-generate-phpdoc] + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + + - uses: actions/download-artifact@v4 + with: + pattern: 'docs-*' + path: ./ + merge-multiple: true + + - name: ⚙️ Setup Pages + uses: actions/configure-pages@v5 + + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: ./ + destination: ./_site + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + - name: 🚀 Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/need-fix-to-issue.yml b/.github/workflows/need-fix-to-issue.yml new file mode 100644 index 0000000..ca02903 --- /dev/null +++ b/.github/workflows/need-fix-to-issue.yml @@ -0,0 +1,21 @@ +name: Need fix to Issue + +on: + push: + branches: + - main + workflow_dispatch: + inputs: + manual-commit-ref: + description: "The SHA of the commit to get the diff for" + required: true + manual-base-ref: + description: "By default, the commit entered above is compared to the one directly before it; to go back further, enter an earlier SHA here" + required: false + +jobs: + main: + uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@0.15.0 + with: + manual-commit-ref: ${{ inputs.manual-commit-ref }} + manual-base-ref: ${{ inputs.manual-base-ref }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index aa2e6fa..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Publish - -on: - push: - tags: [v*] - workflow_dispatch: - -jobs: - site: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - run: | - mkdir -p ./artifact/site - - echo -e "theme: jekyll-theme-cayman" > ./artifact/site/_config.yml - - echo -e "---\nlayout: default\ntitle: Home\n---\n" > ./artifact/site/index.md - echo "$(sed -r s"/(\{%[^%]+%\})/{% raw %}\1{% endraw %}/g" ./README.md)" >> ./artifact/site/index.md - - mkdir -p ./artifact/site/installation - echo -e "---\nlayout: default\ntitle: Installation\n---\n" > ./artifact/site/installation/index.md - echo "$(sed -r s"/(\{%[^%]+%\})/{% raw %}\1{% endraw %}/g" ./docs/installation.md)" >> ./artifact/site/installation/index.md - - mkdir -p ./artifact/site/usage - echo -e "---\nlayout: default\ntitle: Usage\n---\n" > ./artifact/site/usage/index.md - echo "$(sed -r s"/(\{%[^%]+%\})/{% raw %}\1{% endraw %}/g" ./docs/usage.md)" >> ./artifact/site/usage/index.md - - - uses: actions/upload-artifact@v4 - with: - name: artifact - path: ./artifact - - phpdoc: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: 📃 Generate PHP documentation - run: | - docker run --rm -v $(pwd):/data phpdoc/phpdoc:3 -d ./src -t ./artifact/site/phpdoc - - - uses: actions/upload-artifact@v4 - with: - name: artifact - path: ./artifact - - build_and_deploy: - runs-on: ubuntu-latest - needs: [site, phpdoc] - steps: - - uses: actions/download-artifact@v4 - with: - name: artifact - path: ./artifact - - - uses: peaceiris/actions-gh-pages@v4.0.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./artifact/site - enable_jekyll: true diff --git a/.github/workflows/pull-request-ci.yml b/.github/workflows/pull-request-ci.yml new file mode 100644 index 0000000..09a2a98 --- /dev/null +++ b/.github/workflows/pull-request-ci.yml @@ -0,0 +1,17 @@ +name: Pull request - Continuous Integration + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + merge_group: + +jobs: + ci: + name: Continuous Integration + uses: ./.github/workflows/__shared-ci.yml + secrets: inherit diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 168b873..9a8bb3d 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -2,18 +2,8 @@ name: Mark stale issues and pull requests on: schedule: - - cron: "30 1 * * *" + - cron: "30 1 * * *" jobs: - stale: - - runs-on: ubuntu-latest - - steps: - - uses: actions/stale@v9 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' - stale-pr-message: 'Stale pull request message' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' + main: + uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@0.15.0 diff --git a/.gitignore b/.gitignore index 0d86535..1b5c1f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ /nbproject/ -/vendor/ -/build/ -/.phpdoc/ -*.cache -composer.lock \ No newline at end of file +/vendor +/tools/vendor +composer.lock +tests/.phpunit.result.cache +build/ \ No newline at end of file diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..f65294a --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,20 @@ +in(__DIR__ . '/src') + ->in(__DIR__ . '/tests') + ->ignoreVCSIgnored(true); + +return (new Config()) + ->setRules([ + '@PSR12' => true, + 'array_indentation' => true, + '@PHP83Migration' => true, + ]) + ->setFinder($finder) + ->setUsingCache(true) + ->setCacheFile(__DIR__ . '/tools/cache/.php-cs-fixer.cache') + ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()); \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8246dc9..81c6b65 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,21 @@ ARG VERSION= FROM php:${VERSION}-cli -COPY --from=composer /usr/bin/composer /usr/local/bin/composer -RUN \ - apt-get update -yqq; \ - apt-get install -yqq unzip; \ +# hadolint ignore=DL3027 +RUN --mount=type=cache,target=/var/cache/apt \ + export DEBIAN_FRONTEND=noninteractive && \ + apt-get update -yq; \ + apt-get install -yq unzip; \ pecl install pcov; \ docker-php-ext-enable pcov; -RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini; +RUN echo 'memory_limit=512M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini; +COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer + +# Configure www-data user +ARG UID=1000 +ARG GID=1000 +RUN usermod --uid $UID www-data && groupmod --gid $GID www-data && chown www-data:www-data /var/www +USER www-data +WORKDIR /var/www/html \ No newline at end of file diff --git a/Makefile b/Makefile index 2baa2b6..218018b 100644 --- a/Makefile +++ b/Makefile @@ -1,34 +1,54 @@ +PHP_VERSION=8.3 +PROJECT_NAME=$(shell basename $(CURDIR)) +UID=$(shell id -u) +GID=$(shell id -g) +IMAGE="${PROJECT_NAME}:${PHP_VERSION}" + .PHONY: help help: @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -build-php: ## Build PHP image for given version - @echo "Build php $(filter-out $@,$(MAKECMDGOALS))" - @DOCKER_BUILDKIT=1 docker build -t "twbs-helper-php:$(filter-out $@,$(MAKECMDGOALS))" --build-arg "VERSION=$(filter-out $@,$(MAKECMDGOALS))" . +setup: build-php install ## Initialize project + +build-php: ## Build PHP image + @echo "Build php ${PHP_VERSION}" + @DOCKER_BUILDKIT=1 docker build -t "${IMAGE}" --build-arg "VERSION=${PHP_VERSION}" --build-arg "UID=${UID}" --build-arg "GID=${GID}" . + +install: ## Install PHP dependencies for given PHP version + rm -f composer.lock + @$(call run-php,composer install --no-progress --prefer-dist --optimize-autoloader) + rm -f tools/composer.lock + @$(call run-php,composer --working-dir=tools install --no-progress --prefer-dist --optimize-autoloader) + +shell: ## Execute shell in given PHP version container + @$(call run-php,bash) + +test: ## Execute tests for given PHP version + @$(call run-php,composer test $(filter-out $@,$(MAKECMDGOALS))) -install: - @$(call run-php,$(filter-out $@,$(MAKECMDGOALS)) composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader) +test-update: ## Execute tests and update snapshots for given PHP version + @$(call run-php,composer test:update-snapshot $(filter-out $@,$(MAKECMDGOALS))) -shell: - @$(call run-php,$(filter-out $@,$(MAKECMDGOALS)) bash) +lint: ## Execute lint for given PHP version + @$(call run-php,composer php-cs-fixer $(filter-out $@,$(MAKECMDGOALS))) -test: - @$(call run-php,$(filter-out $@,$(MAKECMDGOALS)) composer test) +lint-fix: ## Execute lint fixing for given PHP version + @$(call run-php,composer php-cs-fixer:fix $(filter-out $@,$(MAKECMDGOALS))) -lint-fix: - @$(call run-php,$(filter-out $@,$(MAKECMDGOALS)) composer cbf) +stan: ## Execute PHPStan for given PHP version + @$(call run-php,composer stan $(filter-out $@,$(MAKECMDGOALS))) -ci: - @$(call run-php,$(filter-out $@,$(MAKECMDGOALS)) composer ci) +ci: ## Execute CI scripts for given PHP version + @$(call run-php,composer ci $(filter-out $@,$(MAKECMDGOALS))) ## Run PHP for given version define run-php - @docker run -it --rm -u $(shell id -u):$(shell id -g) -v ${PWD}:/usr/src/app -w /usr/src/app twbs-helper-php:$(1) + @docker run -it --rm -v ${PWD}:${PWD} -w ${PWD} "${IMAGE}" $(1) endef ############################# # Argument fix workaround ############################# %: - @: + @: \ No newline at end of file diff --git a/composer.json b/composer.json index 0db6e94..ce0efd9 100644 --- a/composer.json +++ b/composer.json @@ -23,18 +23,13 @@ "issues": "https://github.com/neilime/php-css-lint/issues" }, "require": { - "php": ">=8.0", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", "ext-json": "*" }, "require-dev": { "mikey179/vfsstream": "^1.6", "pcov/clobber": "^2.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^9.5.27", - "slam/phpstan-laminas-framework": "^0.12", - "squizlabs/php_codesniffer": "^3.7" + "phpunit/phpunit": "^9.5.27" }, "autoload": { "psr-4": { @@ -51,12 +46,12 @@ ], "scripts": { "test": "phpunit --colors --configuration tests/phpunit.xml", - "test:ci": "phpunit --colors --configuration tests/phpunit.xml -d pcov.enabled=1 -d max_execution_time=0 --coverage-text --coverage-clover ./build/logs/clover.xml --coverage-html ./build/coverage/", - "cs": "phpcs", - "cbf": "phpcbf", - "stan": "phpstan analyse --level 5 src", + "test:ci": "@test -d pcov.enabled=1 -d max_execution_time=0 --coverage-text --coverage-clover ./build/logs/clover.xml --coverage-html ./build/coverage/", + "php-cs-fixer": "@php-cs-fixer:fix --dry-run", + "php-cs-fixer:fix": "tools/vendor/bin/php-cs-fixer fix --show-progress=dots --diff --config=.php-cs-fixer.dist.php", + "stan": "tools/vendor/bin/phpstan analyse --level 5 src", "ci": [ - "@cs", + "@php-cs-fixer", "@stan", "@test:ci" ] diff --git a/docs/development.md b/docs/development.md new file mode 100644 index 0000000..3ccccd9 --- /dev/null +++ b/docs/development.md @@ -0,0 +1,27 @@ +# Development + +## Setup + +_You can override default PHP version by setting `PHP_VERSION` as Makefile argument. Example: `make PHP_VERSION=8.2 setup`._ + +```sh +make setup +``` + +## Running tests + +```sh +make test +``` + +## Fix code linting + +```sh +make lint-fix +``` + +## Running CI scripts + +```sh +make ci +``` \ No newline at end of file diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 846610e..0000000 --- a/phpcs.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - src - tests - diff --git a/src/CssLint/Linter.php b/src/CssLint/Linter.php index 1a7ed99..adeb323 100644 --- a/src/CssLint/Linter.php +++ b/src/CssLint/Linter.php @@ -393,7 +393,7 @@ protected function lintPropertyNameChar(string $sChar): ?bool $this->setContext(self::CONTEXT_PROPERTY_CONTENT); return true; } - + // Check if property name exists if (!$this->getCssLintProperties()->propertyExists($sPropertyName)) { $this->addError('Unknown CSS property "' . $sPropertyName . '"'); diff --git a/tests/TestSuite/CliTest.php b/tests/TestSuite/CliTest.php index a9a33cc..27a5d5d 100644 --- a/tests/TestSuite/CliTest.php +++ b/tests/TestSuite/CliTest.php @@ -90,7 +90,7 @@ public function testRunWithOptionsMustBeUsedByTheLinter() $this->assertEquals(1, $this->cli->run([ 'php-css-lint', '--options={ "allowedIndentationChars": ["\t"] }', - '.test { display: block; }' + '.test { display: block; }', ])); } @@ -103,7 +103,7 @@ public function testRunWithInvalidOptionsFormatShouldReturnAnError() $this->assertEquals(1, $this->cli->run([ 'php-css-lint', '--options={ "allowedIndentationChars": }', - '.test { display: block; }' + '.test { display: block; }', ])); } } diff --git a/tests/TestSuite/LinterTest.php b/tests/TestSuite/LinterTest.php index 162c87f..8beb74a 100644 --- a/tests/TestSuite/LinterTest.php +++ b/tests/TestSuite/LinterTest.php @@ -92,7 +92,7 @@ public function testLintStringWithUnterminatedContext() { $this->assertFalse($this->linter->lintString('* {')); $this->assertSame([ - 'Unterminated "selector content" (line: 1, char: 3)' + 'Unterminated "selector content" (line: 1, char: 3)', ], $this->linter->getErrors()); } @@ -100,7 +100,7 @@ public function testLintStringWithWrongSelectorDoubleComma() { $this->assertFalse($this->linter->lintString('a,, {}')); $this->assertSame([ - 'Selector token "," cannot be preceded by "a," (line: 1, char: 3)' + 'Selector token "," cannot be preceded by "a," (line: 1, char: 3)', ], $this->linter->getErrors()); } @@ -108,7 +108,7 @@ public function testLintStringWithWrongSelectorDoubleHash() { $this->assertFalse($this->linter->lintString('## {}')); $this->assertSame([ - 'Selector token "#" cannot be preceded by "#" (line: 1, char: 2)' + 'Selector token "#" cannot be preceded by "#" (line: 1, char: 2)', ], $this->linter->getErrors()); } @@ -119,7 +119,7 @@ public function testLintStringWithWrongPropertyNameUnexpectedToken() }')); $this->assertSame([ 'Unexpected property name token "~" (line: 2, char: 10)', - 'Unknown CSS property "test~" (line: 2, char: 11)' + 'Unknown CSS property "test~" (line: 2, char: 11)', ], $this->linter->getErrors()); } @@ -127,7 +127,7 @@ public function testLintStringWithWrongSelectorUnexpectedToken() { $this->assertFalse($this->linter->lintString('.a| {}')); $this->assertSame([ - 'Unexpected selector token "|" (line: 1, char: 3)' + 'Unexpected selector token "|" (line: 1, char: 3)', ], $this->linter->getErrors()); } @@ -173,7 +173,7 @@ public function testLintFileWithUnreadableFilePathParam() $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Argument "$sFilePath" "vfs://testDir/foo.txt" is not a readable file path'); - $testFile = new vfsStreamFile('foo.txt', 0000); + $testFile = new vfsStreamFile('foo.txt', 0o000); $this->root->addChild($testFile); $fileToLint = $testFile->url(); @@ -204,7 +204,7 @@ public function testLintNotValidCssFile() $this->assertFalse($this->linter->lintFile(__DIR__ . '/../_files/not_valid.css')); $this->assertSame([ 'Unknown CSS property "bordr-top-style" (line: 8, char: 20)', - 'Unterminated "selector content" (line: 17, char: 0)' + 'Unterminated "selector content" (line: 17, char: 0)', ], $this->linter->getErrors()); } } diff --git a/tests/TestSuite/PropertiesTest.php b/tests/TestSuite/PropertiesTest.php index b8d7b08..2043cf8 100644 --- a/tests/TestSuite/PropertiesTest.php +++ b/tests/TestSuite/PropertiesTest.php @@ -114,7 +114,7 @@ public function testSetOptionsAllowedIndentationChars() $this->assertFalse($oProperties->isAllowedIndentationChar("\t")); $oProperties->setOptions([ - 'allowedIndentationChars' => ["\t"] + 'allowedIndentationChars' => ["\t"], ]); $this->assertTrue($oProperties->isAllowedIndentationChar("\t")); } @@ -125,7 +125,7 @@ public function testSetOptionsConstructors() $this->assertFalse($oProperties->propertyExists('-new-font-smoothing')); $oProperties->setOptions([ - 'constructors' => ['new' => true] + 'constructors' => ['new' => true], ]); $this->assertTrue($oProperties->propertyExists('-new-font-smoothing')); } @@ -136,7 +136,7 @@ public function testSetOptionsStandards() $this->assertFalse($oProperties->propertyExists('new-content')); $oProperties->setOptions([ - 'standards' => ['new-content' => true] + 'standards' => ['new-content' => true], ]); $this->assertTrue($oProperties->propertyExists('new-content')); } @@ -147,7 +147,7 @@ public function testSetOptionsNonStandards() $this->assertFalse($oProperties->propertyExists('-moz-new-content')); $oProperties->setOptions([ - 'nonStandards' => ['new-content' => true] + 'nonStandards' => ['new-content' => true], ]); $this->assertTrue($oProperties->propertyExists('-moz-new-content')); } diff --git a/tools/cache/.gitignore b/tools/cache/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/tools/cache/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/tools/composer.json b/tools/composer.json new file mode 100644 index 0000000..49d5585 --- /dev/null +++ b/tools/composer.json @@ -0,0 +1,14 @@ +{ + "require": { + "friendsofphp/php-cs-fixer": "^3.64", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^1.12", + "phpstan/phpstan-phpunit": "^1.4", + "staabm/annotate-pull-request-from-checkstyle": "^1.8" + }, + "config": { + "allow-plugins": { + "phpstan/extension-installer": true + } + } + } \ No newline at end of file