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

[WIP] Improved PHPDoc comments #440

Closed
wants to merge 7 commits into from
Closed

Conversation

erayd
Copy link
Contributor

@erayd erayd commented Jun 27, 2017

What

Improve PHPDoc comments as per #438.

Why

As per #438.

@erayd erayd changed the base branch from master to 6.0.0-dev June 27, 2017 07:19
@erayd erayd changed the title Improved PHPDoc comments [WIP] Improved PHPDoc comments Jun 27, 2017
@erayd
Copy link
Contributor Author

erayd commented Jun 27, 2017

Progress checklist for PHPDoc comments on public API entities:

Methods

  • Validator::__construct - create a validator instance with a custom factory
  • Validator::validate - main entry point for validation
  • Validator::check - BC alias of validate (pre-5.0.0), does not pass $value by reference
  • Validator::coerce - BC alias of validate (pre-5.0.0), sets CHECK_MODE_COERCE_TYPES
  • Validator::getErrors - get array of validation errors
  • Validator::numErrors - get number of validation errors
  • Validator::getErrorMask - get the error categories
  • Validator::isValid - get overall validation status
  • Validator::reset - reset validation status
  • Factory::__construct - create a Factory instance with custom SchemaStorage, UriRetriever or $checkmode
  • Factory::setConfig - overwrite $checkMode
  • Factory::getConfig - get $checkMode or a filtered subset
  • Factory::addConfig - add options to $checkMode
  • Factory::removeConfig - remove options from $checkMode
  • Factory::getSchemaStorage - get the current SchemaStorage instance
  • Factory::getUriRetriever - get the current UriRetriever instance
  • SchemaStorage::__construct - create a SchemaStorage instance with custom UriRetriever or UriResolver
  • SchemaStorage::addSchema - add a schema to the storage instance by identifyng URI
  • SchemaStorage::getSchema - get a schema from the storage instance by identifying URI
  • UriRetriever::retrieve - retrieve & return a decoded JSON schema object
  • UriResolver::resolve - resolve a URI to absolute

Class Constants

  • Validator::SCHEMA_MEDIA_TYPE - official JSON schema media type
  • Validator::ERROR_* - error categories (bitmask)
  • Constraint::CHECK_MODE_* - validation options (bitmask)

Class Properties

  • Validator::$factory - dependency injection, state & instance management

Data Formats

  • The array data returned by Validator::getErrors()

Exceptions

  • InvalidArgumentException
  • InvalidConfigException
  • InvalidSchemaException
  • InvalidSchemaMediaTypeException
  • InvalidSourceUriException
  • JsonDecodingException
  • ResourceNotFoundException
  • RuntimeException
  • UnresolvableJsonPointerException
  • UriResolverException
  • ValidationException

*
* Both the value object and the schema are supposed to be the result of a json_decode call,
* or an equivalent value. The validation logic used is a non-compliant superset of the spec
* available at http://json-schema.org/ (versions prior to draft-06).
*
* Note that the first argument is passwd by reference, so you must pass in a variable.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May as well fix the typo while you're in here ("passwd")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

* @param mixed $value The value that should be validated against the schema - *not* a reference
* @param mixed $schema The schema to validate against
*
* @return int Bitwise list of error categories encountered during validation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe convey a little more information about the return, eg, tell us what value means no errors...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@erayd erayd mentioned this pull request Oct 3, 2017
@bighappyface bighappyface added the Release Release-related item label Aug 8, 2018
@bighappyface
Copy link
Collaborator

@erayd I am ready to get in on this.

I have put #392, #438 and #440 in progress in the v6.0.0 project. Is it fair to say that this PR will satisfy those two open issues?

Also, how would you prefer I contribute to this work?

@bighappyface
Copy link
Collaborator

I have opened a PR this branch - erayd#1

So far I have taken a stab at commenting Class Constants and Exceptions.

Should we rebase this branch now or after more of the work is done?

@Seldaek Seldaek closed this Jul 22, 2021
@Seldaek Seldaek deleted the branch jsonrainbow:6.0.0-dev July 22, 2021 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release Release-related item
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants