Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
24fc969b
Unverified
Commit
24fc969b
authored
Apr 03, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use in_array() in strict mode
parent
182d3d8f
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
20 additions
and
23 deletions
+20
-23
DriverManager.php
src/DriverManager.php
+1
-1
AbstractPlatform.php
src/Platforms/AbstractPlatform.php
+2
-2
MySqlPlatform.php
src/Platforms/MySqlPlatform.php
+1
-1
ColumnDiff.php
src/Schema/ColumnDiff.php
+1
-1
ForeignKeyConstraint.php
src/Schema/ForeignKeyConstraint.php
+1
-2
PostgreSqlSchemaManager.php
src/Schema/PostgreSqlSchemaManager.php
+1
-1
SQLServerSchemaManager.php
src/Schema/SQLServerSchemaManager.php
+4
-2
Graphviz.php
src/Schema/Visitor/Graphviz.php
+1
-1
NewPrimaryKeyWithNewAutoIncrementColumnTest.php
.../Platform/NewPrimaryKeyWithNewAutoIncrementColumnTest.php
+2
-2
SchemaManagerFunctionalTestCase.php
tests/Functional/Schema/SchemaManagerFunctionalTestCase.php
+1
-1
DBAL630Test.php
tests/Functional/Ticket/DBAL630Test.php
+2
-4
DBAL752Test.php
tests/Functional/Ticket/DBAL752Test.php
+2
-4
DB2SchemaManagerTest.php
tests/Schema/DB2SchemaManagerTest.php
+1
-1
No files found.
src/DriverManager.php
View file @
24fc969b
...
@@ -195,7 +195,7 @@ final class DriverManager
...
@@ -195,7 +195,7 @@ final class DriverManager
throw
DBALException
::
unknownDriver
(
$params
[
'driver'
],
array_keys
(
self
::
$_driverMap
));
throw
DBALException
::
unknownDriver
(
$params
[
'driver'
],
array_keys
(
self
::
$_driverMap
));
}
}
if
(
isset
(
$params
[
'driverClass'
])
&&
!
in_array
(
Driver
::
class
,
class_implements
(
$params
[
'driverClass'
]
,
true
)
))
{
if
(
isset
(
$params
[
'driverClass'
])
&&
!
in_array
(
Driver
::
class
,
class_implements
(
$params
[
'driverClass'
]
),
true
))
{
throw
DBALException
::
invalidDriverClass
(
$params
[
'driverClass'
]);
throw
DBALException
::
invalidDriverClass
(
$params
[
'driverClass'
]);
}
}
}
}
...
...
src/Platforms/AbstractPlatform.php
View file @
24fc969b
...
@@ -494,7 +494,7 @@ abstract class AbstractPlatform
...
@@ -494,7 +494,7 @@ abstract class AbstractPlatform
assert
(
is_array
(
$this
->
doctrineTypeComments
));
assert
(
is_array
(
$this
->
doctrineTypeComments
));
return
in_array
(
$doctrineType
->
getName
(),
$this
->
doctrineTypeComments
);
return
in_array
(
$doctrineType
->
getName
(),
$this
->
doctrineTypeComments
,
true
);
}
}
/**
/**
...
@@ -1586,7 +1586,7 @@ abstract class AbstractPlatform
...
@@ -1586,7 +1586,7 @@ abstract class AbstractPlatform
$columnData
[
'length'
]
=
255
;
$columnData
[
'length'
]
=
255
;
}
}
if
(
in_array
(
$column
->
getName
(),
$options
[
'primary'
]))
{
if
(
in_array
(
$column
->
getName
(),
$options
[
'primary'
]
,
true
))
{
$columnData
[
'primary'
]
=
true
;
$columnData
[
'primary'
]
=
true
;
}
}
...
...
src/Platforms/MySqlPlatform.php
View file @
24fc969b
...
@@ -765,7 +765,7 @@ SQL
...
@@ -765,7 +765,7 @@ SQL
$column
=
$diff
->
fromTable
->
getColumn
(
$columnName
);
$column
=
$diff
->
fromTable
->
getColumn
(
$columnName
);
// Check if an autoincrement column was dropped from the primary key.
// Check if an autoincrement column was dropped from the primary key.
if
(
!
$column
->
getAutoincrement
()
||
in_array
(
$columnName
,
$changedIndex
->
getColumns
()))
{
if
(
!
$column
->
getAutoincrement
()
||
in_array
(
$columnName
,
$changedIndex
->
getColumns
()
,
true
))
{
continue
;
continue
;
}
}
...
...
src/Schema/ColumnDiff.php
View file @
24fc969b
...
@@ -40,7 +40,7 @@ class ColumnDiff
...
@@ -40,7 +40,7 @@ class ColumnDiff
*/
*/
public
function
hasChanged
(
$propertyName
)
public
function
hasChanged
(
$propertyName
)
{
{
return
in_array
(
$propertyName
,
$this
->
changedProperties
);
return
in_array
(
$propertyName
,
$this
->
changedProperties
,
true
);
}
}
/**
/**
...
...
src/Schema/ForeignKeyConstraint.php
View file @
24fc969b
...
@@ -5,7 +5,6 @@ namespace Doctrine\DBAL\Schema;
...
@@ -5,7 +5,6 @@ namespace Doctrine\DBAL\Schema;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
function
array_keys
;
use
function
array_keys
;
use
function
array_map
;
use
function
array_map
;
use
function
in_array
;
use
function
strrpos
;
use
function
strrpos
;
use
function
strtolower
;
use
function
strtolower
;
use
function
strtoupper
;
use
function
strtoupper
;
...
@@ -360,7 +359,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
...
@@ -360,7 +359,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
if
(
isset
(
$this
->
_options
[
$event
]))
{
if
(
isset
(
$this
->
_options
[
$event
]))
{
$onEvent
=
strtoupper
(
$this
->
_options
[
$event
]);
$onEvent
=
strtoupper
(
$this
->
_options
[
$event
]);
if
(
!
in_array
(
$onEvent
,
[
'NO ACTION'
,
'RESTRICT'
])
)
{
if
(
$onEvent
!==
'NO ACTION'
&&
$onEvent
!==
'RESTRICT'
)
{
return
$onEvent
;
return
$onEvent
;
}
}
}
}
...
...
src/Schema/PostgreSqlSchemaManager.php
View file @
24fc969b
...
@@ -94,7 +94,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
...
@@ -94,7 +94,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$paths
=
$this
->
getSchemaSearchPaths
();
$paths
=
$this
->
getSchemaSearchPaths
();
$this
->
existingSchemaPaths
=
array_filter
(
$paths
,
static
function
(
$v
)
use
(
$names
)
{
$this
->
existingSchemaPaths
=
array_filter
(
$paths
,
static
function
(
$v
)
use
(
$names
)
{
return
in_array
(
$v
,
$names
);
return
in_array
(
$v
,
$names
,
true
);
});
});
}
}
...
...
src/Schema/SQLServerSchemaManager.php
View file @
24fc969b
...
@@ -10,7 +10,6 @@ use PDOException;
...
@@ -10,7 +10,6 @@ use PDOException;
use
Throwable
;
use
Throwable
;
use
function
assert
;
use
function
assert
;
use
function
count
;
use
function
count
;
use
function
in_array
;
use
function
is_string
;
use
function
is_string
;
use
function
preg_match
;
use
function
preg_match
;
use
function
sprintf
;
use
function
sprintf
;
...
@@ -104,7 +103,6 @@ class SQLServerSchemaManager extends AbstractSchemaManager
...
@@ -104,7 +103,6 @@ class SQLServerSchemaManager extends AbstractSchemaManager
$tableColumn
[
'comment'
]
=
$this
->
removeDoctrineTypeFromComment
(
$tableColumn
[
'comment'
],
$type
);
$tableColumn
[
'comment'
]
=
$this
->
removeDoctrineTypeFromComment
(
$tableColumn
[
'comment'
],
$type
);
$options
=
[
$options
=
[
'length'
=>
$length
===
0
||
!
in_array
(
$type
,
[
'text'
,
'string'
])
?
null
:
$length
,
'unsigned'
=>
false
,
'unsigned'
=>
false
,
'fixed'
=>
(
bool
)
$fixed
,
'fixed'
=>
(
bool
)
$fixed
,
'default'
=>
$default
,
'default'
=>
$default
,
...
@@ -115,6 +113,10 @@ class SQLServerSchemaManager extends AbstractSchemaManager
...
@@ -115,6 +113,10 @@ class SQLServerSchemaManager extends AbstractSchemaManager
'comment'
=>
$tableColumn
[
'comment'
]
!==
''
?
$tableColumn
[
'comment'
]
:
null
,
'comment'
=>
$tableColumn
[
'comment'
]
!==
''
?
$tableColumn
[
'comment'
]
:
null
,
];
];
if
(
$length
!==
0
&&
(
$type
===
'text'
||
$type
===
'string'
))
{
$options
[
'length'
]
=
$length
;
}
$column
=
new
Column
(
$tableColumn
[
'name'
],
Type
::
getType
(
$type
),
$options
);
$column
=
new
Column
(
$tableColumn
[
'name'
],
Type
::
getType
(
$type
),
$options
);
if
(
isset
(
$tableColumn
[
'collation'
])
&&
$tableColumn
[
'collation'
]
!==
'NULL'
)
{
if
(
isset
(
$tableColumn
[
'collation'
])
&&
$tableColumn
[
'collation'
]
!==
'NULL'
)
{
...
...
src/Schema/Visitor/Graphviz.php
View file @
24fc969b
...
@@ -84,7 +84,7 @@ class Graphviz extends AbstractVisitor
...
@@ -84,7 +84,7 @@ class Graphviz extends AbstractVisitor
$primaryKey
=
$table
->
getPrimaryKey
();
$primaryKey
=
$table
->
getPrimaryKey
();
if
(
$primaryKey
!==
null
&&
in_array
(
$column
->
getName
(),
$primaryKey
->
getColumns
()))
{
if
(
$primaryKey
!==
null
&&
in_array
(
$column
->
getName
(),
$primaryKey
->
getColumns
()
,
true
))
{
$label
.=
"
\xe2\x9c\xb7
"
;
$label
.=
"
\xe2\x9c\xb7
"
;
}
}
$label
.=
'</TD></TR>'
;
$label
.=
'</TD></TR>'
;
...
...
tests/Functional/Platform/NewPrimaryKeyWithNewAutoIncrementColumnTest.php
View file @
24fc969b
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
namespace
Doctrine\DBAL\Tests\Functional\Platform
;
namespace
Doctrine\DBAL\Tests\Functional\Platform
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\MySqlPlatform
;
use
Doctrine\DBAL\Schema\Comparator
;
use
Doctrine\DBAL\Schema\Comparator
;
use
Doctrine\DBAL\Tests\FunctionalTestCase
;
use
Doctrine\DBAL\Tests\FunctionalTestCase
;
use
function
in_array
;
final
class
NewPrimaryKeyWithNewAutoIncrementColumnTest
extends
FunctionalTestCase
final
class
NewPrimaryKeyWithNewAutoIncrementColumnTest
extends
FunctionalTestCase
{
{
...
@@ -16,7 +16,7 @@ final class NewPrimaryKeyWithNewAutoIncrementColumnTest extends FunctionalTestCa
...
@@ -16,7 +16,7 @@ final class NewPrimaryKeyWithNewAutoIncrementColumnTest extends FunctionalTestCa
{
{
parent
::
setUp
();
parent
::
setUp
();
if
(
in_array
(
$this
->
getPlatform
()
->
getName
(),
[
'mysql'
])
)
{
if
(
$this
->
getPlatform
()
instanceof
MySqlPlatform
)
{
return
;
return
;
}
}
...
...
tests/Functional/Schema/SchemaManagerFunctionalTestCase.php
View file @
24fc969b
...
@@ -220,7 +220,7 @@ abstract class SchemaManagerFunctionalTestCase extends FunctionalTestCase
...
@@ -220,7 +220,7 @@ abstract class SchemaManagerFunctionalTestCase extends FunctionalTestCase
$namespaces
=
$this
->
schemaManager
->
listNamespaceNames
();
$namespaces
=
$this
->
schemaManager
->
listNamespaceNames
();
$namespaces
=
array_map
(
'strtolower'
,
$namespaces
);
$namespaces
=
array_map
(
'strtolower'
,
$namespaces
);
if
(
!
in_array
(
'test_create_schema'
,
$namespaces
))
{
if
(
!
in_array
(
'test_create_schema'
,
$namespaces
,
true
))
{
$this
->
connection
->
executeUpdate
(
$this
->
schemaManager
->
getDatabasePlatform
()
->
getCreateSchemaSQL
(
'test_create_schema'
));
$this
->
connection
->
executeUpdate
(
$this
->
schemaManager
->
getDatabasePlatform
()
->
getCreateSchemaSQL
(
'test_create_schema'
));
$namespaces
=
$this
->
schemaManager
->
listNamespaceNames
();
$namespaces
=
$this
->
schemaManager
->
listNamespaceNames
();
...
...
tests/Functional/Ticket/DBAL630Test.php
View file @
24fc969b
...
@@ -4,9 +4,9 @@ namespace Doctrine\DBAL\Tests\Functional\Ticket;
...
@@ -4,9 +4,9 @@ namespace Doctrine\DBAL\Tests\Functional\Ticket;
use
Doctrine\DBAL\DBALException
;
use
Doctrine\DBAL\DBALException
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\Platforms\PostgreSQL94Platform
;
use
Doctrine\DBAL\Tests\FunctionalTestCase
;
use
Doctrine\DBAL\Tests\FunctionalTestCase
;
use
PDO
;
use
PDO
;
use
function
in_array
;
/**
/**
* @group DBAL-630
* @group DBAL-630
...
@@ -20,9 +20,7 @@ class DBAL630Test extends FunctionalTestCase
...
@@ -20,9 +20,7 @@ class DBAL630Test extends FunctionalTestCase
{
{
parent
::
setUp
();
parent
::
setUp
();
$platform
=
$this
->
connection
->
getDatabasePlatform
()
->
getName
();
if
(
!
$this
->
connection
->
getDatabasePlatform
()
instanceof
PostgreSQL94Platform
)
{
if
(
!
in_array
(
$platform
,
[
'postgresql'
]))
{
self
::
markTestSkipped
(
'Currently restricted to PostgreSQL'
);
self
::
markTestSkipped
(
'Currently restricted to PostgreSQL'
);
}
}
...
...
tests/Functional/Ticket/DBAL752Test.php
View file @
24fc969b
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
namespace
Doctrine\DBAL\Tests\Functional\Ticket
;
namespace
Doctrine\DBAL\Tests\Functional\Ticket
;
use
Doctrine\DBAL\Platforms\SqlitePlatform
;
use
Doctrine\DBAL\Tests\FunctionalTestCase
;
use
Doctrine\DBAL\Tests\FunctionalTestCase
;
use
function
in_array
;
/**
/**
* @group DBAL-752
* @group DBAL-752
...
@@ -14,9 +14,7 @@ class DBAL752Test extends FunctionalTestCase
...
@@ -14,9 +14,7 @@ class DBAL752Test extends FunctionalTestCase
{
{
parent
::
setUp
();
parent
::
setUp
();
$platform
=
$this
->
connection
->
getDatabasePlatform
()
->
getName
();
if
(
$this
->
connection
->
getDatabasePlatform
()
instanceof
SqlitePlatform
)
{
if
(
in_array
(
$platform
,
[
'sqlite'
]))
{
return
;
return
;
}
}
...
...
tests/Schema/DB2SchemaManagerTest.php
View file @
24fc969b
...
@@ -93,7 +93,7 @@ final class DB2SchemaManagerTest extends TestCase
...
@@ -93,7 +93,7 @@ final class DB2SchemaManagerTest extends TestCase
{
{
$accepted
=
[
'T_FOO'
,
'T_BAR'
];
$accepted
=
[
'T_FOO'
,
'T_BAR'
];
$this
->
conn
->
getConfiguration
()
->
setSchemaAssetsFilter
(
static
function
(
$assetName
)
use
(
$accepted
)
{
$this
->
conn
->
getConfiguration
()
->
setSchemaAssetsFilter
(
static
function
(
$assetName
)
use
(
$accepted
)
{
return
in_array
(
$assetName
,
$accepted
);
return
in_array
(
$assetName
,
$accepted
,
true
);
});
});
$this
->
conn
->
expects
(
self
::
any
())
->
method
(
'quote'
);
$this
->
conn
->
expects
(
self
::
any
())
->
method
(
'quote'
);
$this
->
conn
->
expects
(
self
::
once
())
->
method
(
'fetchAll'
)
->
will
(
self
::
returnValue
([
$this
->
conn
->
expects
(
self
::
once
())
->
method
(
'fetchAll'
)
->
will
(
self
::
returnValue
([
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment