Skip to content

Commit

Permalink
Fixed phpstan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jbtronics committed Jan 7, 2024
1 parent b79e607 commit bc12c35
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/DependencyInjection/SettingsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
namespace Jbtronics\SettingsBundle\DependencyInjection;

use Jbtronics\SettingsBundle\ParameterTypes\ParameterTypeInterface;
use Jbtronics\SettingsBundle\Storage\StorageAdapterInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class SettingsExtension extends Extension
{
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/SettingsNotValidException.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getInvalidProperties(string $class): array
return array_keys($this->errors_per_class[$class] ?? throw new \InvalidArgumentException("Class $class is not invalid"));
}

private static function createForSingleClass(object|string $settings, array $errors_per_property): SettingsNotValidException
public static function createForSingleClass(object|string $settings, array $errors_per_property): SettingsNotValidException
{
$class = is_object($settings) ? get_class($settings) : $settings;
return new self([$class => $errors_per_property]);
Expand Down
4 changes: 3 additions & 1 deletion src/Manager/SettingsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public function reload(string|object $settings): object

//Reload the settings class from the storage adapter
$this->settingsHydrator->hydrate($settings, $this->schemaManager->getSchema($settings));

return $settings;
}

public function save(string|object|null $settingsClass = null): void
Expand Down Expand Up @@ -138,7 +140,7 @@ private function getNewInstance(string $settingsClass): object
$instance = $reflectionClass->newInstanceWithoutConstructor();

//If the class is resettable, we call the reset method
if (is_a($settingsClass, ResettableSettingsInterface::class)) {
if (is_a($settingsClass, ResettableSettingsInterface::class, true)) {
$instance->resetToDefaultValues();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Manager/SettingsManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function get(string $settingsClass): object;
* The new instance is returned.
* @param string|object $settings The settings class or the name of the settings class
* @template T of object
* @phpstan-param class-string<T> $settingsClass
* @phpstan-param class-string<T>|object $settings
* @phpstan-return T
*/
public function reload(object|string $settings): object;
Expand Down
2 changes: 1 addition & 1 deletion src/ParameterTypes/BoolType.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function convertNormalizedToPHP(
float|int|bool|array|string|null $value,
SettingsSchema $configSchema,
string $parameterName
): ?int {
): ?bool {
if ($value === null) {
return null;
}
Expand Down

0 comments on commit bc12c35

Please sign in to comment.