Skip to content
Open
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"doctrine/orm": "^2.15|^3.0",
"friendsofphp/php-cs-fixer": "^3.34",
"laravel/framework": "^10.0|^11.0",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan": "^2.1.31",
"phpunit/phpunit": "^10.4",
"symfony/dependency-injection": "^6.0|^7.0",
"symfony/framework-bundle": "^6.0|^7.0",
Expand Down
18 changes: 17 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,24 @@ parameters:
- src
- tests
excludePaths:
- src/DependencyInjection/DbToolsConfiguration.php
- src/DependencyInjection/DbToolsConfiguration.php (?)
checkMissingOverrideMethodAttribute: true
treatPhpDocTypesAsCertain: false
ignoreErrors:
- '#Instantiated class Seld\\PharUtils\\Timestamps not found.#'
- '#on an unknown class Seld\\PharUtils\\Timestamps.#'
#- '#Call to method PHPUnit\\Framework\\Assert::assertNotNull\(\) with array<string, mixed> will always evaluate to true.#'
- '#Call to static method PHPUnit\\Framework\\Assert::assertNotNull\(\) with string will always evaluate to true.#'
- '#Call to method PHPUnit\\Framework\\Assert::assertNotNull\(\) with int will always evaluate to true.#'
- '#Call to method PHPUnit\\Framework\\Assert::assertNotNull\(\) with float will always evaluate to true.#'
- '#Property MakinaCorpus\\DbToolsBundle\\Tests\\Resources\\Loader\\TestJoinedChild::\$url \(string\|null\) is never assigned string so it can be removed from the property type.#'
- '#Property MakinaCorpus\\DbToolsBundle\\Tests\\Resources\\Loader\\TestJoinedChild::\$thumbnail_url \(string\|null\) is never assigned string so it can be removed from the property type.#'
- '#Property MakinaCorpus\\DbToolsBundle\\Tests\\Resources\\Loader\\TestEntity::\$id \(int\|null\) is never assigned int so it can be removed from the property type.#'
- '#Call to function assert\(\) with true will always evaluate to true.#'
- '#Strict comparison using !== between Symfony\\Component\\Finder\\SplFileInfo and string\|null will always evaluate to true.#'
- '#Instanceof between MakinaCorpus\\DbToolsBundle\\Backupper\\MariadbBackupper\|MakinaCorpus\\DbToolsBundle\\Backupper\\MysqlBackupper\|MakinaCorpus\\DbToolsBundle\\Backupper\\PgsqlBackupper\|MakinaCorpus\\DbToolsBundle\\Backupper\\SqliteBackupper and MakinaCorpus\\DbToolsBundle\\Backupper\\AbstractBackupper will always evaluate to true.#'
- '#Instanceof between MakinaCorpus\\DbToolsBundle\\Restorer\\MariadbRestorer\|MakinaCorpus\\DbToolsBundle\\Restorer\\MysqlRestorer\|MakinaCorpus\\DbToolsBundle\\Restorer\\PgsqlRestorer\|MakinaCorpus\\DbToolsBundle\\Restorer\\SqliteRestorer and MakinaCorpus\\DbToolsBundle\\Restorer\\AbstractRestorer will always evaluate to true.#'
- '#Method MakinaCorpus\\DbToolsBundle\\Bridge\\Symfony\\DependencyInjection\\DbToolsExtension::getConfiguration\(\) never returns null so it can be removed from the return type.#'
- '#Property MakinaCorpus\\DbToolsBundle\\Tests\\Resources\\Loader\\TestEntityWithEmbedded::\$id \(int\|null\) is never assigned int so it can be removed from the property type.#'
- '#Property MakinaCorpus\\DbToolsBundle\\Tests\\Resources\\Loader\\TestJoinedParent::\$id \(int\|null\) is never assigned int so it can be removed from the property type.#'
- '#Property MakinaCorpus\\DbToolsBundle\\Tests\\Resources\\Loader\\TestJoinedParent::\$email \(string\|null\) is never assigned string so it can be removed from the property type.#'
Comment on lines +13 to +27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well that's a lot of ignore ! ^^

Even if that's not what we always did, we prefer to keep these phpstan ignores the closest to the code we can.
Can you put those with some // @phpstan-ignore ... in php files instead ?

Also with those ignore in the code, we can better appreciate if they are legitimate or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can i create a baseline file? This will be faster

1 change: 0 additions & 1 deletion src/Anonymization/Anonymizer/Core/DateAnonymizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ protected function validateOptions(): void
throw new \InvalidArgumentException("You must specify both 'min' and 'max' boundaries.");
}

// @phpstan-ignore-next-line False positive detected.
if ($min && $max) {
if ($max <= $min) {
throw new \InvalidArgumentException("'min' value must be less than 'max' value.");
Expand Down
4 changes: 2 additions & 2 deletions src/Helper/LoremIpsum.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ private function shuffle(): void
* the injection of commas as well as capitalizing the first letter of the
* first word of the sentence.
*
* @param array<string> $words
* @param array<int, string> $words
* Word array.
* @return string
* Punctuated sentence.
Expand All @@ -287,7 +287,7 @@ private function punctuate(array $words): string
$commas = $this->gauss($mean, $std_dev);

for ($i = 1; $i <= $commas; $i++) {
$word = \round($i * $word_count / ($commas + 1));
$word = (int) \round($i * $word_count / ($commas + 1));

if ($word < ($word_count - 1) && $word > 0) {
$words[$word] .= ',';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private function getContainer(array $parameters = [], array $bundles = []): Cont
return $container;
}

private function testExtension(array $config, ContainerBuilder $container = null): void
private function testExtension(array $config, ?ContainerBuilder $container = null): void
{
$container ??= $this->getContainer();
$extension = new DbToolsExtension();
Expand Down