Skip to content

Commit 6aaaaa4

Browse files
committed
chore: Add psalm and cs-checker
1 parent 25c899d commit 6aaaaa4

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

.php-cs-fixer.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()->in(__DIR__);
4+
5+
$config = new PhpCsFixer\Config();
6+
return $config
7+
->setFinder($finder)
8+
->setUsingCache(true)
9+
->setRules([
10+
'@PSR2' => true,
11+
'blank_line_after_opening_tag' => true,
12+
'ordered_imports' => true,
13+
'no_unused_imports' => true,
14+
'array_syntax' => ['syntax' => 'short'],
15+
]);

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.PHONY: help
2+
help: #! Show this help message
3+
@echo 'Usage: make [target] ... '
4+
@echo ''
5+
@echo 'Targets:'
6+
@grep -h -F '#!' $(MAKEFILE_LIST) | grep -v grep | sed 's/:.*#!/:/' | column -t -s":"
7+
8+
.PHONY: test
9+
test: #! Run unit tests
10+
php -d xdebug.mode=coverage vendor/bin/phpunit
11+
12+
.PHONY: coverage
13+
coverage: #! Run unit tests with test coverage
14+
php -d xdebug.mode=coverage vendor/bin/phpunit
15+
16+
.PHONY: lint
17+
lint: #! Run quality control tools (e.g. psalm)
18+
./vendor/bin/psalm --no-cache
19+
composer cs-check

composer.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
2121
],
2222
"require": {
2323
"php": ">=8.1",
24-
"launchdarkly/server-sdk": ">=6.4.0 <7.0.0"
24+
"launchdarkly/server-sdk": ">=6.3.0 <7.0.0"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": "^9"
27+
"friendsofphp/php-cs-fixer": "^3.68",
28+
"phpunit/php-code-coverage": "^9",
29+
"phpunit/phpunit": "^9",
30+
"vimeo/psalm": "^5"
2831
},
2932
"autoload": {
3033
"psr-4": {
@@ -38,5 +41,9 @@
3841
},
3942
"config": {
4043
"sort-packages": true
44+
},
45+
"scripts": {
46+
"cs-check": "vendor/bin/php-cs-fixer fix --diff --dry-run --verbose --config=.php-cs-fixer.php",
47+
"cs-fix": "vendor/bin/php-cs-fixer fix --diff --verbose --config=.php-cs-fixer.php"
4148
}
4249
}

psalm.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="2"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
>
9+
<projectFiles>
10+
<directory name="src" />
11+
<ignoreFiles>
12+
<directory name="vendor" />
13+
</ignoreFiles>
14+
</projectFiles>
15+
</psalm>

0 commit comments

Comments
 (0)