Skip to content
This repository has been archived by the owner on Sep 30, 2019. It is now read-only.

Commit

Permalink
Phpstan upgrade (#5)
Browse files Browse the repository at this point in the history
* Update phpstan/phpstan requirement from ^0.9.2 to ^0.10.3

Updates the requirements on [phpstan/phpstan](https://github.com/phpstan/phpstan) to permit the latest version.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/commits/0.10.3)

Signed-off-by: dependabot[bot] <[email protected]>

* Made changes for the PHPStan upgrade
  • Loading branch information
ping-localhost authored Sep 21, 2018
1 parent a3543e2 commit 06f576b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
26 changes: 13 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,24 @@
},
"require": {
"php": "^7.1.0",
"doctrine/annotations": "^1.6",
"doctrine/cache": "^1.7.0",
"doctrine/common": "^2.8.0",
"fzaninotto/faker": "^1.7",
"jms/metadata": "^1.6",
"doctrine/annotations": "^1.6.0",
"doctrine/cache": "^1.8.0",
"doctrine/common": "^2.9.0",
"fzaninotto/faker": "^1.8.0",
"jms/metadata": "^1.6.0",
"symfony/dependency-injection": "^3.4.12|^4.0.11",
"symfony/framework-bundle": "^3.4.12|^4.0.11",
"symfony/http-foundation": "^3.4.14|^4.0.14|^4.1.3",
"symfony/yaml": "^3.4.12|^4.0.11"
},
"require-dev": {
"hostnet/phpcs-tool": "^8.0.1",
"jakub-onderka/php-parallel-lint": "^1.0",
"nyholm/symfony-bundle-test": "^1.4",
"phpstan/phpstan": "^0.9.2",
"phpunit/phpunit": "^7.0",
"sebastian/phpcpd": "^4.0",
"sensiolabs/security-checker": "^4.1"
"hostnet/phpcs-tool": "^8.2.0",
"jakub-onderka/php-parallel-lint": "^1.0.0",
"nyholm/symfony-bundle-test": "^1.4.0",
"phpstan/phpstan": "^0.10.3",
"phpunit/phpunit": "^7.3.3",
"sebastian/phpcpd": "^4.0.0",
"sensiolabs/security-checker": "^4.1.8"
},
"conflict": {
"paragonie/random_compat": "<2.0.0"
Expand All @@ -70,7 +70,7 @@
"@composer phpstan"
],
"phpcpd": "./vendor/bin/phpcpd src/",
"phpstan": "./vendor/bin/phpstan analyse --level=4 src",
"phpstan": "./vendor/bin/phpstan analyse --level=3 src",
"security-checker": "./vendor/bin/security-checker security:check ./composer.lock --end-point=http://security.sensiolabs.org/check_lock",
"syntax-check": [
"./vendor/bin/parallel-lint --exclude vendor .",
Expand Down
2 changes: 1 addition & 1 deletion src/Metadata/AnonymizedPropertyMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function setGenerator($generator): void

private function shouldBeExcluded($value): bool
{
if (!is_scalar($this) && \is_object($value) && !method_exists($value, '__toString')) {
if (\is_object($value) && false === method_exists($value, '__toString')) {
return false;
}

Expand Down
9 changes: 8 additions & 1 deletion src/Processor/AnonymizeProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ public function anonymize($object): void
{
/** @var AnonymizedClassMetadata $metadata */
if (null === ($metadata = $this->metadata_factory->getMetadataForClass(\get_class($object)))) {
throw new \RuntimeException(sprintf("Couldn't load the metadata for class %s,", \get_class($object)));
throw new \RuntimeException(sprintf("Couldn't load the metadata for class %s.", \get_class($object)));
}

if (false === ($metadata instanceof AnonymizedClassMetadata)) {
throw new \RuntimeException(sprintf(
'We expected to receive a AnonymizedClassMetadata-class, but got %s.',
\get_class($metadata)
));
}

$property_metadata = $this->getPropertyMetadata($metadata);
Expand Down
2 changes: 1 addition & 1 deletion tests/Processor/AnonymizeProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testAnonymizeNoMetadata(): void
$this->metadata_factory->getMetadataForClass(EmptyObject::class)->willReturn(null);

$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage(sprintf("Couldn't load the metadata for class %s,", EmptyObject::class));
$this->expectExceptionMessage(sprintf("Couldn't load the metadata for class %s.", EmptyObject::class));

$this->anonymize_processor->anonymize($object);
}
Expand Down

0 comments on commit 06f576b

Please sign in to comment.