@@ -63,46 +63,46 @@ public static function createStore($connection)
63
63
case 'flock ' === $ connection :
64
64
return new FlockStore ();
65
65
66
- case 0 === strpos ($ connection , 'flock:// ' ):
66
+ case str_starts_with ($ connection , 'flock:// ' ):
67
67
return new FlockStore (substr ($ connection , 8 ));
68
68
69
69
case 'semaphore ' === $ connection :
70
70
return new SemaphoreStore ();
71
71
72
- case 0 === strpos ($ connection , 'redis: ' ):
73
- case 0 === strpos ($ connection , 'rediss: ' ):
74
- case 0 === strpos ($ connection , 'memcached: ' ):
72
+ case str_starts_with ($ connection , 'redis: ' ):
73
+ case str_starts_with ($ connection , 'rediss: ' ):
74
+ case str_starts_with ($ connection , 'memcached: ' ):
75
75
if (!class_exists (AbstractAdapter::class)) {
76
76
throw new InvalidArgumentException (sprintf ('Unsupported DSN "%s". Try running "composer require symfony/cache". ' , $ connection ));
77
77
}
78
- $ storeClass = 0 === strpos ($ connection , 'memcached: ' ) ? MemcachedStore::class : RedisStore::class;
78
+ $ storeClass = str_starts_with ($ connection , 'memcached: ' ) ? MemcachedStore::class : RedisStore::class;
79
79
$ connection = AbstractAdapter::createConnection ($ connection , ['lazy ' => true ]);
80
80
81
81
return new $ storeClass ($ connection );
82
82
83
- case 0 === strpos ($ connection , 'mongodb ' ):
83
+ case str_starts_with ($ connection , 'mongodb ' ):
84
84
return new MongoDbStore ($ connection );
85
85
86
- case 0 === strpos ($ connection , 'mssql:// ' ):
87
- case 0 === strpos ($ connection , 'mysql: ' ):
88
- case 0 === strpos ($ connection , 'mysql2:// ' ):
89
- case 0 === strpos ($ connection , 'oci: ' ):
90
- case 0 === strpos ($ connection , 'oci8:// ' ):
91
- case 0 === strpos ($ connection , 'pdo_oci:// ' ):
92
- case 0 === strpos ($ connection , 'pgsql: ' ):
93
- case 0 === strpos ($ connection , 'postgres:// ' ):
94
- case 0 === strpos ($ connection , 'postgresql:// ' ):
95
- case 0 === strpos ($ connection , 'sqlsrv: ' ):
96
- case 0 === strpos ($ connection , 'sqlite: ' ):
97
- case 0 === strpos ($ connection , 'sqlite3:// ' ):
86
+ case str_starts_with ($ connection , 'mssql:// ' ):
87
+ case str_starts_with ($ connection , 'mysql: ' ):
88
+ case str_starts_with ($ connection , 'mysql2:// ' ):
89
+ case str_starts_with ($ connection , 'oci: ' ):
90
+ case str_starts_with ($ connection , 'oci8:// ' ):
91
+ case str_starts_with ($ connection , 'pdo_oci:// ' ):
92
+ case str_starts_with ($ connection , 'pgsql: ' ):
93
+ case str_starts_with ($ connection , 'postgres:// ' ):
94
+ case str_starts_with ($ connection , 'postgresql:// ' ):
95
+ case str_starts_with ($ connection , 'sqlsrv: ' ):
96
+ case str_starts_with ($ connection , 'sqlite: ' ):
97
+ case str_starts_with ($ connection , 'sqlite3:// ' ):
98
98
return new PdoStore ($ connection );
99
99
100
- case 0 === strpos ($ connection , 'pgsql+advisory: ' ):
101
- case 0 === strpos ($ connection , 'postgres+advisory:// ' ):
102
- case 0 === strpos ($ connection , 'postgresql+advisory:// ' ):
100
+ case str_starts_with ($ connection , 'pgsql+advisory: ' ):
101
+ case str_starts_with ($ connection , 'postgres+advisory:// ' ):
102
+ case str_starts_with ($ connection , 'postgresql+advisory:// ' ):
103
103
return new PostgreSqlStore (preg_replace ('/^([^:+]+)\+advisory/ ' , '$1 ' , $ connection ));
104
104
105
- case 0 === strpos ($ connection , 'zookeeper:// ' ):
105
+ case str_starts_with ($ connection , 'zookeeper:// ' ):
106
106
return new ZookeeperStore (ZookeeperStore::createConnection ($ connection ));
107
107
108
108
case 'in-memory ' === $ connection :
0 commit comments