Skip to content

Commit 5928335

Browse files
committed
Added PHPStan
1 parent 0ecaf9e commit 5928335

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHP Composer
1+
name: PHP tests
22

33
on:
44
push:
@@ -32,5 +32,8 @@ jobs:
3232
- name: Install dependencies
3333
run: composer install --prefer-dist --no-progress
3434

35+
- name: Run PHPStan
36+
run: composer run-script phpstan
37+
3538
- name: Run test suite
3639
run: composer run-script test

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"php": "^8.1"
88
},
99
"require-dev": {
10-
"phpunit/phpunit": "^11.0"
10+
"phpunit/phpunit": "^11.0",
11+
"phpstan/phpstan": "^2.1"
1112
},
1213
"autoload": {
1314
"psr-4": {
@@ -23,6 +24,9 @@
2324
"scripts": {
2425
"test" : [
2526
"vendor/bin/phpunit"
27+
],
28+
"phpstan": [
29+
"vendor/bin/phpstan analyse -l 5 src tests benchmark"
2630
]
2731
},
2832
"minimum-stability": "stable"

src/HNSW/Index.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,7 @@ private function searchLayer(array $query, array $entryPoints, int $ef, int $lay
542542
$dvs = $this->distVectors;
543543

544544
while (!$candidates->isEmpty()) {
545-
/** @var array{float, int} $nearest */
546545
[$cDist, $cId] = $candidates->extract(); // Nearest unprocessed candidate.
547-
/** @var array{float, int} $farthest */
548546
[$fDist] = $found->top(); // Farthest element currently in W.
549547

550548
// All remaining candidates are farther than the worst in W → stop.

tests/VectorDatabaseTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ public function testHybridRRFReturnsSomeResults(): void
125125
);
126126

127127
self::assertNotEmpty($results);
128-
self::assertContainsOnlyInstancesOf(SearchResult::class, $results);
129128
}
130129

131130
public function testHybridRRFScoresAreDescending(): void

0 commit comments

Comments
 (0)