phpstan complains: PropertyPath (from symfony) does not specify iterable type

Error shown when using the PropertyPath instead of the Interface

When you are using phpstan and the Symfony Component Property Access and you would get this error:

Method YAY\Sync\Subject::initPath() has parameter $path with no value type specified in iterable type Symfony\Component\PropertyAccess\PropertyPath

Make sure that you

a) have the phpstan symfony extension installed

b) you are using the interface:

private function initPath(PropertyPathInterface $path): void

instead of

private function initPath(PropertyPath $path): void

Just the plain path. The reason is, that in the phpstan symfony extension the interface is stubbed and has the iterable type applied.




Senior Web Developer — Entrepreneur —

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Apple Watch Series 6 unlocks exciting future for developers

FPGA Based Image Processing Algorithm Using Xilinx System Generator

Rosalind — Mortal Fibonacci Rabbits

Java programming with examples and solutions.

OriginTrail Decentralized Knowledge Graph (DKG) as the technology backbone of the life sciences…

Rock the Command Line

Atlassian Bamboo vs Jetbrains Teamcity — there’s a clear winner

Using NATS to Implement Service Mesh Functionality, Part 2: Security

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Philipp Scheit

Philipp Scheit

Senior Web Developer — Entrepreneur —

More from Medium

Symfony Station Communiqué — 21 January 2022. A look at Symfony and PHP news.

Manually implement OAuth Client functionality in Symfony

Integrate static code analysis to PHP projects

How to enable PCNTL in Apache