Skip to content

Commit 27be3a7

Browse files
authored
Merge pull request #81 from Xerkus/feature/qa-tools
Make QA tools available by default
2 parents 56bdfa4 + c4f1090 commit 27be3a7

File tree

13 files changed

+144
-28
lines changed

13 files changed

+144
-28
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/.github/ export-ignore
22
/bin/remove-package-artifacts.php export-ignore
3-
/CHANGELOG.md
3+
/laminas-ci.json export-ignore
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- '[0-9]+.[0-9]+.x'
8+
- 'refs/pull/*'
9+
tags:
10+
11+
jobs:
12+
matrix:
13+
name: Generate job matrix
14+
runs-on: ubuntu-latest
15+
outputs:
16+
matrix: ${{ steps.matrix.outputs.matrix }}
17+
steps:
18+
- name: Gather CI configuration
19+
id: matrix
20+
uses: laminas/laminas-ci-matrix-action@v1
21+
22+
qa:
23+
name: QA Checks
24+
needs: [matrix]
25+
runs-on: ${{ matrix.operatingSystem }}
26+
strategy:
27+
fail-fast: false
28+
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
29+
steps:
30+
- name: ${{ matrix.name }}
31+
uses: laminas/laminas-continuous-integration-action@v1
32+
with:
33+
job: ${{ matrix.job }}

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
.vagrant/
1+
/.phpcs-cache
2+
/.phpunit.cache
3+
/.psalm-cache
24
vendor/
35
config/development.config.php
46
data/cache/*
57
!data/cache/.gitkeep
68
phpunit.xml
79
composer.lock
8-
.phpunit.result.cache

.phpstorm.meta.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace PHPSTORM_META {
4+
override(
5+
\Psr\Container\ContainerInterface::get(0),
6+
map(['@'])
7+
);
8+
}

.psalm-stubs.phpstub

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Psr\Container {
4+
interface ContainerInterface
5+
{
6+
/**
7+
* @psalm-template T of object
8+
* @psalm-param class-string<T>|string $id
9+
* @return (
10+
* $id is class-string<T>
11+
* ? T
12+
* : mixed
13+
* )
14+
*/
15+
public function get(string $id): mixed;
16+
}
17+
}

composer.json

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@
1111
],
1212
"require": {
1313
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
14-
"laminas/laminas-component-installer": "^3.2",
15-
"laminas/laminas-development-mode": "^3.10",
16-
"laminas/laminas-skeleton-installer": "^1.2",
17-
"laminas/laminas-mvc": "^3.6.0"
14+
"laminas/laminas-component-installer": "^3.4.0",
15+
"laminas/laminas-development-mode": "^3.12.0",
16+
"laminas/laminas-mvc": "^3.7.0",
17+
"laminas/laminas-skeleton-installer": "^1.3.0"
18+
},
19+
"require-dev": {
20+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
21+
"laminas/laminas-test": "^4.9",
22+
"phpunit/phpunit": "^10.4",
23+
"psalm/plugin-phpunit": "^0.18.4",
24+
"squizlabs/php_codesniffer": "^3.7",
25+
"vimeo/psalm": "^5.13"
1826
},
1927
"autoload": {
2028
"psr-4": {
@@ -87,12 +95,6 @@
8795
"prompt": "Would you like to install sessions support?",
8896
"module": true
8997
},
90-
{
91-
"name": "laminas/laminas-test",
92-
"constraint": "^4.7.0",
93-
"prompt": "Would you like to install MVC testing tools for testing support?",
94-
"dev": true
95-
},
9698
{
9799
"name": "laminas/laminas-di",
98100
"constraint": "^3.12.0",
@@ -111,8 +113,7 @@
111113
"post-create-project-cmd": [
112114
"@development-enable",
113115
"php bin/update-gitignore.php",
114-
"php -r 'if (file_exists(\"bin/remove-package-artifacts.php\")) include \"bin/remove-package-artifacts.php\";'",
115-
"php -r 'if (file_exists(\"CHANGELOG.md\")) unlink(\"CHANGELOG.md\");'"
116+
"php -r 'if (file_exists(\"bin/remove-package-artifacts.php\")) include \"bin/remove-package-artifacts.php\";'"
116117
],
117118
"post-install-cmd": "@clear-config-cache",
118119
"post-update-cmd": "@clear-config-cache",
@@ -121,7 +122,7 @@
121122
"php -S 0.0.0.0:8080 -t public"
122123
],
123124
"test": "vendor/bin/phpunit",
124-
"static-analysis": "vendor/bin/psalm --shepherd --stats"
125+
"static-analysis": "vendor/bin/psalm --stats"
125126
},
126127
"scripts-descriptions": {
127128
"clear-config-cache": "Clears merged config cache. Required for config changes to be applied.",
@@ -131,12 +132,15 @@
131132
"development-enable": "Enable development mode.",
132133
"development-status": "Detail whether or not the application is in development mode.",
133134
"serve": "Start the built-in PHP web server and serve the application.",
135+
"static-analysis": "Run static analysis tool Psalm.",
134136
"test": "Run unit tests."
135137
},
136138
"config": {
139+
"sort-packages": true,
137140
"allow-plugins": {
138141
"laminas/laminas-component-installer": true,
139-
"laminas/laminas-skeleton-installer": true
142+
"laminas/laminas-skeleton-installer": true,
143+
"dealerdirect/phpcodesniffer-composer-installer": true
140144
}
141145
}
142146
}

config/container.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
// Retrieve configuration
77
$appConfig = require __DIR__ . '/application.config.php';
88
if (file_exists(__DIR__ . '/development.config.php')) {
9-
$appConfig = ArrayUtils::merge($appConfig, require __DIR__ . '/development.config.php');
9+
/** @var array $devConfig */
10+
$devConfig = require __DIR__ . '/development.config.php';
11+
$appConfig = ArrayUtils::merge($appConfig, $devConfig);
1012
}
1113

1214
return Application::init($appConfig)

laminas-ci.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"additional_composer_arguments": [
3+
"--no-scripts",
4+
"--no-plugins"
5+
],
6+
"ignore_php_platform_requirements": {
7+
}
8+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApplicationTest;
6+
7+
use Application\Module;
8+
use PHPUnit\Framework\TestCase;
9+
10+
/**
11+
* @covers \Application\Module;
12+
*/
13+
class ModuleTest extends TestCase
14+
{
15+
public function testProvidesConfig(): void
16+
{
17+
$module = new Module();
18+
$config = $module->getConfig();
19+
20+
self::assertArrayHasKey('router', $config);
21+
self::assertArrayHasKey('controllers', $config);
22+
}
23+
}

phpcs.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
<exclude-pattern>*.phtml</exclude-pattern>
3131
</rule>
3232
<rule ref="PSR12.Files.FileHeader">
33+
<exclude-pattern>config/*</exclude-pattern>
34+
<exclude-pattern>public/index.php</exclude-pattern>
3335
<exclude-pattern>*.phtml</exclude-pattern>
3436
</rule>
3537

0 commit comments

Comments
 (0)