Skip to content

Null-coalescing operator usage warning on clean code - [int] vs [float] #1643

Closed
@badmansan

Description

Subject Details
Plugin Php Inspections (EA Extended)
Language level PHP 7.2

Current behaviour

interface TokenInterface {
	public const NEW_TOKEN_LIFETIME = 3600 * 24;
	public function generate(int $timestamp = NULL);
}

class Token implements TokenInterface {
	public function generate(int $timestamp = NULL) {
		$expired = $timestamp ?? time() + self::NEW_TOKEN_LIFETIME;
	}
}

Inspection warning on $timestamp ?? time() + self::NEW_TOKEN_LIFETIME with message [EA] Resolved operands types are not complimentary, while they should be ([int] vs [float]).

Expected behaviour

No warnings.

Environment details

изображение

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions