Skip to content

Commit

Permalink
fixed phpstan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mmadariaga committed Nov 29, 2023
1 parent 6381ac9 commit 5f1b013
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 832 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ private function getAssociationMappings(ClassMetadata $classMetadata): array
$classMetadata->associationMappings,
function ($property) {
return in_array(
$property['type'] ?? null,
$property['type'],
[
ClassMetadata::ONE_TO_MANY,
ClassMetadata::MANY_TO_MANY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private function getMappedFieldsInEntity(ClassMetadata $classMetadata)
$classMetadata->associationMappings,
function ($mapping) {
return in_array(
$mapping['type'] ?? null,
$mapping['type'],
[
ClassMetadata::ONE_TO_ONE,
ClassMetadata::ONE_TO_MANY,
Expand Down
3 changes: 2 additions & 1 deletion EntityGeneratorBundle/Doctrine/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

class Property implements CodeGeneratorUnitInterface
{
/** @var mixed | null */
private $defaultValue;

public function __construct(
Expand Down Expand Up @@ -130,7 +131,7 @@ public function toString(string $nlLeftPad = ''): string
: 'false';
break;
case 'string':
if (!is_null($this->defaultValue)) {
if (!empty($this->defaultValue)) {
$defaultValue = '\'' . $this->defaultValue . '\'';
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,38 +145,6 @@ private function getDoctrineClassTemplate(
];
}

private function getClassTemplate(
ClassMetadata $metadata,
$templateName
): array
{
[$path, $variables] = $this->generator->generateClassContentVariables(
$metadata->name,
$templateName,
[]
);

if (file_exists($variables['relative_path'])) {
$variables['relative_path'] = realpath($variables['relative_path']);
} else {
$variables['relative_path'] = str_replace(
'vendor/composer/../../',
'',
$variables['relative_path']
);
}


return [
$variables['relative_path'],
$this->fileManager->parseTemplate(
$path,
$variables
)
];
}


private function createClassManipulator(
string $classPath,
?string $content
Expand Down
Loading

0 comments on commit 5f1b013

Please sign in to comment.