Skip to content

Commit 52efd85

Browse files
authored
Merge pull request #113 from phpcr/fix-throw-annotations
fix exception class names
2 parents b99d628 + c620f13 commit 52efd85

36 files changed

+399
-144
lines changed

.github/workflows/static.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Static analysis
2+
3+
on:
4+
push:
5+
branches:
6+
- '[0-9]+.x'
7+
- '[0-9]+.[0-9]+'
8+
- '[0-9]+.[0-9]+.x'
9+
pull_request:
10+
11+
jobs:
12+
phpstan-src:
13+
name: PHPStan src
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: '8.1'
21+
extensions: "curl,dom,json,xml,dom"
22+
coverage: none
23+
24+
- name: Checkout code
25+
uses: actions/checkout@v3
26+
27+
# have to install phpstan ourselves here, the phpstan-ga fails at composer install with weird errors
28+
- name: Install phpstan
29+
run: |
30+
composer require --no-update phpstan/phpstan
31+
composer update --no-dev
32+
33+
- name: PHPStan
34+
run: vendor/bin/phpstan analyze --no-progress
35+
36+
phpstan-tests:
37+
name: PHPStan tests
38+
runs-on: ubuntu-latest
39+
env:
40+
REQUIRE_DEV: "true"
41+
42+
steps:
43+
- name: Setup PHP
44+
uses: shivammathur/setup-php@v2
45+
with:
46+
php-version: '8.1'
47+
extensions: "curl,dom,json,xml,dom"
48+
coverage: none
49+
50+
- name: Checkout code
51+
uses: actions/checkout@v3
52+
53+
- name: Install phpstan
54+
run: |
55+
composer require --no-update phpstan/phpstan
56+
composer update
57+
58+
- name: PHPStan
59+
run: vendor/bin/phpstan analyze --no-progress -c phpstan.tests.neon.dist
60+
61+
php-cs-fixer:
62+
name: PHP-CS-Fixer
63+
runs-on: ubuntu-latest
64+
65+
steps:
66+
- name: Checkout code
67+
uses: actions/checkout@v3
68+
69+
- name: PHP-CS-Fixer
70+
uses: docker://oskarstark/php-cs-fixer-ga
71+
with:
72+
args: --dry-run --diff

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.php-cs-fixer.cache
12
.buildpath
23
.project
34
.settings/

.php-cs-fixer.dist.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__.'/src')
5+
->in(__DIR__.'/tests')
6+
->name('*.php')
7+
;
8+
9+
$config = new PhpCsFixer\Config();
10+
11+
return $config
12+
->setRiskyAllowed(true)
13+
->setRules([
14+
'@Symfony' => true,
15+
'single_line_throw' => false,
16+
'visibility_required' => ['elements' => ['method', 'property']], // const only possible once we drop PHP 5.6 support
17+
])
18+
->setFinder($finder)
19+
;

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
2.1.10
5+
------
6+
7+
* **2023-12-02**: PHPDoc fixes with phpstan.
8+
49
2.1.9
510
-----
611

phpstan.neon.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parameters:
2+
level: 7
3+
treatPhpDocTypesAsCertain: false
4+
paths:
5+
- src

phpstan.tests.neon.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
parameters:
2+
level: 5
3+
paths:
4+
- tests

src/PHPCR/ItemInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ public function isSame(ItemInterface $otherItem);
211211
*
212212
* @param ItemVisitorInterface $visitor the ItemVisitor to be accepted
213213
*
214+
* @return void
215+
*
214216
* @throws RepositoryException if an error occurs
215217
*
216218
* @api
@@ -228,6 +230,8 @@ public function accept(ItemVisitorInterface $visitor);
228230
* persistent storage as modified by changes that have been saved but not
229231
* yet committed.
230232
*
233+
* @return void
234+
*
231235
* @throws InvalidItemStateException if this <code>Item</code> object represents a workspace item
232236
* that has been removed (either by this session or another)
233237
* @throws RepositoryException if another error occurs
@@ -248,6 +252,8 @@ public function revert();
248252
* and causes the minimal re-numbering required to maintain the original
249253
* order but leave no gaps in the numbering.
250254
*
255+
* @return void
256+
*
251257
* @throws VersionException if the parent node of this item is versionable and
252258
* checked-in or is non-versionable but its nearest
253259
* versionable ancestor is checked-in and this

src/PHPCR/ItemVisitorInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ interface ItemVisitorInterface
3232
*
3333
* @param ItemInterface $item a node or property accepting this visitor
3434
*
35+
* @return void
36+
*
3537
* @throws RepositoryException if an error occurs
3638
*
3739
* @api

src/PHPCR/Lock/LockInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ public function isLockOwningSession();
146146
* If this lock's time-to-live is not governed by a timer, then this method
147147
* has no effect.
148148
*
149+
* @return void
150+
*
149151
* @throws LockException if this Session does not hold the correct lock
150152
* token for this lock
151153
* @throws RepositoryException if another error occurs

src/PHPCR/Lock/LockManagerInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ interface LockManagerInterface extends \Traversable
3333
*
3434
* @param string $lockToken a lock token (a string)
3535
*
36+
* @return void
37+
*
3638
* @throws LockException if the specified lock token is already held by another Session
3739
* and the implementation does not support simultaneous ownership
3840
* of open-scoped locks
@@ -207,6 +209,8 @@ public function isLocked($absPath);
207209
*
208210
* @param string $lockToken - a lock token
209211
*
212+
* @return void
213+
*
210214
* @throws LockException if the current Session does not hold the specified lock token
211215
* @throws RepositoryException if another error occurs
212216
*
@@ -235,6 +239,8 @@ public function removeLockToken($lockToken);
235239
*
236240
* @param string $absPath the absolute path of node to be unlocked
237241
*
242+
* @return void
243+
*
238244
* @throws LockException if this node does not currently hold a lock or holds a lock
239245
* for which this Session does not have the correct lock token
240246
* @throws AccessDeniedException if the current session does not have permission to unlock this node

0 commit comments

Comments
 (0)