PhpStan Access to an undefined property Nette\Database\Table\ActiveRow:

MKI-Miro
Člen | 279
+
+1
-

Ahojte

Ak si dam cez PhpStan zanaylovat kod tak tak mi to hodi kopec hlasok

Access to an undefined property Nette\Database\Table\ActiveRow::$price

V kode to mam takto:

$order = $this->orderRepository->findAll()->get($id);
$price = $order->price;

Mam nieco zle? alebo sko spravne spravit aby dana hlaska sa nevyskytovala?

dakujem

jiri.pudil
Nette Blogger | 1032
+
+1
-

Mělo by pomoci nainstalovat phpstan-nette. Resp. specificky tě zajímá tenhle řádek, ale v Nette aplikaci rozhodně neuškodí to rozšíření mít celé :)

MKI-Miro
Člen | 279
+
0
-

phpstan-nette asi mam

{
	"name": "nette/web-project",
	"description": "Nette: Standard Web Project",
	"keywords": ["nette"],
	"type": "project",
	"license": ["MIT", "BSD-3-Clause", "GPL-2.0", "GPL-3.0"],
	"require": {
		"php": ">= 7.1",
		"nette/application": "^3.0",
		"nette/bootstrap": "^3.0",
		"nette/caching": "^3.0",
		"nette/database": "^3.0",
		"nette/di": "^3.0",
		"nette/finder": "^2.5",
		"nette/forms": "^3.0",
		"nette/http": "^3.0",
		"nette/mail": "^3.0",
		"nette/robot-loader": "^3.0",
		"nette/safe-stream": "^2.4",
		"nette/security": "^3.0",
		"nette/utils": "^3.0",
		"latte/latte": "^2.5",
		"tracy/tracy": "^2.6",
		"gopay/payments-sdk-php": "^1.4",
		"paypal/paypal-checkout-sdk": "^1.0",
		"slevomat/coding-standard": "^6.4"
	},
	"require-dev": {
		"nette/tester": "^2.0",
		"phpstan/phpstan-nette": "^0.12",
		"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1"
	},
	"autoload": {
		"classmap": ["app/Booting.php"]
	},
	"minimum-stability": "stable",
	"config": {
		"platform": {
			"php": "7.4"
		}
	}
}

cize este nieco mam zle?

Petr Parolek
Člen | 455
+
0
-

Ahoj,

máš zavedená pravidla v phpstan.neon? Viz https://github.com/…tree/0.12.14#…

MKI-Miro
Člen | 279
+
0
-

takto to mam v configu

includes:
	- vendor/phpstan/phpstan-nette/extension.neon

parameters:
	autoload_directories:
		- app

	level: 6
MKI-Miro
Člen | 279
+
+2
-

uz som na to asi prisiel, nemal som toto

composer require --dev phpstan/extension-installer