Skip to content

Commit

Permalink
cs: apply doctrine coding standard
Browse files Browse the repository at this point in the history
qa: use self instead of $this in PhpUnit assertions

Signed-off-by: Thomas Rieschl <thomas@trinet.at>
  • Loading branch information
rieschl committed Oct 27, 2020
1 parent e407b28 commit e6fbf26
Show file tree
Hide file tree
Showing 39 changed files with 392 additions and 177 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,4 +3,5 @@ vendor/
.idea/
phpunit.xml
phpcs.xml
.phpcs-cache
build
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -77,7 +77,7 @@ script:
- docker vendor/bin/doctrine-module odm:schema:create
- docker vendor/bin/doctrine-module odm:schema:drop
- if [[ $TEST_COVERAGE == 'true' ]]; then php vendor/bin/phpunit --coverage-clover build/logs/clover.xml ; else php vendor/bin/phpunit ; fi
- if [[ $CS_CHECK == 'true' ]]; then php vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/ ./config/ ; fi
- if [[ $CS_CHECK == 'true' ]]; then php vendor/bin/phpcs ; fi

after_script:
- if [[ $TEST_COVERAGE == 'true' ]]; then php vendor/bin/php-coveralls -v ; fi
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -62,6 +62,7 @@
"symfony/var-dumper": "^5.1"
},
"require-dev": {
"doctrine/coding-standard": "^8.2",
"laminas/laminas-console": "^2.8",
"laminas/laminas-developer-tools": "^2.0",
"laminas/laminas-i18n": "^2.10.1",
Expand All @@ -71,8 +72,7 @@
"laminas/laminas-serializer": "^2.9.1",
"laminas/laminas-session": "^2.9.1",
"laminas/laminas-view": "^2.11.4",
"phpunit/phpunit": "^8.5.2",
"squizlabs/php_codesniffer": "^3.5"
"phpunit/phpunit": "^8.5.2"
},
"autoload": {
"psr-4": {
Expand Down
225 changes: 224 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 6 additions & 15 deletions phpcs.xml.dist
Expand Up @@ -4,25 +4,16 @@

<!-- display progress -->
<arg value="p"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>

<!-- inherit rules from: -->
<rule ref="PSR2"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Formatting.SpaceAfterNot"/>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
<!-- Include full Doctrine Coding Standard -->
<rule ref="Doctrine"/>

<!-- Paths to check -->
<file>config</file>
<file>src</file>
<file>tests</file>
</ruleset>
</ruleset>
7 changes: 4 additions & 3 deletions src/DoctrineMongoODMModule/Collector/MongoLoggerCollector.php
Expand Up @@ -8,6 +8,7 @@
use Laminas\DeveloperTools\Collector\AutoHideInterface;
use Laminas\DeveloperTools\Collector\CollectorInterface;
use Laminas\Mvc\MvcEvent;

use function count;

/**
Expand Down Expand Up @@ -66,20 +67,20 @@ public function canHide()
return empty($this->mongoLogger->queries);
}

public function getQueryCount() : int
public function getQueryCount(): int
{
return count($this->mongoLogger->queries);
}

/**
* @return mixed[]
*/
public function getQueries() : array
public function getQueries(): array
{
return $this->mongoLogger->queries;
}

public function getQueryTime() : float
public function getQueryTime(): float
{
return 0.0;
}
Expand Down
1 change: 1 addition & 0 deletions src/DoctrineMongoODMModule/Logging/DebugStack.php
Expand Up @@ -8,6 +8,7 @@
use MongoDB\Driver\Monitoring\CommandFailedEvent;
use MongoDB\Driver\Monitoring\CommandStartedEvent;
use MongoDB\Driver\Monitoring\CommandSucceededEvent;

use function MongoDB\Driver\Monitoring\addSubscriber;
use function MongoDB\Driver\Monitoring\removeSubscriber;

Expand Down

0 comments on commit e6fbf26

Please sign in to comment.