Skip to content

Commit

Permalink
Fix up baseline errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Jul 23, 2020
1 parent 3c834b1 commit 75bc1f0
Show file tree
Hide file tree
Showing 41 changed files with 142 additions and 234 deletions.
139 changes: 2 additions & 137 deletions phpstan-baseline.neon

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ parameters:
ignoreErrors:
- '#Call to an undefined method .+Collection::.+Array\(\)#'
- '#Class .+TreeBuilder constructor invoked with 0 parameters, 1-3 required#'
-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\TreeBuilder\\:\\:root\\(\\)\\.$#"
path: src/Propel/Common/Config/PropelConfiguration.php
- '#PHPDoc tag @throws with type .+FileLoaderLoadException|.+LoaderLoadException is not subtype of Throwable#'
2 changes: 1 addition & 1 deletion src/Propel/Common/Config/XmlToArrayConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected static function simpleXmlToArray($xml)

// add the children attributes as if they where children
foreach ($v->attributes() as $ak => $av) {
if ($ak == 'id') {
if ($ak === 'id') {
// special exception: if there is a key named 'id'
// then we will name the current key after that id
$k = self::getConvertedXmlValue($av);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function getArchiveTable()
}

/**
* @param \Propel\Generator\Builder\Om\ObjectBuilder $builder
* @param \Propel\Generator\Builder\Om\AbstractOMBuilder $builder
*
* @return mixed
*/
Expand All @@ -162,7 +162,7 @@ public function getArchiveTablePhpName($builder)
}

/**
* @param \Propel\Generator\Builder\Om\ObjectBuilder $builder
* @param \Propel\Generator\Builder\Om\AbstractOMBuilder $builder
*
* @return string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ public function modifyTable()
continue;
}

if ($behavior->getName() == 'concrete_inheritance_parent' || $behavior->getName() == 'concrete_inheritance') {
if ($behavior->getName() === 'concrete_inheritance_parent' || $behavior->getName() === 'concrete_inheritance') {
continue;
}
// validate behavior. If validate behavior already exists, clone only rules from parent
if ('validate' === $behavior->getName() && $table->hasBehavior('validate')) {
$table->getBehavior('validate')->mergeParameters($behavior->getParameters());
/** @var \Propel\Generator\Behavior\Validate\ValidateBehavior $validateBehavior */
$validateBehavior = $table->getBehavior('validate');
$validateBehavior->mergeParameters($behavior->getParameters());

continue;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Propel/Generator/Behavior/I18n/I18nBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ protected function moveI18nColumns(): void

// validate behavior: move rules associated to the column
if ($table->hasBehavior('validate')) {
/** @var \Propel\Generator\Behavior\Validate\ValidateBehavior $validateBehavior */
$validateBehavior = $table->getBehavior('validate');
$params = $validateBehavior->getParametersFromColumnName($columnName);
$i18nValidateParams = array_merge($i18nValidateParams, $params);
Expand All @@ -320,6 +321,7 @@ protected function moveI18nColumns(): void
$i18nTable->addBehavior($i18nVbehavior);

// current table must have almost 1 validation rule
/** @var \Propel\Generator\Behavior\Validate\ValidateBehavior $validate */
$validate = $table->getBehavior('validate');
$validate->addRuleOnPk();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ public function validate(ValidatorInterface $validator = null)

$this->validationFailures = $failureMap;

return (Boolean) (!(count($this->validationFailures) > 0));
return (bool) (!(count($this->validationFailures) > 0));

}
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ public function populateFromVersion(\$version, \$con = null, &\$loadedObjects =
$plural = false;
$fkPhpName = $this->builder->getRefFKPhpNameAffix($fk, $plural);
$foreignTable = $fk->getTable();
/** @var \Propel\Generator\Behavior\Versionable\VersionableBehavior $foreignBehavior */
$foreignBehavior = $foreignTable->getBehavior($this->behavior->getId());
$foreignVersionTable = $foreignBehavior->getVersionTable();
$fkColumnIds = $this->behavior->getReferrerIdsColumn($fk);
Expand Down
2 changes: 2 additions & 0 deletions src/Propel/Generator/Builder/Om/ObjectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ public function addTemporalAccessorComment(&$script, Column $column)
$dateTimeClass = $this->getDateTimeClass($column);

$handleMysqlDate = false;
$mysqlInvalidDateString = '';
if ($this->getPlatform() instanceof MysqlPlatform) {
if ($column->getType() === PropelTypes::TIMESTAMP) {
$handleMysqlDate = true;
Expand Down Expand Up @@ -6028,6 +6029,7 @@ protected function addDoInsertBodyRaw()
'\PDO'
);
$table = $this->getTable();
/** @var \Propel\Generator\Platform\DefaultPlatform $platform */
$platform = $this->getPlatform();
$primaryKeyMethodInfo = '';
if ($table->getIdMethodParameters()) {
Expand Down
1 change: 1 addition & 0 deletions src/Propel/Generator/Builder/Om/TableMapBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ protected function addInitialize(&$script)
{

$table = $this->getTable();
/** @var \Propel\Generator\Platform\DefaultPlatform $platform */
$platform = $this->getPlatform();

$script .= "
Expand Down
2 changes: 1 addition & 1 deletion src/Propel/Generator/Command/Helper/ConsoleHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private function formatQuestion($question, $default = null)
/**
* @inheritdoc
*/
public function select($question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
public function select($question, $choices, $default = null, $attempts = null, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
{
return parent::select(
$this->output,
Expand Down
12 changes: 6 additions & 6 deletions src/Propel/Generator/Command/Helper/ConsoleHelper3.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ public function writeSummary($items)
/**
* @inheritdoc
*/
public function select($question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
public function select($question, $choices, $default = null, $attempts = null, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
{
$question = new ChoiceQuestion($this->formatQuestion($question, $default), $choices, $default);
$choiceQuestion = new ChoiceQuestion($this->formatQuestion($question, $default), $choices, $default);

if ($attempts) {
$question->setMaxAttempts($attempts);
$choiceQuestion->setMaxAttempts($attempts);
}

$question->setErrorMessage($errorMessage);
$question->setMultiselect($multiselect);
$choiceQuestion->setErrorMessage($errorMessage);
$choiceQuestion->setMultiselect($multiselect);

return parent::ask($this->input, $this->output, $question);
return parent::ask($this->input, $this->output, $choiceQuestion);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ public function writeSummary($items);
* @param string $question
* @param array $choices
* @param string $default
* @param bool $attempts
* @param int|null $attempts
* @param string $errorMessage
* @param bool $multiselect
*
* @return mixed
*/
public function select($question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
public function select($question, $choices, $default = null, $attempts = null, $errorMessage = 'Value "%s" is invalid', $multiselect = false);

/**
* @param string $question
Expand Down
1 change: 1 addition & 0 deletions src/Propel/Generator/Command/MigrationDiffCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

$conn = $manager->getAdapterConnection($name);
/** @var \Propel\Generator\Platform\DefaultPlatform $platform */
$platform = $generatorConfig->getConfiguredPlatform($conn, $name);
if ($input->getOption('disable-identifier-quoting')) {
$platform->setIdentifierQuoting(false);
Expand Down
Loading

0 comments on commit 75bc1f0

Please sign in to comment.