Skip to content

Commit

Permalink
Merge branch 'master' into 2311_drop_symfony_34
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean85 committed Jan 15, 2024
2 parents 5a4b315 + 0161ad7 commit 5be946b
Show file tree
Hide file tree
Showing 46 changed files with 97 additions and 418 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
- php: 8.2
mongo-ext: 1.15.0
mongo-img: 6.0
- php: 8.3
mongo-ext: 1.16.0
mongo-img: 6.0

steps:
- name: Checkout
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/vendor/
/bin/
.php_cs.cache
/.php-cs-fixer.php
/.php-cs-fixer.cache
docker-compose.override.yml
.phpunit.result.cache
auth.json
Expand Down
14 changes: 10 additions & 4 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
* Additional rules or rules to override.
* These rules will be added to default rules or will override them if the same key already exists.
*/

$additionalRules = [];

$additionalRules = [
'blank_line_after_opening_tag' => false,
];

$rulesProvider = new Facile\CodingStandards\Rules\CompositeRulesProvider([
new Facile\CodingStandards\Rules\DefaultRulesProvider(),
new Facile\CodingStandards\Rules\ArrayRulesProvider($additionalRules),
]);

$config = PhpCsFixer\Config::create();
$config->setRules($rulesProvider->getRules());
$config = new PhpCsFixer\Config();
$config
->setUsingCache(true)
->setRiskyAllowed(true)
->setRules($rulesProvider->getRules());

$finder = PhpCsFixer\Finder::create();

Expand Down
24 changes: 0 additions & 24 deletions .php-cs.php

This file was deleted.

10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"symfony/web-profiler-bundle": "^4.4 || ^5.0 || ^6.0",
"symfony/console": "^4.4 || ^5.0 || ^6.0",
"phpunit/phpunit": "^9.6.13",
"symfony/phpunit-bridge": "^6.0",
"facile-it/facile-coding-standard": "^0.4.0",
"phpstan/phpstan": "1.10.41",
"symfony/phpunit-bridge": "^7.0",
"facile-it/facile-coding-standard": "^1.0.1",
"phpstan/phpstan": "1.10.50",
"phpstan/extension-installer": "1.3.1",
"jangregor/phpstan-prophecy": "1.0.0",
"phpspec/prophecy": "^1.17",
Expand Down Expand Up @@ -66,8 +66,8 @@
}
},
"scripts": {
"cs-check": "php-cs-fixer fix --dry-run --diff --config=.php-cs.php",
"cs-fix": "php-cs-fixer fix --diff --config=.php-cs.php",
"cs-check": "php-cs-fixer fix --dry-run --diff",
"cs-fix": "php-cs-fixer fix --diff",
"test": "bin/phpunit tests"
}
}
19 changes: 17 additions & 2 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
parameters:
ignoreErrors:
-
message: "#^PHPDoc tag @var has invalid value \\(\\$profiler \\\\Symfony\\\\Component\\\\HttpKernel\\\\Profiler\\\\Profiler\\)\\: Unexpected token \"\\$profiler\", expected type at offset 9$#"
message: "#^Parameter \\#1 \\$event of method Symfony\\\\Contracts\\\\EventDispatcher\\\\EventDispatcherInterface\\:\\:dispatch\\(\\) expects object, string given\\.$#"
count: 2
path: src/Capsule/Collection.php

-
message: "#^Parameter \\#2 \\$eventName of method Symfony\\\\Contracts\\\\EventDispatcher\\\\EventDispatcherInterface\\:\\:dispatch\\(\\) expects string\\|null, Facile\\\\MongoDbBundle\\\\Event\\\\QueryEvent given\\.$#"
count: 2
path: src/Capsule/Collection.php

-
message: "#^Variable \\$data on left side of \\?\\? always exists and is not nullable\\.$#"
count: 1
path: src/Controller/ProfilerController.php
path: src/Capsule/Collection.php

-
message: "#^Variable \\$filters on left side of \\?\\? always exists and is not nullable\\.$#"
count: 1
path: src/Capsule/Collection.php

-
message: "#^Property Facile\\\\MongoDbBundle\\\\Controller\\\\ProfilerController\\:\\:\\$container \\(Symfony\\\\Component\\\\DependencyInjection\\\\Container\\) does not accept Symfony\\\\Component\\\\DependencyInjection\\\\ContainerInterface\\|null\\.$#"
Expand Down
8 changes: 2 additions & 6 deletions src/Capsule/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ final class Client extends MongoClient
* Client constructor.
*
* @param string $uri
* @param array $uriOptions
* @param array $driverOptions
* @param string $clientName
* @param EventDispatcherInterface $eventDispatcher
*
* @internal param DataCollectorLoggerInterface $logger
*/
Expand All @@ -44,7 +40,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function selectDatabase($databaseName, array $options = [])
{
Expand All @@ -57,7 +53,7 @@ public function selectDatabase($databaseName, array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function selectCollection($databaseName, $collectionName, array $options = [])
{
Expand Down
50 changes: 12 additions & 38 deletions src/Capsule/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ final class Collection extends MongoCollection
/** @var string */
private $databaseName;

/**
* @param Manager $manager
* @param string $clientName
* @param string $databaseName
* @param string $collectionName
* @param array $options
* @param EventDispatcherInterface $eventDispatcher
*/
public function __construct(
Manager $manager,
string $clientName,
Expand All @@ -49,7 +41,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function aggregate(array $pipeline, array $options = [])
{
Expand All @@ -61,7 +53,7 @@ public function aggregate(array $pipeline, array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function count($filter = [], array $options = [])
{
Expand All @@ -73,7 +65,7 @@ public function count($filter = [], array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function find($filter = [], array $options = [])
{
Expand All @@ -85,7 +77,7 @@ public function find($filter = [], array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function findOne($filter = [], array $options = [])
{
Expand All @@ -97,7 +89,7 @@ public function findOne($filter = [], array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function findOneAndUpdate($filter, $update, array $options = [])
{
Expand All @@ -109,7 +101,7 @@ public function findOneAndUpdate($filter, $update, array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function findOneAndDelete($filter, array $options = [])
{
Expand All @@ -121,7 +113,7 @@ public function findOneAndDelete($filter, array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function deleteMany($filter, array $options = [])
{
Expand All @@ -133,7 +125,7 @@ public function deleteMany($filter, array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function deleteOne($filter, array $options = [])
{
Expand All @@ -145,7 +137,7 @@ public function deleteOne($filter, array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function replaceOne($filter, $replacement, array $options = [])
{
Expand All @@ -157,7 +149,7 @@ public function replaceOne($filter, $replacement, array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function insertOne($document, array $options = [])
{
Expand All @@ -169,7 +161,7 @@ public function insertOne($document, array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function updateOne($filter, $update, array $options = [])
{
Expand All @@ -181,7 +173,7 @@ public function updateOne($filter, $update, array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function distinct($fieldName, $filter = [], array $options = [])
{
Expand All @@ -193,12 +185,8 @@ public function distinct($fieldName, $filter = [], array $options = [])
}

/**
* @param string $method
* @param array|object $filters
* @param array|object $data
* @param array $options
*
* @return Query
*/
private function prepareQuery(string $method, $filters, $data, array $options): Query
{
Expand All @@ -220,11 +208,6 @@ private function prepareQuery(string $method, $filters, $data, array $options):
return $query;
}

/**
* @param ReadPreference $readPreference
*
* @return string
*/
private function translateReadPreference(ReadPreference $readPreference): string
{
switch ($readPreference->getMode()) {
Expand All @@ -243,9 +226,6 @@ private function translateReadPreference(ReadPreference $readPreference): string
}
}

/**
* @param Query $queryLog
*/
private function notifyQueryExecution(Query $queryLog)
{
$queryLog->setExecutionTime(microtime(true) - $queryLog->getStart());
Expand All @@ -258,17 +238,11 @@ private function notifyQueryExecution(Query $queryLog)
}
}

/**
* @return string
*/
public function getClientName(): string
{
return $this->clientName;
}

/**
* @return string
*/
public function getDatabaseName(): string
{
return $this->databaseName;
Expand Down
10 changes: 2 additions & 8 deletions src/Capsule/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ final class Database extends MongoDatabase
/**
* Database constructor.
*
* @param Manager $manager
* @param string $clientName
* @param string $databaseName
* @param array $options
* @param EventDispatcherInterface $eventDispatcher
*
* @internal param DataCollectorLoggerInterface $logger
*/
public function __construct(
Expand All @@ -49,7 +43,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function selectCollection($collectionName, array $options = [])
{
Expand All @@ -72,7 +66,7 @@ public function selectCollection($collectionName, array $options = [])
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function withOptions(array $options = [])
{
Expand Down
6 changes: 2 additions & 4 deletions src/Command/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ abstract class AbstractCommand extends Command

/**
* AbstractCommand constructor.
*
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container, string $name = null)
{
Expand All @@ -43,7 +41,7 @@ protected function getContainer(): ContainerInterface
}

/**
* {@inheritdoc}
* @inheritDoc
*/
protected function configure()
{
Expand All @@ -53,7 +51,7 @@ protected function configure()
}

/**
* {@inheritdoc}
* @inheritDoc
*/
protected function initialize(InputInterface $input, OutputInterface $output)
{
Expand Down
Loading

0 comments on commit 5be946b

Please sign in to comment.