Skip to content

Commit 1d55207

Browse files
authored
Merge pull request #42 from niden-code/develop
PHPStan
2 parents 115c837 + b2c7b88 commit 1d55207

File tree

77 files changed

+2034
-3583
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2034
-3583
lines changed

.github/workflows/main.yml

Lines changed: 52 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ env:
2525
LANGUAGE: en_US.UTF-8
2626
LC_ALL: en_US.UTF-8
2727

28-
# Windows specific
29-
TOOLS_DIR: 'C:\tools'
30-
3128
# PHP extensions required by Composer
3229
EXTENSIONS: intl, json, mbstring, msgpack
3330

@@ -38,22 +35,22 @@ jobs:
3835
name: "Validate Tests code style"
3936
if: "!contains(github.event.head_commit.message, 'ci skip')"
4037

41-
# needs: [ generate ]
42-
4338
permissions:
4439
contents: read
4540

46-
runs-on: ubuntu-20.04
41+
runs-on: ubuntu-latest
4742

4843
strategy:
4944
fail-fast: true
5045
matrix:
5146
php:
52-
- '8.0'
5347
- '8.1'
5448
- '8.2'
49+
- '8.3'
50+
- '8.4'
51+
5552
steps:
56-
- uses: actions/checkout@v3
53+
- uses: actions/checkout@v4
5754

5855
- name: "Setup PHP"
5956
uses: shivammathur/setup-php@v2
@@ -66,13 +63,17 @@ jobs:
6663
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6764

6865
- name: "Install development dependencies with Composer"
69-
uses: "ramsey/composer-install@v2"
66+
uses: "ramsey/composer-install@v3"
7067
with:
7168
composer-options: "--prefer-dist"
7269

73-
- name: "PHPCS"
70+
- name: "Code Sniffer"
71+
run: |
72+
composer cs
73+
74+
- name: "Code Analysis"
7475
run: |
75-
vendor/bin/phpcs --standard=./phpcs.xml
76+
composer cs
7677
7778
7879
unit-tests:
@@ -81,49 +82,30 @@ jobs:
8182
permissions:
8283
contents: read # to fetch code (actions/checkout)
8384

84-
name: Unit tests / PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}
85-
runs-on: ${{ matrix.os }}
85+
name: Unit tests / PHP-${{ matrix.php }}
86+
runs-on: ubuntu-latest
8687

8788
strategy:
8889
matrix:
8990
php:
90-
- '8.0'
9191
- '8.1'
9292
- '8.2'
93-
ts:
94-
- 'nts'
95-
- 'ts'
96-
name:
97-
- ubuntu-gcc
98-
- macos-clang
99-
# matrix names should be in next format:
100-
# {php}-{ts}-{os.name}-{compiler}-{arch}
101-
include:
102-
# Linux
103-
- { name: ubuntu-gcc, os: ubuntu-20.04, compiler: gcc }
104-
# macOS
105-
- { name: macos-clang, os: macos-11, compiler: clang }
106-
# Windows
107-
- { php: '8.0', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' }
108-
- { php: '8.0', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' }
109-
- { php: '8.1', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' }
110-
- { php: '8.1', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' }
93+
- '8.3'
94+
- '8.4'
11195

11296
steps:
113-
- uses: actions/checkout@v3
97+
- uses: actions/checkout@v4
11498
- name: "Setup platform specific environment"
11599
shell: pwsh
116100
run: |
117101
git config --global core.autocrlf false
118-
$SessionSavePath = if ("${{ runner.os }}" -eq "Windows") { 'C:\temp' } else { '/tmp' }
119-
Write-Output "SESSION_SAVE_PATH=$SessionSavePath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
120102
121103
- name: "Setup PHP"
122104
uses: shivammathur/setup-php@v2
123105
with:
124106
php-version: ${{ matrix.php }}
125107
extensions: ${{ env.EXTENSIONS }}
126-
ini-values: apc.enable_cli=on, session.save_path=${{ env.SESSION_SAVE_PATH }}
108+
ini-values: apc.enable_cli=on
127109
tools: pecl, composer:v2
128110
coverage: pcov
129111
env:
@@ -134,65 +116,71 @@ jobs:
134116
run: composer validate --no-check-all --no-check-publish
135117

136118
- name: "Install development dependencies with Composer"
137-
uses: "ramsey/composer-install@v2"
119+
uses: "ramsey/composer-install@v3"
138120
with:
139121
composer-options: "--prefer-dist"
140122

141123
- name: "Setup Tests"
142124
shell: bash
143125
run: |
144-
cp config/.env.example .env
145-
vendor/bin/codecept build
126+
cp -v config/.env.example .env
146127
147128
- name: "Run Unit Tests"
148129
if: always()
149130
run: |
150-
vendor/bin/codecept run --coverage-xml=coverage.xml --ext DotReporter unit
131+
composer test-unit-coverage
151132
152133
- name: "Upload coverage file artifact"
153-
uses: "actions/upload-artifact@v3"
134+
uses: "actions/upload-artifact@v4"
154135
with:
155-
name: "unit-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}.coverage"
136+
name: "unit-${{ matrix.php }}.coverage"
156137
path: "tests/_output/coverage.xml"
157138

158139
upload-coverage:
159140
permissions:
160141
contents: read
161142

162-
name: "Upload coverage to Codecov/Codacy"
163-
runs-on: "ubuntu-22.04"
143+
name: "Upload coverage to Sonarcloud"
144+
runs-on: ubuntu-latest
164145
needs:
165146
- "unit-tests"
166147

167148
steps:
168149
- name: "Checkout"
169-
uses: "actions/checkout@v3"
150+
uses: "actions/checkout@v4"
170151
with:
171-
fetch-depth: 2
152+
fetch-depth: 0
172153

173154
- name: "Display structure of downloaded files"
174155
run: |
175-
mkdir -p reports
156+
mkdir -p cv
176157
177158
- name: "Download coverage files"
178-
uses: "actions/download-artifact@v3"
159+
uses: "actions/download-artifact@v4"
179160
with:
180-
path: "reports"
161+
path: "cv"
181162

182163
- name: "Display structure of downloaded files"
183-
run: ls -R
184-
working-directory: reports
185-
186-
- name: "Upload to Codecov"
187-
uses: "codecov/codecov-action@v3"
188-
with:
189-
token: ${{ secrets.CODECOV_TOKEN }}
190-
directory: reports
191-
fail_ci_if_error: true
192-
verbose: true
193-
194-
- name: "Upload to Codacy"
195-
uses: codacy/codacy-coverage-reporter-action@v1
164+
run: |
165+
mv cv/unit-8.1.coverage/coverage.xml cv/01.xml
166+
mv cv/unit-8.2.coverage/coverage.xml cv/02.xml
167+
mv cv/unit-8.3.coverage/coverage.xml cv/03.xml
168+
mv cv/unit-8.4.coverage/coverage.xml cv/04.xml
169+
ls -la cv/
170+
171+
- name: SonarCloud Scan
172+
uses: SonarSource/[email protected]
173+
env:
174+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
175+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
196176
with:
197-
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
198-
coverage-reports: reports/unit-8.0-ts-ubuntu-gcc.coverage/coverage.xml, reports/unit-8.1-ts-ubuntu-gcc.coverage/coverage.xml, reports/unit-8.2-ts-ubuntu-gcc.coverage/coverage.xml
177+
projectBaseDir: ./
178+
args: >
179+
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }}
180+
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}
181+
-Dsonar.sources=src/
182+
-Dsonar.exclusions=vendor/**,cv/**,tests/**
183+
-Dsonar.sourceEncoding=UTF-8
184+
-Dsonar.language=php
185+
-Dsonar.tests=tests/
186+
-Dsonar.php.coverage.reportPaths=cv/01.xml,cv/02.xml,cv/03.xml,cv/04.xml

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020-present The Phalcon PHP Framework
3+
Copyright (c) 2012-present The Phalcon PHP Framework
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 0 additions & 26 deletions
This file was deleted.

codeception.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

composer.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"autoload": {
2020
"psr-4": {
2121
"Phalcon\\Traits\\": "src/",
22-
"Phalcon\\Tests\\Fixtures\\": "tests/_data/fixtures/",
22+
"Phalcon\\Tests\\Fixtures\\": "tests/support/fixtures/",
2323
"Phalcon\\Tests\\Unit\\": "tests/unit/"
2424
}
2525
},
@@ -35,8 +35,16 @@
3535
"codeception/module-phpbrowser": "^3.0",
3636
"pds/skeleton": "^1.0",
3737
"phpstan/phpstan": "^1.9",
38+
"phpunit/phpunit": "^10.5",
3839
"squizlabs/php_codesniffer": "^3.7",
39-
"vimeo/psalm": "^5.4",
4040
"vlucas/phpdotenv": "^5.5"
41+
},
42+
"scripts": {
43+
"analyze": "vendor/bin/phpstan analyse -c config/phpstan.neon",
44+
"cs": "vendor/bin/phpcs --standard=./config/phpcs.xml",
45+
"cs-fix": "vendor/bin/phpcbf --standard=./config/phpcs.xml",
46+
"test-unit": "vendor/bin/phpunit -c ./config/phpunit.xml.dist",
47+
"test-unit-coverage": "vendor/bin/phpunit -c ./config/phpunit.xml.dist --coverage-clover tests/_output/coverage.xml",
48+
"test-unit-coverage-html": "vendor/bin/phpunit -c ./config/phpunit.xml.dist --coverage-html tests/_output/coverage/"
4149
}
4250
}

0 commit comments

Comments
 (0)