rfc:objects-can-be-falsifiable
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:objects-can-be-falsifiable [2020/07/16 14:59] – issues, scope, references joshbruce | rfc:objects-can-be-falsifiable [2022/11/04 23:14] (current) – Add static analysis section joshbruce | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Objects can be declared falsifiable ====== | ====== PHP RFC: Objects can be declared falsifiable ====== | ||
- | * Version: 0.91 | + | * Version: 0.92 |
* Date: 2020-07-16 | * Date: 2020-07-16 | ||
- | * Author: Josh Bruce, josh@joshbruce.dev | + | * Author: Josh Bruce, josh@joshbruce.com |
- | * Implementer: | + | * Implementer: |
* Status: Under discussion | * Status: Under discussion | ||
* First Published at: http:// | * First Published at: http:// | ||
Line 145: | Line 145: | ||
// ]; | // ]; | ||
</ | </ | ||
+ | |||
+ | ===== Notes for static analysis ==== | ||
+ | |||
+ | Validate that the implementation can have both a true and false return, not just one or the other. | ||
+ | |||
+ | ===== Type juggling tables ==== | ||
+ | |||
+ | With no modifications or interventions by the developer and all types are empty (or false in the case of boolean): | ||
+ | |||
+ | ^Cast to | ||
+ | | ^null (unset) | ||
+ | |unset (nullify) |null | ||
+ | |custom type | ||
+ | |object | ||
+ | |array | ||
+ | |float | ||
+ | |integer | ||
+ | |string | ||
+ | |boolean | ||
===== Truthiness tables ===== | ===== Truthiness tables ===== | ||
Scalar types and their relationship to < | Scalar types and their relationship to < | ||
+ | |||
Line 200: | Line 220: | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
+ | ==== November 3, 2022 ==== | ||
+ | |||
+ | * How would this impact < | ||
+ | |||
+ | |||
+ | ==== July 16, 2020 ==== | ||
+ | |||
+ | * Default value for parameters with a class type can only be NULL | ||
+ | |||
+ | |||
==== July 15, 2020 ==== | ==== July 15, 2020 ==== | ||
* How type safe is this really? (desire is to increase type safety - partially by being able to return a single type from a method that resolves to false) | * How type safe is this really? (desire is to increase type safety - partially by being able to return a single type from a method that resolves to false) | ||
- | * Impact to static analysis. Multiple static analyzers for PHP exist: Phan (Rasmus and Morrison), PHPStan (Mirtes), Psalm (Vimeo), and a general list - https:// | + | * RESOLVED (see static analysis section): |
* Interaction with equality operators. | * Interaction with equality operators. | ||
* Language around < | * Language around < | ||
* What version of PHP switched to only allowing < | * What version of PHP switched to only allowing < | ||
- | |||
==== < July 15, 2020 ==== | ==== < July 15, 2020 ==== | ||
Line 213: | Line 242: | ||
* Presumes impact similar to < | * Presumes impact similar to < | ||
* As of this writing I do not have the knowledge, practice, and practical understanding of implementing within PHP internals to implement this myself. If you're interested in (helping) implement this concept, please do reach out (help may be in the form guidance and instruction or full implementation, | * As of this writing I do not have the knowledge, practice, and practical understanding of implementing within PHP internals to implement this myself. If you're interested in (helping) implement this concept, please do reach out (help may be in the form guidance and instruction or full implementation, | ||
+ | |||
===== Unaffected PHP Functionality ===== | ===== Unaffected PHP Functionality ===== | ||
Line 236: | Line 266: | ||
===== Implementation ===== | ===== Implementation ===== | ||
+ | |||
+ | Temporary PR for implementation, | ||
+ | |||
After the project is implemented, | After the project is implemented, | ||
* the version(s) it was merged into | * the version(s) it was merged into | ||
Line 243: | Line 276: | ||
===== References ===== | ===== References ===== | ||
+ | |||
These RFCs are identified as similar in spirit to this [concept], possibly helped by this [concept], or this [concept] is potentially helped by the result of the linked RFC. | These RFCs are identified as similar in spirit to this [concept], possibly helped by this [concept], or this [concept] is potentially helped by the result of the linked RFC. | ||
Line 249: | Line 283: | ||
Implemented: | Implemented: | ||
+ | * [[https:// | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
- | |||
- | Accepted: | ||
- | |||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | Accepted: | ||
+ | |||
+ | * [[https:// | ||
Under review and discussion: | Under review and discussion: | ||
- | * [[https:// | ||
- | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
Declined: | Declined: | ||
+ | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | |||
+ | Other: | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
===== Rejected Features ===== | ===== Rejected Features ===== | ||
Keep this updated with features that were discussed on the mail lists. | Keep this updated with features that were discussed on the mail lists. |
rfc/objects-can-be-falsifiable.1594911558.txt.gz · Last modified: 2020/07/16 14:59 by joshbruce