Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit b08524a

Browse files
Upgrade to PHPStan 0.12 (#13)
1 parent 05291ab commit b08524a

File tree

10 files changed

+134
-99
lines changed

10 files changed

+134
-99
lines changed

.travis.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,22 @@ cache:
77
- $HOME/.composer/cache
88

99
php:
10-
- 7.1
1110
- 7.2
11+
- 7.3
12+
- 7.4
1213
- nightly
1314

1415
env:
1516
global:
16-
- LATEST_PHP_VERSION="7.2"
17+
- LATEST_PHP_VERSION="7.4"
1718
matrix:
1819
- DEPENDENCIES="beta"
1920
- DEPENDENCIES="low"
2021
- DEPENDENCIES="stable"
2122
- SYMFONY_VERSION="2.8.*"
22-
- SYMFONY_VERSION="3.0.*"
23-
- SYMFONY_VERSION="3.1.*"
24-
- SYMFONY_VERSION="3.2.*"
25-
- SYMFONY_VERSION="3.3.*"
2623
- SYMFONY_VERSION="3.4.*"
27-
- SYMFONY_VERSION="4.0.*"
28-
- SYMFONY_VERSION="4.1.*"
29-
- SYMFONY_VERSION="4.2.*"
24+
- SYMFONY_VERSION="4.3.*"
25+
- SYMFONY_VERSION="4.4.*"
3026
- SYMFONY_VERSION="dev-master"
3127

3228
matrix:
@@ -59,11 +55,6 @@ install:
5955
fi;
6056

6157
script:
62-
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
63-
echo "File validation is skipped for older PHP versions";
64-
else
65-
composer validate-files;
66-
fi;
6758
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
6859
echo "Static analysis is skipped for older PHP versions";
6960
else

composer.json

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,27 @@
2828
},
2929

3030
"require": {
31-
"php": ">=7.1",
31+
"php": ">=7.2",
3232
"ext-json": "*",
3333
"doctrine/doctrine-bundle": "~1.6",
3434
"doctrine/orm": "~2.1",
3535
"stof/doctrine-extensions-bundle": "*",
36-
"symfony/framework-bundle": "^3.3|^4.0",
37-
"symfony/security-bundle": "^3.3|^4.0"
36+
"symfony/framework-bundle": "^3.4|^4.0",
37+
"symfony/security-bundle": "^3.4|^4.0"
3838
},
3939
"require-dev": {
4040
"behat/behat": "^3.4",
4141
"behat/mink-extension": "^2.3",
4242
"behat/symfony2-extension": "^2.1",
43+
"doctrine/inflector": "^1.3",
4344
"friendsofphp/php-cs-fixer": "*",
44-
"jakub-onderka/php-parallel-lint": "^1.0",
4545
"php-coveralls/php-coveralls": "^2.1",
46-
"phpstan/phpstan": "^0.10.5",
47-
"phpstan/phpstan-phpunit": "^0.10.0",
48-
"phpunit/phpunit": "^7.4",
46+
"phpstan/phpstan": "^0.12",
47+
"phpstan/phpstan-phpunit": "^0.12",
48+
"phpunit/phpunit": "^8.0",
4949
"sensiolabs/security-checker": "^5.0",
50-
"symfony/phpunit-bridge": "^3.0|^4.0"
50+
"slam/phpstan-extensions": "^4.0",
51+
"symfony/phpunit-bridge": "^3.0|^4.0|^5.0"
5152
},
5253

5354
"scripts": {
@@ -61,26 +62,20 @@
6162
"php-cs-fixer fix --config='./.php_cs' --show-progress=none --no-interaction --diff -v"
6263
],
6364
"run-static-analysis": [
64-
"phpstan analyse --level=7 src/"
65-
],
66-
"run-static-analysis-including-tests": [
67-
"@run-static-analysis",
68-
"phpstan analyse --level=3 tests/"
65+
"phpstan analyse -c tools/phpstan/phpstan.neon --level=8 --no-progress --error-format=table src/ tests/"
6966
],
7067
"run-tests": [
7168
"phpunit"
7269
],
7370
"run-tests-with-clover": [
7471
"phpunit --coverage-clover build/logs/clover.xml"
75-
],
76-
"validate-files": [
77-
"parallel-lint --exclude vendor --exclude bin ."
7872
]
7973
},
8074

8175
"config": {
8276
"bin-dir": "bin",
83-
"sort-packages": true
77+
"sort-packages": true,
78+
"process-timeout": 1000
8479
},
8580
"prefer-stable": true
8681
}

src/Controller/DeviceController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function fingerprintAction(Request $request): Response
4848

4949
if (!$device instanceof Device) {
5050
$device = new Device();
51-
$device->setFingerprint($request->getContent());
51+
$device->setFingerprint((string) $request->getContent());
5252
$device->setSession($session);
5353

5454
$this->deviceFingerprintManager->generateHashes($device);

src/Entity/Device.php

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,89 +13,125 @@
1313
class Device
1414
{
1515
/**
16+
* @var int
17+
*
1618
* @ORM\Id
1719
* @ORM\Column(type="integer")
1820
* @ORM\GeneratedValue(strategy="AUTO")
1921
*/
2022
protected $id;
2123

2224
/**
25+
* @var Session|null
26+
*
2327
* @ORM\ManyToOne(targetEntity="Session", inversedBy="devices")
2428
* @ORM\JoinColumn(nullable=true)
2529
*/
2630
protected $session;
2731

2832
/**
33+
* @var string
34+
*
2935
* @ORM\Column(type="json_array")
3036
*/
3137
protected $fingerprint;
3238

3339
/**
40+
* @var string|null
41+
*
3442
* @ORM\Column(type="text", nullable=true)
3543
*/
3644
protected $canvas;
3745

3846
/**
47+
* @var string|null
48+
*
3949
* @ORM\Column(type="text", nullable=true)
4050
*/
4151
protected $fonts;
4252

4353
/**
54+
* @var string|null
55+
*
4456
* @ORM\Column(type="text", nullable=true)
4557
*/
4658
protected $navigator;
4759

4860
/**
61+
* @var string|null
62+
*
4963
* @ORM\Column(type="text", nullable=true)
5064
*/
5165
protected $plugins;
5266

5367
/**
68+
* @var string|null
69+
*
5470
* @ORM\Column(type="text", nullable=true)
5571
*/
5672
protected $screen;
5773

5874
/**
75+
* @var string|null
76+
*
5977
* @ORM\Column(type="text", nullable=true)
6078
*/
6179
protected $systemColors;
6280

6381
/**
82+
* @var string|null
83+
*
6484
* @ORM\Column(type="text", nullable=true)
6585
*/
6686
protected $storedIds;
6787

6888
/**
89+
* @var \DateTime
90+
*
6991
* @ORM\Column(type="datetime")
7092
* @Gedmo\Timestampable(on="create")
7193
*/
7294
protected $created;
7395

7496
/**
75-
* @return string
97+
* @return int
7698
*/
7799
public function getId()
78100
{
79101
return $this->id;
80102
}
81103

104+
/**
105+
* @return Session|null
106+
*/
82107
public function getSession()
83108
{
84109
return $this->session;
85110
}
86111

112+
/**
113+
* @return $this
114+
*/
87115
public function setSession(?Session $session = null)
88116
{
89117
$this->session = $session;
90118

91119
return $this;
92120
}
93121

122+
/**
123+
* @return string
124+
*/
94125
public function getFingerprint()
95126
{
96127
return $this->fingerprint;
97128
}
98129

130+
/**
131+
* @param string $fingerprint
132+
*
133+
* @return $this
134+
*/
99135
public function setFingerprint($fingerprint)
100136
{
101137
$this->fingerprint = $fingerprint;
@@ -112,7 +148,7 @@ public function getCreated()
112148
}
113149

114150
/**
115-
* @param \DateTime $created
151+
* @param \DateTime $created
116152
*
117153
* @return $this
118154
*/
@@ -124,7 +160,7 @@ public function setCreated($created)
124160
}
125161

126162
/**
127-
* @return string
163+
* @return string|null
128164
*/
129165
public function getCanvas()
130166
{
@@ -144,7 +180,7 @@ public function setCanvas($canvas)
144180
}
145181

146182
/**
147-
* @return string
183+
* @return string|null
148184
*/
149185
public function getFonts()
150186
{
@@ -164,7 +200,7 @@ public function setFonts($fonts)
164200
}
165201

166202
/**
167-
* @return string
203+
* @return string|null
168204
*/
169205
public function getNavigator()
170206
{
@@ -184,7 +220,7 @@ public function setNavigator($navigator)
184220
}
185221

186222
/**
187-
* @return string
223+
* @return string|null
188224
*/
189225
public function getPlugins()
190226
{
@@ -204,7 +240,7 @@ public function setPlugins($plugins)
204240
}
205241

206242
/**
207-
* @return string
243+
* @return string|null
208244
*/
209245
public function getScreen()
210246
{
@@ -224,7 +260,7 @@ public function setScreen($screen)
224260
}
225261

226262
/**
227-
* @return string
263+
* @return string|null
228264
*/
229265
public function getSystemColors()
230266
{
@@ -244,7 +280,7 @@ public function setSystemColors($systemColors)
244280
}
245281

246282
/**
247-
* @return string
283+
* @return string|null
248284
*/
249285
public function getStoredIds()
250286
{

src/Entity/PageView.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,31 @@
1313
class PageView
1414
{
1515
/**
16+
* @var int
17+
*
1618
* @ORM\Column(type="integer")
1719
* @ORM\Id
1820
* @ORM\GeneratedValue(strategy="AUTO")
1921
*/
2022
protected $id;
2123

2224
/**
25+
* @var Session
26+
*
2327
* @ORM\ManyToOne(targetEntity="Session", inversedBy="pageViews")
2428
*/
2529
protected $session;
2630

2731
/**
32+
* @var string
33+
*
2834
* @ORM\Column(type="string")
2935
*/
3036
protected $url;
3137

3238
/**
39+
* @var \DateTime
40+
*
3341
* @ORM\Column(type="datetime")
3442
* @Gedmo\Timestampable(on="create")
3543
*/
@@ -52,7 +60,7 @@ public function getUrl()
5260
}
5361

5462
/**
55-
* @param string $url
63+
* @param string $url
5664
*
5765
* @return $this
5866
*/
@@ -72,7 +80,7 @@ public function getCreated()
7280
}
7381

7482
/**
75-
* @param \DateTime $created
83+
* @param \DateTime $created
7684
*
7785
* @return $this
7886
*/
@@ -92,11 +100,9 @@ public function getSession()
92100
}
93101

94102
/**
95-
* @param Session $session
96-
*
97103
* @return $this
98104
*/
99-
public function setSession(?Session $session = null)
105+
public function setSession(Session $session)
100106
{
101107
$this->session = $session;
102108

src/Entity/Session.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ public function __toString(): string
147147
return $id;
148148
}
149149

150+
/**
151+
* @return string
152+
*/
150153
public function getId()
151154
{
152155
return $this->id;

0 commit comments

Comments
 (0)