anotherMethod('Foo', 'Bar', 'Lorem'); } /** * @param string $foo * @param string $bar * @return string */ protected function anotherMethod(string $foo, string $bar): string { return 'Foo: ' . $foo . ', Bar: ' . $bar; } /** * Whether a method returns the same type it declares to return. * * @return integer */ public function checkReturnType(): int { return 'Lorem'; } /** * Existence and visibility of accessed properties. It will also point out if a different type from the declared one is assigned to the property. * * @return void */ public function checkTypeOfDeclaredProperties(): void { $this->anotherMethod('Foo', false); } /** * Existence of variables while respecting scopes of branches and loops. * * @return void */ public function checkVariableScopes(): void { $foo = 'Foo'; $exampleFunction = function (): string { return $foo; }; } /** * Useless casting like (string) ‘foo’ and strict comparisons (=== and !==) with different types as operands which always result in false. * * @return boolean */ public function checkUselessTypeComparison(): bool { $lorem = 'Lorem'; return ($lorem === 1); } /** * @return int[] */ public function checkTypeOfArrayVariables(): array { return [ 'Foo', 'Bar', ]; } /** * @return string */ public function checkUnreachableStatement(): string { $lorem = 'Lorem'; return $lorem; $ipsum = 'Ipsum'; } }