Skip to content

Commit 1fc9068

Browse files
authored
Merge pull request #16 from KaririCode-Framework/develop
fix(style-code): Resolve static analysis errors and improve type safety
2 parents c966a11 + 997d798 commit 1fc9068

File tree

10 files changed

+774
-458
lines changed

10 files changed

+774
-458
lines changed

Makefile

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,28 @@ security-check: check-environment check-container-running
149149
$(EXEC_PHP) ./vendor/bin/security-checker security:check
150150
@echo "${GREEN}${CHECK_MARK} Security check completed!${NC}"
151151

152+
## stan-src: Run PHPStan static analysis on src/
153+
stan-src: check-environment check-container-running
154+
@echo "${GREEN}${INFO} Running PHPStan on src/...${NC}"
155+
$(EXEC_PHP) ./vendor/bin/phpstan analyse src --memory-limit=1G --ansi
156+
@echo "${GREEN}${CHECK_MARK} PHPStan (src/) analysis completed!${NC}"
157+
158+
## stan-tests: Run PHPStan static analysis on tests/
159+
stan-tests: check-environment check-container-running
160+
@echo "${GREEN}${INFO} Running PHPStan on tests/...${NC}"
161+
$(EXEC_PHP) ./vendor/bin/phpstan analyse tests --memory-limit=1G --ansi
162+
@echo "${GREEN}${CHECK_MARK} PHPStan (tests/) analysis completed!${NC}"
163+
164+
## stan-file: Run PHPStan analysis on a specific file. Usage: make stan-file FILE=path/to/file.php
165+
stan-file: check-environment check-container-running
166+
@if [ -z "$(FILE)" ]; then \
167+
echo "${RED}${WARNING} You must specify a file. Usage: make stan-file FILE=path/to/file.php${NC}"; \
168+
else \
169+
echo "${GREEN}${INFO} Running PHPStan on file: $(FILE)...${NC}"; \
170+
$(EXEC_PHP) ./vendor/bin/phpstan analyse $(FILE) --memory-limit=1G --ansi; \
171+
echo "${GREEN}${CHECK_MARK} PHPStan analysis completed for $(FILE)!${NC}"; \
172+
fi
173+
152174
## quality: Run all quality commands
153175
quality: check-environment check-container-running cs-check test security-check
154176
@echo "${GREEN}${CHECK_MARK} All quality commands executed!${NC}"
@@ -171,4 +193,4 @@ help:
171193
@echo "\n${GREEN}Available commands:${NC}"
172194
@sed -n 's/^##//p' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ": "}; {printf "${YELLOW}%-30s${NC} %s\n", $$1, $$2}'
173195

174-
.PHONY: setup-env up down build logs re-build shell composer-install composer-remove composer-update test test-file coverage coverage-html run-script cs-check cs-fix security-check quality help
196+
.PHONY: setup-env up down build logs re-build shell composer-install composer-remove composer-update test test-file coverage coverage-html run-script cs-check cs-fix security-check stan-src stan-tests stan-file quality help

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"require-dev": {
4747
"friendsofphp/php-cs-fixer": "^3.58",
4848
"nunomaduro/phpinsights": "^2.11",
49+
"phpstan/phpstan": "^1.10",
4950
"phpunit/phpunit": "^10.5",
5051
"squizlabs/php_codesniffer": "^3.10",
5152
"mockery/mockery": "^1.6",

0 commit comments

Comments
 (0)