Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 0 additions & 91 deletions .circleci/config.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3', '8.4', '8.5']
symfony: ['^7.0']

name: PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: zip, sqlite3
coverage: none

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: vendor
key: composer-deps-${{ matrix.php }}-${{ hashFiles('composer.json') }}
restore-keys: |
composer-deps-${{ matrix.php }}-

- name: Install dependencies
run: COMPOSER_MEMORY_LIMIT=-1 composer require "symfony/framework-bundle=${{ matrix.symfony }}" -n --prefer-dist

- name: Run static analysis
run: composer test:install && composer test:types

- name: Check code styles
run: composer test:lint

- name: Run tests
if: ${{ !github.event.pull_request.head.repo.fork }}
timeout-minutes: 15
env:
COMPOSER_PROCESS_TIMEOUT: 900
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_PREFIX: sf_phpunit_${{ matrix.php }}_
run: composer test:unit
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"doctrine/event-manager": "^1.1 || ^2.0",
"doctrine/persistence": "^2.1 || ^3.0",
"symfony/filesystem": "^7.0",
"symfony/http-kernel": "^7.0",
"symfony/property-access": "^7.0",
"symfony/serializer": "^7.0"
},
Expand Down
5 changes: 1 addition & 4 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
includes:
- tests/QualityTools/vendor/phpstan/phpstan-strict-rules/rules.neon
- tests/QualityTools/vendor/localheinz/phpstan-rules/rules.neon
- tests/QualityTools/vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
- tests/QualityTools/vendor/ergebnis/phpstan-rules/rules.neon

parameters:
level: 3
Expand All @@ -14,8 +13,6 @@ parameters:
- '#File is missing a "declare\(strict_types=1\)" declaration.#'
- '#Method Algolia\\SearchBundle\\DependencyInjection\\AlgoliaSearchExtension::load\(\) has a parameter .* with a type declaration of Symfony\\Component\\DependencyInjection\\ContainerBuilder, but containers should not be injected.#'
- '#(Method|Function|Constructor).*has parameter.*with.*default value.#'
- '#Class Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder constructor#'
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder::root\(\).#'
- '#Class Algolia\\SearchBundle\\Services\\NullSearchService is neither abstract nor final.#'
- '#Class Algolia\\SearchBundle\\Settings\\SettingsManager is neither abstract nor final.#'
- '#Class Algolia\\SearchBundle\\EventListener\\SearchIndexerSubscriber is neither abstract nor final.#'
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<env name="APP_ENV" value="test"/>
<env name="APP_DEBUG" value="false"/>
<env name="ALGOLIA_PREFIX" value="sf_phpunit_"/>
<env name="CIRCLE_BUILD_NUM" value=""/>
<env name="GITHUB_RUN_NUMBER" value=""/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
</php>
<testsuites>
Expand Down
5 changes: 1 addition & 4 deletions src/AlgoliaSearchBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ final class AlgoliaSearchBundle extends Bundle
*/
public const VERSION = '7.0.0';

/**
* @return void
*/
public function boot()
public function boot(): void
{
parent::boot();

Expand Down
2 changes: 1 addition & 1 deletion src/Command/SearchImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(
SearchService $searchService,
SearchService $searchServiceForAtomicReindex,
ManagerRegistry $managerRegistry,
SearchClient $searchClient
SearchClient $searchClient,
) {
parent::__construct($searchService);

Expand Down
11 changes: 2 additions & 9 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,8 @@ final class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
{
if (\method_exists(TreeBuilder::class, 'getRootNode')) {
$treeBuilder = new TreeBuilder('algolia_search');
$rootNode = $treeBuilder->getRootNode();
} else {
// @codeCoverageIgnoreStart
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('algolia_search');
// @codeCoverageIgnoreEnd
}
$treeBuilder = new TreeBuilder('algolia_search');
$rootNode = $treeBuilder->getRootNode();

$rootNode
->children()
Expand Down
2 changes: 1 addition & 1 deletion src/SearchableEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private function setId()
throw new Exception('Entity has no primary key');
}

if (1 == count($ids)) {
if (1 === count($ids)) {
$this->id = reset($ids);
} else {
$objectID = '';
Expand Down
7 changes: 3 additions & 4 deletions tests/QualityTools/composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"require-dev": {
"phpstan/phpstan": "^1.11",
"localheinz/phpstan-rules": "^2.2",
"phpstan/phpstan-strict-rules": "^1.6",
"thecodingmachine/phpstan-strict-rules": "^1.0"
"phpstan/phpstan": "^2.1",
"ergebnis/phpstan-rules": "^2.13",
"phpstan/phpstan-strict-rules": "^2.0"
}
}
12 changes: 9 additions & 3 deletions tests/TestCase/ClientProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ public static function tearDownAfterClass(): void

public function testClientIsProxied(): void
{
$interfaces = class_implements($this->get('search.client'));

self::assertContains(LazyObjectInterface::class, $interfaces);
$client = $this->get('search.client');

if (PHP_VERSION_ID >= 80400) {
$reflector = new \ReflectionClass($client);
self::assertTrue($reflector->isUninitializedLazyObject($client));
} else {
$interfaces = class_implements($client);
self::assertContains(LazyObjectInterface::class, $interfaces);
}
}

public function testProxiedClientFailIfNoEnvVarsFound(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/config/algolia_search.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
algolia_search:
prefix: '%env(ALGOLIA_PREFIX)%%env(CIRCLE_BUILD_NUM)%_'
prefix: '%env(ALGOLIA_PREFIX)%%env(GITHUB_RUN_NUMBER)%_'
nbResults: 12
batchSize: 100
settingsDirectory: '/tests/cache/settings'
Expand Down
Loading