Coder Social home page Coder Social logo

php-language-extensions's People

Contributors

daveliddament avatar doppynl avatar ruudk avatar szepeviktor avatar zebulanstanphill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-language-extensions's Issues

Allow TestTag on classes

I would like to put the TestTag attribute on a class-level. Marking the entire class as intended for use in tests only.

I sometimes write extremely simple implementations of interfaces that only exist for making writing tests that interact with the interface simpler.
Instead of configuring a mock, you can just create an instance of this class with a couple of constructor arguments.

It is sometimes useful that these classes are available in the library for other code that depends on this library. So writing tests there becomes easier.

What do you think of this change?
Would you accept a pull-request to adjust the attribute for this? And an additional pull-request in DaveLiddament/phpstan-php-language-extensions for the implementation?

Update #[Package] functionality to allow sub namespaces

Currently #[Package] is modelled on Java's package visibility modifier. This does not allow access to sub namespaces. E.g. in Java a call from namespace Foo\Bar would not be allowed to call a method with package visibility in Foo\Bar\Baz.

Options:

  1. Consider changing the default behaviour of #[Package] to allow calls to sub namespaces.
  2. Add an argument to the #[Package] attribute to allow/disallow sub namespaces (possibly allowing as default).

See this twitter comment.

Feature request: Override

Like Java's override: a method with #[Override] must override a method in the parent class, or implements a method of an interface.

Fix PHP version constraints

PHP version constraints are, I think, incorrect:

From composer.json

Constraints are:

"php": "^8.0 || ^8.1 || ^8.2"

I think this will allow 8.3, which is wrong as we don't know 8.3 will introduce a break to attributes. (Admittedly it is very unlikely that it will).

Version should either be:

"php": "8.0.* || 8.1.* || 8.2.*"

or

"php": ">=8.0 <8.3"

#[Friend] complains about calls from test code

I am using the #[Friend] attribute to limit access to methods, but it's also complaining about access from test code.

One could argue that test code should be testing the public API of a unit, but it's not that straightforward.

For example, I have a value object inside an aggregate root that should only be managed inside the aggregate. However, I still want my unit tests to test the value object in isolation, which the #[Friend] complains about.

Is there a more elegant way to deal with this other than suppressing the PHPStan errors?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.