Skip to content

Commit

Permalink
Fix phpstan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Nov 28, 2023
1 parent f811b6f commit c02ecf7
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 48 deletions.
2 changes: 1 addition & 1 deletion app/src/Element/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function parse(): array
*/
public function getValue(): string
{
if (isset($this->value) && !is_null($this->value)) {
if (isset($this->value) && $this->value !== null) {
return (string) $this->value;
} elseif (isset($this->element['default'])) {
return (string) $this->element['default'];
Expand Down
4 changes: 2 additions & 2 deletions app/src/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function setData($data)
$this->data = $data->toArray();
} elseif ($data instanceof Repository) {
$this->data = $data->all();
} elseif (is_array($data)) { // @phpstan-ignore-line $data could be collection, model or repository
} elseif (is_array($data)) {
$this->data = $data;
} else {
throw new InvalidArgumentException('Data must be an array, a Collection, a Model or a Repository');
Expand Down Expand Up @@ -195,7 +195,7 @@ public function setInputArgument(string $inputName, string $property, $value)
if ($this->schema->has($inputName)) {
// Get the element and force set the property
$element = $this->schema->get($inputName);
$element['form'][$property] = $value; // @phpstan-ignore-line
$element['form'][$property] = $value;

// Push back the modifyed element in the schema
$this->schema->set($inputName, $element);
Expand Down
20 changes: 0 additions & 20 deletions app/src/FormGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ public function getPath(): string
return __DIR__ . '/../';
}

/**
* {@inheritdoc}
*
* @codeCoverageIgnore
*/
public function getBakeryCommands(): array
{
return [];
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -74,14 +64,4 @@ public function getServices(): array
{
return [];
}

/**
* Returns a list of all Middlewares classes.
*
* @return string[]
*/
public function getMiddlewares(): array
{
return [];
}
}
2 changes: 1 addition & 1 deletion app/tests/ElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testElement(string $elementName, string $class, $value, array $e
$schema = new RequestSchemaRepository($loader->load());

// Get InputInterface from the `$elementName` in the schema
$inputSchema = $schema[$elementName]['form']; // @phpstan-ignore-line
$inputSchema = $schema[$elementName]['form'];

/** @var InputInterface */
$input = new $class($elementName, $inputSchema, $value);
Expand Down
2 changes: 1 addition & 1 deletion app/tests/FormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testForm(string $file, $data, array $expected): void
$schema = new RequestSchemaRepository($loader->load());

// Generate the form
$form = new Form($schema, $data); // @phpstan-ignore-line
$form = new Form($schema, $data);

// Test to make sure the class creation is fine
$this->assertInstanceOf(Form::class, $form); // @phpstan-ignore-line
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: max
level: 8
ignoreErrors:
- '#Dynamic call to static method PHPUnit\\Framework\\.*#'
includes:
Expand Down
21 changes: 0 additions & 21 deletions public/src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ public function getPath(): string
return __DIR__ . '/../';
}

/**
* {@inheritdoc}
*
* @codeCoverageIgnore
*/
public function getBakeryCommands(): array
{
return [];
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -76,15 +66,4 @@ public function getServices(): array
{
return [];
}

/**
* Returns a list of all Middlewares classes.
*
* @return string[]
*/
public function getMiddlewares(): array
{
return [
];
}
}
1 change: 0 additions & 1 deletion public/src/Data/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public static function all(): Collection
*/
public static function find(int $id): ?array
{
// @phpstan-ignore-next-line
return self::all()->where('id', $id)->first();
}
}

0 comments on commit c02ecf7

Please sign in to comment.