Skip to content

Commit

Permalink
Fix up phpstan baseline. (propelorm#1851)
Browse files Browse the repository at this point in the history
* Fix up phpstan baseline.
  • Loading branch information
dereuromark authored Mar 28, 2022
1 parent 1ad8484 commit caa050b
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 169 deletions.
151 changes: 1 addition & 150 deletions phpstan-baseline.neon

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

3 changes: 2 additions & 1 deletion src/Propel/Generator/Builder/DataModelBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ public function getPlatform(): ?PlatformInterface
if ($this->platform === null) {
// try to load the platform from the table
$table = $this->table;
if ($table && $database = $table->getDatabase()) {
$database = $table->getDatabase();
if ($database) {
$this->setPlatform($database->getPlatform());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Propel/Generator/Config/GeneratorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public function getConnection(?string $database = null): ConnectionInterface
*/
public function getBehaviorLocator(): BehaviorLocator
{
if (!$this->behaviorLocator) {
if ($this->behaviorLocator === null) {
$this->behaviorLocator = new BehaviorLocator($this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Propel/Generator/Model/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Database extends ScopedMappingModel
private $identifierQuoting = false;

/**
* @var \Propel\Generator\Model\Schema
* @var \Propel\Generator\Model\Schema|null
*/
private $parentSchema;

Expand Down Expand Up @@ -802,7 +802,7 @@ public function getDomain(string $name): ?Domain
*/
public function getGeneratorConfig(): ?GeneratorConfigInterface
{
if ($this->parentSchema) {
if ($this->parentSchema !== null) {
return $this->parentSchema->getGeneratorConfig();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Propel/Generator/Model/ForeignKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ protected function doNaming(): void

$newName .= substr(md5(strtolower(implode(':', $hash))), 0, 6);

if ($this->parentTable) {
if ($this->parentTable !== null) {
$newName = $this->parentTable->getCommonName() . '_' . $newName;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Propel/Generator/Platform/MysqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ protected function getIndexType(Index $index): string
{
$type = '';
$vendorInfo = $index->getVendorInfoForType($this->getDatabaseType());
if ($vendorInfo && $vendorInfo->getParameter('Index_type')) {
if ($vendorInfo->getParameter('Index_type')) {
$type = $vendorInfo->getParameter('Index_type') . ' ';
} elseif ($index->isUnique()) {
$type = 'UNIQUE ';
Expand Down
10 changes: 4 additions & 6 deletions src/Propel/Generator/Platform/PgsqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,10 @@ public function getForeignKeyDDL(ForeignKey $fk): string
$script = parent::getForeignKeyDDL($fk);

$pgVendorInfo = $fk->getVendorInfoForType('pgsql');
if ($pgVendorInfo) {
if (filter_var($pgVendorInfo->getParameter('deferrable'), FILTER_VALIDATE_BOOLEAN)) {
$script .= ' DEFERRABLE';
if (filter_var($pgVendorInfo->getParameter('initiallyDeferred'), FILTER_VALIDATE_BOOLEAN)) {
$script .= ' INITIALLY DEFERRED';
}
if (filter_var($pgVendorInfo->getParameter('deferrable'), FILTER_VALIDATE_BOOLEAN)) {
$script .= ' DEFERRABLE';
if (filter_var($pgVendorInfo->getParameter('initiallyDeferred'), FILTER_VALIDATE_BOOLEAN)) {
$script .= ' INITIALLY DEFERRED';
}
}

Expand Down
7 changes: 0 additions & 7 deletions src/Propel/Runtime/Adapter/Pdo/MssqlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Propel\Runtime\Adapter\Exception\MalformedClauseException;
use Propel\Runtime\Adapter\SqlAdapterInterface;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\InvalidArgumentException;
use Propel\Runtime\Map\DatabaseMap;

/**
Expand Down Expand Up @@ -137,19 +136,13 @@ public function random(?string $seed = null): string
* @param int $limit
* @param \Propel\Runtime\ActiveQuery\Criteria|null $criteria
*
* @throws \Propel\Runtime\Exception\InvalidArgumentException
* @throws \Propel\Runtime\Adapter\Exception\ColumnNotFoundException
* @throws \Propel\Runtime\Adapter\Exception\MalformedClauseException
*
* @return void
*/
public function applyLimit(string &$sql, int $offset, int $limit, ?Criteria $criteria = null): void
{
// make sure offset and limit are numeric
if (!is_numeric($offset) || !is_numeric($limit)) {
throw new InvalidArgumentException('MssqlAdapter::applyLimit() expects a number for argument 2 and 3');
}

// split the select and from clauses out of the original query
$selectStatement = '';
$fromStatement = '';
Expand Down

0 comments on commit caa050b

Please sign in to comment.