Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QA Refresh: Upgrade Psalm, Add PHPStan + composer-require-checker #65

Open
wants to merge 7 commits into
base: 1.16.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@
/test/ export-ignore
/renovate.json export-ignore
/.laminas-ci.json export-ignore
/Makefile export-ignore
/tools/ export-ignore
/phpstan.neon export-ignore
/phpstan-baseline.neon export-ignore
16 changes: 16 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,19 @@ on:
jobs:
ci:
uses: laminas/workflow-continuous-integration/.github/workflows/[email protected]

composer-require-checker:
name: "Check for missing dependencies"
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- uses: shivammathur/[email protected]

with:
php-version: ${{ env.default_php }}
ini-values: memory_limit=-1
extensions: ${{ env.php_extensions }}
- uses: ramsey/[email protected]
- run: make install-tools
- run: make composer-require-checker
74 changes: 74 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Run `make` (no arguments) to get a short description of what is available
# within this `Makefile`.

MKDOCS_IMAGE_ID := $(shell docker images -q laminas/mkdocs | xargs)

help: ## shows this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_\-\.]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: help

documentation-theme: ## fetch the documentation theme repo
git clone [email protected]:laminas/documentation-theme.git

build-mkdocs-image: documentation-theme ## Build the mkdocs image with necessary dependencies for building the docs
$(if ${MKDOCS_IMAGE_ID}, $(info Image already built), cd documentation-theme/builder && docker build -t laminas/mkdocs .)
.PHONY: build-mkdocs-image

docs: build-mkdocs-image ## build the docs using a Docker container
docker run -it -w /app -v ${PWD}:/app --rm laminas/mkdocs ./documentation-theme/build.sh -u https://www.example.com
$(info ${PWD}/docs/html/index.html)
.PHONY: docs

install: install-tools ## Install PHP dependencies
composer install
.PHONY: install

update: bump-tools ## Update PHP dependencies
composer update
.PHONY: update

bump: bump-tools ## Bump PHP dev dependencies and update
composer update && composer bump -D && composer update
.PHONY: bump

clean: ## Clear out caches and documentation assets
rm -rf documentation-theme
rm -rf docs/html
docker image rm laminas/mkdocs
rm -rf .phpunit.cache
rm -f .phpcs-cache
vendor/bin/psalm --clear-cache

static-analysis: ## Run static analysis checks
vendor/bin/psalm --no-cache
vendor/bin/phpstan analyze
.PHONY: static-analysis

coding-standards: ## Run coding standards checks
vendor/bin/phpcs
.PHONY: coding-standards

coding-standards-fix: ## Fix coding standard violations
vendor/bin/phpcbf
.PHONY: coding-standards-fix

test: ## Run unit tests
vendor/bin/phpunit
.PHONY: test

install-tools: ## Install standalone tools
cd tools/crc && composer install
.PHONY: install-tools

bump-tools: ## Bump deps for all standalone tools
cd tools/crc && composer update && composer bump -D && composer update
.PHONY: bump-tools

composer-require-checker: ## Check composer.json for un-declared dependencies
tools/crc/vendor/bin/composer-require-checker check \
--config-file=tools/crc/config.json \
composer.json
.PHONY: composer-require-checker

qa: coding-standards static-analysis test composer-require-checker ## Run all QA Checks
.PHONY: qa
14 changes: 10 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"php": "8.1.99"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
}
},
"extra": {
Expand All @@ -37,16 +38,21 @@
"dflydev/fig-cookies": "^3.0.0",
"mezzio/mezzio-session": "^1.4",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"psr/container": "^1.0 || ^2.0 || ^3.0"
"psr/container": "^1.0 || ^2.0",
"psr/http-message": "^2.0"
},
"require-dev": {
"laminas/laminas-cache": "^4.1.0",
"laminas/laminas-cache-storage-adapter-apcu": "^3.1.0",
"laminas/laminas-coding-standard": "~3.0.1",
"laminas/laminas-diactoros": "^3.5.0",
"phpunit/phpunit": "^10.5.44",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^2.1.6",
"phpstan/phpstan-phpunit": "^2.0.4",
"phpstan/phpstan-strict-rules": "^2.0.3",
"phpunit/phpunit": "^10.5.45",
"psalm/plugin-phpunit": "^0.19.2",
"vimeo/psalm": "^6.4.0"
"vimeo/psalm": "^6.8.8"
},
"suggest": {
"psr/cache-implementation": "This package requires a PSR-6 CacheItemPoolInterface implementation."
Expand Down
Loading