Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent improper composition #31

Closed
muglug opened this issue Jan 2, 2017 · 1 comment
Closed

Prevent improper composition #31

muglug opened this issue Jan 2, 2017 · 1 comment

Comments

@muglug
Copy link
Collaborator

muglug commented Jan 2, 2017

With Config::$use_property_default_for_type = true this emits an issue

<?php

class C1 {
    public $p = 42;
}

trait T1 {
    public $p = 'string';
}

class C2 extends C1 {
    use T1;
}

(borrowed from phan/phan#300)

InvalidPropertyAssignment - file.php:8 - $this->p with declared type 'int' cannot be assigned type 'string'

but should emit a stronger issue InvalidPropertyComposition

@muglug
Copy link
Collaborator Author

muglug commented Jul 15, 2018

Closing as something PHPCS could find

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

No branches or pull requests

1 participant