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

Commit

Permalink
Upgrade to PHPStan 0.12 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-georgiev committed Jan 13, 2020
1 parent 05291ab commit b08524a
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 99 deletions.
19 changes: 5 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,22 @@ cache:
- $HOME/.composer/cache

php:
- 7.1
- 7.2
- 7.3
- 7.4
- nightly

env:
global:
- LATEST_PHP_VERSION="7.2"
- LATEST_PHP_VERSION="7.4"
matrix:
- DEPENDENCIES="beta"
- DEPENDENCIES="low"
- DEPENDENCIES="stable"
- SYMFONY_VERSION="2.8.*"
- SYMFONY_VERSION="3.0.*"
- SYMFONY_VERSION="3.1.*"
- SYMFONY_VERSION="3.2.*"
- SYMFONY_VERSION="3.3.*"
- SYMFONY_VERSION="3.4.*"
- SYMFONY_VERSION="4.0.*"
- SYMFONY_VERSION="4.1.*"
- SYMFONY_VERSION="4.2.*"
- SYMFONY_VERSION="4.3.*"
- SYMFONY_VERSION="4.4.*"
- SYMFONY_VERSION="dev-master"

matrix:
Expand Down Expand Up @@ -59,11 +55,6 @@ install:
fi;

script:
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
echo "File validation is skipped for older PHP versions";
else
composer validate-files;
fi;
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
echo "Static analysis is skipped for older PHP versions";
else
Expand Down
29 changes: 12 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,27 @@
},

"require": {
"php": ">=7.1",
"php": ">=7.2",
"ext-json": "*",
"doctrine/doctrine-bundle": "~1.6",
"doctrine/orm": "~2.1",
"stof/doctrine-extensions-bundle": "*",
"symfony/framework-bundle": "^3.3|^4.0",
"symfony/security-bundle": "^3.3|^4.0"
"symfony/framework-bundle": "^3.4|^4.0",
"symfony/security-bundle": "^3.4|^4.0"
},
"require-dev": {
"behat/behat": "^3.4",
"behat/mink-extension": "^2.3",
"behat/symfony2-extension": "^2.1",
"doctrine/inflector": "^1.3",
"friendsofphp/php-cs-fixer": "*",
"jakub-onderka/php-parallel-lint": "^1.0",
"php-coveralls/php-coveralls": "^2.1",
"phpstan/phpstan": "^0.10.5",
"phpstan/phpstan-phpunit": "^0.10.0",
"phpunit/phpunit": "^7.4",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^8.0",
"sensiolabs/security-checker": "^5.0",
"symfony/phpunit-bridge": "^3.0|^4.0"
"slam/phpstan-extensions": "^4.0",
"symfony/phpunit-bridge": "^3.0|^4.0|^5.0"
},

"scripts": {
Expand All @@ -61,26 +62,20 @@
"php-cs-fixer fix --config='./.php_cs' --show-progress=none --no-interaction --diff -v"
],
"run-static-analysis": [
"phpstan analyse --level=7 src/"
],
"run-static-analysis-including-tests": [
"@run-static-analysis",
"phpstan analyse --level=3 tests/"
"phpstan analyse -c tools/phpstan/phpstan.neon --level=8 --no-progress --error-format=table src/ tests/"
],
"run-tests": [
"phpunit"
],
"run-tests-with-clover": [
"phpunit --coverage-clover build/logs/clover.xml"
],
"validate-files": [
"parallel-lint --exclude vendor --exclude bin ."
]
},

"config": {
"bin-dir": "bin",
"sort-packages": true
"sort-packages": true,
"process-timeout": 1000
},
"prefer-stable": true
}
2 changes: 1 addition & 1 deletion src/Controller/DeviceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function fingerprintAction(Request $request): Response

if (!$device instanceof Device) {
$device = new Device();
$device->setFingerprint($request->getContent());
$device->setFingerprint((string) $request->getContent());
$device->setSession($session);

$this->deviceFingerprintManager->generateHashes($device);
Expand Down
54 changes: 45 additions & 9 deletions src/Entity/Device.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,89 +13,125 @@
class Device
{
/**
* @var int
*
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;

/**
* @var Session|null
*
* @ORM\ManyToOne(targetEntity="Session", inversedBy="devices")
* @ORM\JoinColumn(nullable=true)
*/
protected $session;

/**
* @var string
*
* @ORM\Column(type="json_array")
*/
protected $fingerprint;

/**
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
*/
protected $canvas;

/**
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
*/
protected $fonts;

/**
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
*/
protected $navigator;

/**
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
*/
protected $plugins;

/**
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
*/
protected $screen;

/**
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
*/
protected $systemColors;

/**
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
*/
protected $storedIds;

/**
* @var \DateTime
*
* @ORM\Column(type="datetime")
* @Gedmo\Timestampable(on="create")
*/
protected $created;

/**
* @return string
* @return int
*/
public function getId()
{
return $this->id;
}

/**
* @return Session|null
*/
public function getSession()
{
return $this->session;
}

/**
* @return $this
*/
public function setSession(?Session $session = null)
{
$this->session = $session;

return $this;
}

/**
* @return string
*/
public function getFingerprint()
{
return $this->fingerprint;
}

/**
* @param string $fingerprint
*
* @return $this
*/
public function setFingerprint($fingerprint)
{
$this->fingerprint = $fingerprint;
Expand All @@ -112,7 +148,7 @@ public function getCreated()
}

/**
* @param \DateTime $created
* @param \DateTime $created
*
* @return $this
*/
Expand All @@ -124,7 +160,7 @@ public function setCreated($created)
}

/**
* @return string
* @return string|null
*/
public function getCanvas()
{
Expand All @@ -144,7 +180,7 @@ public function setCanvas($canvas)
}

/**
* @return string
* @return string|null
*/
public function getFonts()
{
Expand All @@ -164,7 +200,7 @@ public function setFonts($fonts)
}

/**
* @return string
* @return string|null
*/
public function getNavigator()
{
Expand All @@ -184,7 +220,7 @@ public function setNavigator($navigator)
}

/**
* @return string
* @return string|null
*/
public function getPlugins()
{
Expand All @@ -204,7 +240,7 @@ public function setPlugins($plugins)
}

/**
* @return string
* @return string|null
*/
public function getScreen()
{
Expand All @@ -224,7 +260,7 @@ public function setScreen($screen)
}

/**
* @return string
* @return string|null
*/
public function getSystemColors()
{
Expand All @@ -244,7 +280,7 @@ public function setSystemColors($systemColors)
}

/**
* @return string
* @return string|null
*/
public function getStoredIds()
{
Expand Down
16 changes: 11 additions & 5 deletions src/Entity/PageView.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,31 @@
class PageView
{
/**
* @var int
*
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;

/**
* @var Session
*
* @ORM\ManyToOne(targetEntity="Session", inversedBy="pageViews")
*/
protected $session;

/**
* @var string
*
* @ORM\Column(type="string")
*/
protected $url;

/**
* @var \DateTime
*
* @ORM\Column(type="datetime")
* @Gedmo\Timestampable(on="create")
*/
Expand All @@ -52,7 +60,7 @@ public function getUrl()
}

/**
* @param string $url
* @param string $url
*
* @return $this
*/
Expand All @@ -72,7 +80,7 @@ public function getCreated()
}

/**
* @param \DateTime $created
* @param \DateTime $created
*
* @return $this
*/
Expand All @@ -92,11 +100,9 @@ public function getSession()
}

/**
* @param Session $session
*
* @return $this
*/
public function setSession(?Session $session = null)
public function setSession(Session $session)
{
$this->session = $session;

Expand Down
3 changes: 3 additions & 0 deletions src/Entity/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ public function __toString(): string
return $id;
}

/**
* @return string
*/
public function getId()
{
return $this->id;
Expand Down
Loading

0 comments on commit b08524a

Please sign in to comment.